]> Pileus Git - ~andy/gtk/blob - gdk/gdkcolor.h
Start of integration of Erwann Chenede's multihead work from the
[~andy/gtk] / gdk / gdkcolor.h
1 #ifndef __GDK_COLOR_H__
2 #define __GDK_COLOR_H__
3
4 #include <gdk/gdktypes.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif /* __cplusplus */
9
10 /* The color type.
11  *   A color consists of red, green and blue values in the
12  *    range 0-65535 and a pixel value. The pixel value is highly
13  *    dependent on the depth and colormap which this color will
14  *    be used to draw into. Therefore, sharing colors between
15  *    colormaps is a bad idea.
16  */
17 struct _GdkColor
18 {
19   guint32 pixel;
20   guint16 red;
21   guint16 green;
22   guint16 blue;
23 };
24
25 /* The colormap type.
26  */
27
28 typedef struct _GdkColormapClass GdkColormapClass;
29
30 #define GDK_TYPE_COLORMAP              (gdk_colormap_get_type ())
31 #define GDK_COLORMAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_COLORMAP, GdkColormap))
32 #define GDK_COLORMAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_COLORMAP, GdkColormapClass))
33 #define GDK_IS_COLORMAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_COLORMAP))
34 #define GDK_IS_COLORMAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_COLORMAP))
35 #define GDK_COLORMAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_COLORMAP, GdkColormapClass))
36
37 #define GDK_TYPE_COLOR                 (gdk_color_get_type ())
38
39 struct _GdkColormap
40 {
41   GObject parent_instance;
42
43   /*< public >*/
44   gint      size;
45   GdkColor *colors;
46
47   /*< private >*/
48   GdkVisual *visual;
49   
50   gpointer windowing_data;
51   GdkScreen *screen;
52 };
53
54 struct _GdkColormapClass
55 {
56   GObjectClass parent_class;
57
58 };
59
60 GType        gdk_colormap_get_type (void) G_GNUC_CONST;
61
62 GdkColormap* gdk_colormap_new     (GdkVisual   *visual,
63                                    gboolean     allocate);
64
65 #ifndef GDK_DISABLE_DEPRECATED
66 GdkColormap* gdk_colormap_ref     (GdkColormap *cmap);
67 void         gdk_colormap_unref   (GdkColormap *cmap);
68 #endif 
69
70 #ifndef GDK_MULTIHEAD_SAFE
71 GdkColormap* gdk_colormap_get_system            (void);
72 #endif
73
74 #ifndef GDK_DISABLE_DEPRECATED
75 gint gdk_colormap_get_system_size  (void);
76
77 void gdk_colormap_change (GdkColormap   *colormap,
78                           gint           ncolors);
79 #endif 
80
81 gint  gdk_colormap_alloc_colors   (GdkColormap *colormap,
82                                    GdkColor    *colors,
83                                    gint         ncolors,
84                                    gboolean     writeable,
85                                    gboolean     best_match,
86                                    gboolean    *success);
87 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
88                                    GdkColor    *color,
89                                    gboolean     writeable,
90                                    gboolean     best_match);
91 void     gdk_colormap_free_colors (GdkColormap *colormap,
92                                    GdkColor    *colors,
93                                    gint         ncolors);
94 void     gdk_colormap_query_color (GdkColormap *colormap,
95                                    gulong       pixel,
96                                    GdkColor    *result);
97
98 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
99      
100 GdkColor *gdk_color_copy  (const GdkColor *color);
101 void      gdk_color_free  (GdkColor       *color);
102 gint      gdk_color_parse (const gchar    *spec,
103                            GdkColor       *color);
104 guint     gdk_color_hash  (const GdkColor *colora);
105 gboolean  gdk_color_equal (const GdkColor *colora,
106                            const GdkColor *colorb);
107
108 GType     gdk_color_get_type (void);
109
110 /* The following functions are deprecated */
111 #ifndef GDK_DISABLE_DEPRECATED
112 void gdk_colors_store    (GdkColormap   *colormap,
113                           GdkColor      *colors,
114                           gint           ncolors);
115 gint gdk_colors_alloc    (GdkColormap   *colormap,
116                           gboolean       contiguous,
117                           gulong        *planes,
118                           gint           nplanes,
119                           gulong        *pixels,
120                           gint           npixels);
121 void gdk_colors_free     (GdkColormap   *colormap,
122                           gulong        *pixels,
123                           gint           npixels,
124                           gulong         planes);
125 gint gdk_color_white     (GdkColormap   *colormap,
126                           GdkColor      *color);
127 gint gdk_color_black     (GdkColormap   *colormap,
128                           GdkColor      *color);
129 gint gdk_color_alloc     (GdkColormap   *colormap,
130                           GdkColor      *color);
131 gint gdk_color_change    (GdkColormap   *colormap,
132                           GdkColor      *color);
133 #endif /* GDK_DISABLE_DEPRECATED */
134
135 #ifdef __cplusplus
136 }
137 #endif /* __cplusplus */
138
139 #endif /* __GDK_COLOR_H__ */