]> Pileus Git - ~andy/gtk/blob - gdk/gdkcolor.h
test was backward, so deprecated functions were excluded by default
[~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
38 struct _GdkColormap
39 {
40   GObject parent_instance;
41
42   /*< public >*/
43   gint      size;
44   GdkColor *colors;
45
46   /*< private >*/
47   GdkVisual *visual;
48   
49   gpointer windowing_data;
50 };
51
52 struct _GdkColormapClass
53 {
54   GObjectClass parent_class;
55
56 };
57
58 GType        gdk_colormap_get_type (void) G_GNUC_CONST;
59
60 GdkColormap* gdk_colormap_new     (GdkVisual   *visual,
61                                    gboolean     allocate);
62 GdkColormap* gdk_colormap_ref     (GdkColormap *cmap);
63 void         gdk_colormap_unref   (GdkColormap *cmap);
64
65 GdkColormap* gdk_colormap_get_system       (void);
66 gint         gdk_colormap_get_system_size  (void);
67
68 void gdk_colormap_change (GdkColormap   *colormap,
69                           gint           ncolors);
70
71
72 gint  gdk_colormap_alloc_colors   (GdkColormap *colormap,
73                                    GdkColor    *colors,
74                                    gint         ncolors,
75                                    gboolean     writeable,
76                                    gboolean     best_match,
77                                    gboolean    *success);
78 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
79                                    GdkColor    *color,
80                                    gboolean     writeable,
81                                    gboolean     best_match);
82 void     gdk_colormap_free_colors (GdkColormap *colormap,
83                                    GdkColor    *colors,
84                                    gint         ncolors);
85 void     gdk_colormap_query_color (GdkColormap *colormap,
86                                    gulong       pixel,
87                                    GdkColor    *result);
88
89 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
90      
91 GdkColor *gdk_color_copy  (const GdkColor *color);
92 void      gdk_color_free  (GdkColor       *color);
93 gint      gdk_color_parse (const gchar    *spec,
94                            GdkColor       *color);
95 guint     gdk_color_hash  (const GdkColor *colora);
96 gboolean  gdk_color_equal (const GdkColor *colora,
97                            const GdkColor *colorb);
98
99 /* The following functions are deprecated */
100 #ifndef GDK_DISABLE_DEPRECATED
101 void gdk_colors_store    (GdkColormap   *colormap,
102                           GdkColor      *colors,
103                           gint           ncolors);
104 gint gdk_colors_alloc    (GdkColormap   *colormap,
105                           gboolean       contiguous,
106                           gulong        *planes,
107                           gint           nplanes,
108                           gulong        *pixels,
109                           gint           npixels);
110 void gdk_colors_free     (GdkColormap   *colormap,
111                           gulong        *pixels,
112                           gint           npixels,
113                           gulong         planes);
114 gint gdk_color_white     (GdkColormap   *colormap,
115                           GdkColor      *color);
116 gint gdk_color_black     (GdkColormap   *colormap,
117                           GdkColor      *color);
118 gint gdk_color_alloc     (GdkColormap   *colormap,
119                           GdkColor      *color);
120 gint gdk_color_change    (GdkColormap   *colormap,
121                           GdkColor      *color);
122 #endif /* GDK_DISABLE_DEPRECATED */
123
124 #ifdef __cplusplus
125 }
126 #endif /* __cplusplus */
127
128 #endif /* __GDK_COLOR_H__ */