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