1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GIMP_COLOR_FRAME_H__
19 #define __GIMP_COLOR_FRAME_H__
20 
21 
22 #define GIMP_COLOR_FRAME_ROWS 5
23 
24 
25 #define GIMP_TYPE_COLOR_FRAME            (gimp_color_frame_get_type ())
26 #define GIMP_COLOR_FRAME(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_FRAME, GimpColorFrame))
27 #define GIMP_COLOR_FRAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_FRAME, GimpColorFrameClass))
28 #define GIMP_IS_COLOR_FRAME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_FRAME))
29 #define GIMP_IS_COLOR_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_FRAME))
30 #define GIMP_COLOR_FRAME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_FRAME, GimpColorFrameClass))
31 
32 
33 typedef struct _GimpColorFrameClass GimpColorFrameClass;
34 
35 struct _GimpColorFrame
36 {
37   GimpFrame           parent_instance;
38 
39   gboolean            sample_valid;
40   gboolean            sample_average;
41   const Babl         *sample_format;
42   gdouble             pixel[4];
43   GimpRGB             color;
44   gint                x;
45   gint                y;
46 
47   GimpColorPickMode   pick_mode;
48 
49   PangoEllipsizeMode  ellipsize;
50 
51   gboolean            has_number;
52   gint                number;
53 
54   gboolean            has_color_area;
55   gboolean            has_coords;
56 
57   GtkWidget          *combo;
58   GtkWidget          *color_area;
59   GtkWidget          *coords_box_x;
60   GtkWidget          *coords_box_y;
61   GtkWidget          *coords_label_x;
62   GtkWidget          *coords_label_y;
63   GtkWidget          *name_labels[GIMP_COLOR_FRAME_ROWS];
64   GtkWidget          *value_labels[GIMP_COLOR_FRAME_ROWS];
65 
66   PangoLayout        *number_layout;
67 
68   GimpColorConfig    *config;
69   GimpColorTransform *transform;
70 };
71 
72 struct _GimpColorFrameClass
73 {
74   GimpFrameClass      parent_class;
75 };
76 
77 
78 GType       gimp_color_frame_get_type           (void) G_GNUC_CONST;
79 
80 GtkWidget * gimp_color_frame_new                (void);
81 
82 void        gimp_color_frame_set_mode           (GimpColorFrame     *frame,
83                                                  GimpColorPickMode   mode);
84 
85 void        gimp_color_frame_set_ellipsize      (GimpColorFrame     *frame,
86                                                  PangoEllipsizeMode  ellipsize);
87 
88 void        gimp_color_frame_set_has_number     (GimpColorFrame     *frame,
89                                                  gboolean            has_number);
90 void        gimp_color_frame_set_number         (GimpColorFrame     *frame,
91                                                  gint                number);
92 
93 void        gimp_color_frame_set_has_color_area (GimpColorFrame     *frame,
94                                                  gboolean            has_color_area);
95 void        gimp_color_frame_set_has_coords     (GimpColorFrame     *frame,
96                                                  gboolean            has_coords);
97 
98 void        gimp_color_frame_set_color          (GimpColorFrame     *frame,
99                                                  gboolean            sample_average,
100                                                  const Babl         *format,
101                                                  gpointer            pixel,
102                                                  const GimpRGB      *color,
103                                                  gint                x,
104                                                  gint                y);
105 void        gimp_color_frame_set_invalid        (GimpColorFrame     *frame);
106 
107 void        gimp_color_frame_set_color_config   (GimpColorFrame     *frame,
108                                                  GimpColorConfig    *config);
109 
110 
111 #endif  /*  __GIMP_COLOR_FRAME_H__  */
112