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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24 
25 #ifndef __GDK_VISUAL_H__
26 #define __GDK_VISUAL_H__
27 
28 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
29 #error "Only <gdk/gdk.h> can be included directly."
30 #endif
31 
32 #include <gdk/gdktypes.h>
33 #include <gdk/gdkversionmacros.h>
34 
35 G_BEGIN_DECLS
36 
37 #define GDK_TYPE_VISUAL              (gdk_visual_get_type ())
38 #define GDK_VISUAL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_VISUAL, GdkVisual))
39 #define GDK_IS_VISUAL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_VISUAL))
40 
41 /**
42  * GdkVisualType:
43  * @GDK_VISUAL_STATIC_GRAY: Each pixel value indexes a grayscale value
44  *     directly.
45  * @GDK_VISUAL_GRAYSCALE: Each pixel is an index into a color map that
46  *     maps pixel values into grayscale values. The color map can be
47  *     changed by an application.
48  * @GDK_VISUAL_STATIC_COLOR: Each pixel value is an index into a predefined,
49  *     unmodifiable color map that maps pixel values into RGB values.
50  * @GDK_VISUAL_PSEUDO_COLOR: Each pixel is an index into a color map that
51  *     maps pixel values into rgb values. The color map can be changed by
52  *     an application.
53  * @GDK_VISUAL_TRUE_COLOR: Each pixel value directly contains red, green,
54  *     and blue components. Use gdk_visual_get_red_pixel_details(), etc,
55  *     to obtain information about how the components are assembled into
56  *     a pixel value.
57  * @GDK_VISUAL_DIRECT_COLOR: Each pixel value contains red, green, and blue
58  *     components as for %GDK_VISUAL_TRUE_COLOR, but the components are
59  *     mapped via a color table into the final output table instead of
60  *     being converted directly.
61  *
62  * A set of values that describe the manner in which the pixel values
63  * for a visual are converted into RGB values for display.
64  */
65 typedef enum
66 {
67   GDK_VISUAL_STATIC_GRAY,
68   GDK_VISUAL_GRAYSCALE,
69   GDK_VISUAL_STATIC_COLOR,
70   GDK_VISUAL_PSEUDO_COLOR,
71   GDK_VISUAL_TRUE_COLOR,
72   GDK_VISUAL_DIRECT_COLOR
73 } GdkVisualType;
74 
75 /**
76  * GdkVisual:
77  *
78  * A #GdkVisual contains information about
79  * a particular visual.
80  */
81 
82 GDK_AVAILABLE_IN_ALL
83 GType         gdk_visual_get_type            (void) G_GNUC_CONST;
84 
85 GDK_DEPRECATED_IN_3_22
86 gint          gdk_visual_get_best_depth      (void);
87 GDK_DEPRECATED_IN_3_22
88 GdkVisualType gdk_visual_get_best_type       (void);
89 GDK_DEPRECATED_IN_3_22_FOR(gdk_screen_get_system_visual)
90 GdkVisual*    gdk_visual_get_system          (void);
91 GDK_DEPRECATED_IN_3_22
92 GdkVisual*    gdk_visual_get_best            (void);
93 GDK_DEPRECATED_IN_3_22
94 GdkVisual*    gdk_visual_get_best_with_depth (gint           depth);
95 GDK_DEPRECATED_IN_3_22
96 GdkVisual*    gdk_visual_get_best_with_type  (GdkVisualType  visual_type);
97 GDK_DEPRECATED_IN_3_22
98 GdkVisual*    gdk_visual_get_best_with_both  (gint           depth,
99                                               GdkVisualType  visual_type);
100 
101 GDK_DEPRECATED_IN_3_22
102 void gdk_query_depths       (gint           **depths,
103                              gint            *count);
104 GDK_DEPRECATED_IN_3_22
105 void gdk_query_visual_types (GdkVisualType  **visual_types,
106                              gint            *count);
107 
108 GDK_DEPRECATED_IN_3_22_FOR(gdk_screen_list_visuals)
109 GList* gdk_list_visuals (void);
110 
111 GDK_AVAILABLE_IN_ALL
112 GdkScreen    *gdk_visual_get_screen (GdkVisual *visual);
113 
114 GDK_AVAILABLE_IN_ALL
115 GdkVisualType gdk_visual_get_visual_type         (GdkVisual *visual);
116 GDK_AVAILABLE_IN_ALL
117 gint          gdk_visual_get_depth               (GdkVisual *visual);
118 GDK_DEPRECATED_IN_3_22
119 GdkByteOrder  gdk_visual_get_byte_order          (GdkVisual *visual);
120 GDK_DEPRECATED_IN_3_22
121 gint          gdk_visual_get_colormap_size       (GdkVisual *visual);
122 GDK_DEPRECATED_IN_3_22
123 gint          gdk_visual_get_bits_per_rgb        (GdkVisual *visual);
124 GDK_AVAILABLE_IN_ALL
125 void          gdk_visual_get_red_pixel_details   (GdkVisual *visual,
126                                                   guint32   *mask,
127                                                   gint      *shift,
128                                                   gint      *precision);
129 GDK_AVAILABLE_IN_ALL
130 void          gdk_visual_get_green_pixel_details (GdkVisual *visual,
131                                                   guint32   *mask,
132                                                   gint      *shift,
133                                                   gint      *precision);
134 GDK_AVAILABLE_IN_ALL
135 void          gdk_visual_get_blue_pixel_details  (GdkVisual *visual,
136                                                   guint32   *mask,
137                                                   gint      *shift,
138                                                   gint      *precision);
139 
140 G_END_DECLS
141 
142 #endif /* __GDK_VISUAL_H__ */
143