]> Pileus Git - ~andy/gtk/blob - gdk/gdkvisual.h
Merge from stable:
[~andy/gtk] / gdk / gdkvisual.h
1 #ifndef __GDK_VISUAL_H__
2 #define __GDK_VISUAL_H__
3
4 #include <gdk/gdktypes.h>
5
6 G_BEGIN_DECLS
7
8 #define GDK_TYPE_VISUAL              (gdk_visual_get_type ())
9 #define GDK_VISUAL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_VISUAL, GdkVisual))
10 #define GDK_VISUAL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_VISUAL, GdkVisualClass))
11 #define GDK_IS_VISUAL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_VISUAL))
12 #define GDK_IS_VISUAL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VISUAL))
13 #define GDK_VISUAL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VISUAL, GdkVisualClass))
14
15 typedef struct _GdkVisualClass    GdkVisualClass;
16
17 /* Types of visuals.
18  *   StaticGray:
19  *   Grayscale:
20  *   StaticColor:
21  *   PseudoColor:
22  *   TrueColor:
23  *   DirectColor:
24  */
25 typedef enum
26 {
27   GDK_VISUAL_STATIC_GRAY,
28   GDK_VISUAL_GRAYSCALE,
29   GDK_VISUAL_STATIC_COLOR,
30   GDK_VISUAL_PSEUDO_COLOR,
31   GDK_VISUAL_TRUE_COLOR,
32   GDK_VISUAL_DIRECT_COLOR
33 } GdkVisualType;
34
35 /* The visual type.
36  *   "type" is the type of visual this is (PseudoColor, TrueColor, etc).
37  *   "depth" is the bit depth of this visual.
38  *   "colormap_size" is the size of a colormap for this visual.
39  *   "bits_per_rgb" is the number of significant bits per red, green and blue.
40  *  The red, green and blue masks, shifts and precisions refer
41  *   to value needed to calculate pixel values in TrueColor and DirectColor
42  *   visuals. The "mask" is the significant bits within the pixel. The
43  *   "shift" is the number of bits left we must shift a primary for it
44  *   to be in position (according to the "mask"). "prec" refers to how
45  *   much precision the pixel value contains for a particular primary.
46  */
47 struct _GdkVisual
48 {
49   GObject parent_instance;
50   
51   GdkVisualType type;
52   gint depth;
53   GdkByteOrder byte_order;
54   gint colormap_size;
55   gint bits_per_rgb;
56
57   guint32 red_mask;
58   gint red_shift;
59   gint red_prec;
60
61   guint32 green_mask;
62   gint green_shift;
63   gint green_prec;
64
65   guint32 blue_mask;
66   gint blue_shift;
67   gint blue_prec;
68 };
69
70 GType         gdk_visual_get_type            (void);
71
72 #ifndef GDK_MULTIHEAD_SAFE
73 gint          gdk_visual_get_best_depth      (void);
74 GdkVisualType gdk_visual_get_best_type       (void);
75 GdkVisual*    gdk_visual_get_system          (void);
76 GdkVisual*    gdk_visual_get_best            (void);
77 GdkVisual*    gdk_visual_get_best_with_depth (gint           depth);
78 GdkVisual*    gdk_visual_get_best_with_type  (GdkVisualType  visual_type);
79 GdkVisual*    gdk_visual_get_best_with_both  (gint           depth,
80                                               GdkVisualType  visual_type);
81
82 void gdk_query_depths       (gint           **depths,
83                              gint            *count);
84 void gdk_query_visual_types (GdkVisualType  **visual_types,
85                              gint            *count);
86
87 GList* gdk_list_visuals (void);
88 #endif
89
90 GdkScreen *gdk_visual_get_screen (GdkVisual *visual);
91
92 #ifndef GDK_DISABLE_DEPRECATED
93 #define gdk_visual_ref(v) g_object_ref(v)
94 #define gdk_visual_unref(v) g_object_unref(v)
95 #endif
96
97 G_END_DECLS
98
99 #endif /* __GDK_VISUAL_H__ */