]> Pileus Git - ~andy/gtk/blob - gdk/gdkcolor.h
x11: s/GDK_DRAWABLE_DISPLAY/GDK_WINDOW_DISPLAY
[~andy/gtk] / gdk / gdkcolor.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_COLOR_H__
32 #define __GDK_COLOR_H__
33
34 #include <cairo.h>
35 #include <gdk/gdktypes.h>
36
37 G_BEGIN_DECLS
38
39 /* The color type.
40  *   A color consists of red, green and blue values in the
41  *    range 0-65535 and a pixel value. The pixel value is highly
42  *    dependent on the depth and colormap which this color will
43  *    be used to draw into. Therefore, sharing colors between
44  *    colormaps is a bad idea.
45  */
46 struct _GdkColor
47 {
48   guint32 pixel;
49   guint16 red;
50   guint16 green;
51   guint16 blue;
52 };
53
54 /* The colormap type.
55  */
56
57 typedef struct _GdkColormapClass GdkColormapClass;
58
59 #define GDK_TYPE_COLORMAP              (gdk_colormap_get_type ())
60 #define GDK_COLORMAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_COLORMAP, GdkColormap))
61 #define GDK_COLORMAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_COLORMAP, GdkColormapClass))
62 #define GDK_IS_COLORMAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_COLORMAP))
63 #define GDK_IS_COLORMAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_COLORMAP))
64 #define GDK_COLORMAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_COLORMAP, GdkColormapClass))
65
66 #define GDK_TYPE_COLOR                 (gdk_color_get_type ())
67
68 struct _GdkColormap
69 {
70   /*< private >*/
71   GObject parent_instance;
72
73   /*< public >*/
74   gint      GSEAL (size);
75   GdkColor *GSEAL (colors);
76
77   /*< private >*/
78   GdkVisual *GSEAL (visual);
79   
80   gpointer GSEAL (windowing_data);
81 };
82
83 struct _GdkColormapClass
84 {
85   GObjectClass parent_class;
86
87 };
88
89 GType        gdk_colormap_get_type (void) G_GNUC_CONST;
90
91 GdkColormap* gdk_colormap_new     (GdkVisual   *visual,
92                                    gboolean     allocate);
93
94 #ifndef GDK_MULTIHEAD_SAFE
95 GdkColormap* gdk_colormap_get_system            (void);
96 #endif
97
98 GdkScreen *gdk_colormap_get_screen (GdkColormap *cmap);
99
100 gint  gdk_colormap_alloc_colors   (GdkColormap    *colormap,
101                                    GdkColor       *colors,
102                                    gint            n_colors,
103                                    gboolean        writeable,
104                                    gboolean        best_match,
105                                    gboolean       *success);
106 gboolean gdk_colormap_alloc_color (GdkColormap    *colormap,
107                                    GdkColor       *color,
108                                    gboolean        writeable,
109                                    gboolean        best_match);
110 void     gdk_colormap_free_colors (GdkColormap    *colormap,
111                                    const GdkColor *colors,
112                                    gint            n_colors);
113
114 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
115
116 GdkColor *gdk_color_copy      (const GdkColor *color);
117 void      gdk_color_free      (GdkColor       *color);
118 gboolean  gdk_color_parse     (const gchar    *spec,
119                                GdkColor       *color);
120 guint     gdk_color_hash      (const GdkColor *colora);
121 gboolean  gdk_color_equal     (const GdkColor *colora,
122                                const GdkColor *colorb);
123 gchar *   gdk_color_to_string (const GdkColor *color);
124
125 GType     gdk_color_get_type (void) G_GNUC_CONST;
126
127
128 G_END_DECLS
129
130 #endif /* __GDK_COLOR_H__ */