1
<!-- ##### SECTION Title ##### -->
4
<!-- ##### SECTION Short_Description ##### -->
6
Low-level display hardware information
8
<!-- ##### SECTION Long_Description ##### -->
10
A #GdkVisual describes a particular video hardware display format. It includes
11
information about the number of bits used for each color, the way the bits are
12
translated into an RGB value for display, and the way the bits are stored in
13
memory. For example, a piece of display hardware might support 24-bit color,
14
16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given
15
pixel size, pixels can be in different formats; for example the "red" element
16
of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower
20
Usually you can avoid thinking about visuals in GTK+. Visuals are useful to
21
interpret the contents of a #GdkImage, but you should avoid #GdkImage precisely
22
because its contents depend on the display hardware; use #GdkPixbuf instead, for
23
all but the most low-level purposes. Also, anytime you provide a #GdkColormap,
24
the visual is implied as part of the colormap (gdk_colormap_get_visual()), so
25
you won't have to provide a visual in addition.
28
There are several standard visuals. The visual returned
29
by gdk_visual_get_system() is the system's default
30
visual. gdk_rgb_get_visual() return the visual most
31
suited to displaying full-color image data. If you
32
use the calls in #GdkRGB, you should create your windows
33
using this visual (and the colormap returned by
34
gdk_rgb_get_colormap()).
37
A number of functions are provided for determining
38
the "best" available visual. For the purposes of
39
making this determination, higher bit depths are
40
considered better, and for visuals of the same
41
bit depth, %GDK_VISUAL_PSEUDO_COLOR is preferred at
42
8bpp, otherwise, the visual types are ranked in the
43
order of (highest to lowest) %GDK_VISUAL_DIRECT_COLOR,
44
%GDK_VISUAL_TRUE_COLOR, %GDK_VISUAL_PSEUDO_COLOR,
45
%GDK_VISUAL_STATIC_COLOR, %GDK_VISUAL_GRAYSCALE,
46
then %GDK_VISUAL_STATIC_GRAY.
49
<!-- ##### SECTION See_Also ##### -->
51
#GdkImage, #GdkColormap, #GdkRGB
54
<!-- ##### SECTION Stability_Level ##### -->
57
<!-- ##### SECTION Image ##### -->
60
<!-- ##### STRUCT GdkVisual ##### -->
62
The <type>GdkVisual</type> structure contains information about
66
<example id="rgbmask">
67
<title>Constructing a pixel value from components</title>
70
pixel_from_rgb (GdkVisual *visual,
71
guchar r, guchar b, guchar g)
73
return ((r >> (16 - visual->red_prec)) << visual->red_shift) |
74
((g >> (16 - visual->green_prec)) << visual->green_shift) |
75
((r >> (16 - visual->blue_prec)) << visual->blue_shift);
80
@parent_instance: inherited portion from #GObject
82
<!-- ##### ENUM GdkVisualType ##### -->
84
A set of values that describe the manner in which the
85
pixel values for a visual are converted into RGB
89
@GDK_VISUAL_STATIC_GRAY: Each pixel value indexes a grayscale value directly.
90
@GDK_VISUAL_GRAYSCALE: Each pixel is an index into a color map that maps pixel
91
values into grayscale values. The color map can be changed by an application.
92
@GDK_VISUAL_STATIC_COLOR: Each pixel value is an index into a predefined,
93
unmodifiable color map that maps pixel values into RGB values.
94
@GDK_VISUAL_PSEUDO_COLOR: Each pixel is an index into a color map that maps
95
pixel values into rgb values. The color map can be changed by an application.
96
@GDK_VISUAL_TRUE_COLOR: Each pixel value directly contains red, green,
97
and blue components. The <structfield>red_mask</structfield>,
98
<structfield>green_mask</structfield>, and
99
<structfield>blue_mask</structfield> fields of the #GdkVisual
100
structure describe how the components are assembled into a pixel value.
101
@GDK_VISUAL_DIRECT_COLOR: Each pixel value contains red, green, and blue
102
components as for %GDK_VISUAL_TRUE_COLOR, but the components are mapped via a
103
color table into the final output table instead of being converted directly.
105
<!-- ##### ENUM GdkByteOrder ##### -->
107
A set of values describing the possible byte-orders
108
for storing pixel values in memory.
111
@GDK_LSB_FIRST: The values are stored with the least-significant byte
112
first. For instance, the 32-bit value 0xffeecc would be stored
113
in memory as 0xcc, 0xee, 0xff, 0x00.
114
@GDK_MSB_FIRST: The values are stored with the most-significant byte
115
first. For instance, the 32-bit value 0xffeecc would be stored
116
in memory as 0x00, 0xcc, 0xee, 0xff.
118
<!-- ##### FUNCTION gdk_query_depths ##### -->
127
<!-- ##### FUNCTION gdk_query_visual_types ##### -->
136
<!-- ##### FUNCTION gdk_list_visuals ##### -->
145
<!-- ##### FUNCTION gdk_visual_get_best_depth ##### -->
154
<!-- ##### FUNCTION gdk_visual_get_best_type ##### -->
163
<!-- ##### FUNCTION gdk_visual_get_system ##### -->
172
<!-- ##### FUNCTION gdk_visual_get_best ##### -->
181
<!-- ##### FUNCTION gdk_visual_get_best_with_depth ##### -->
190
<!-- ##### FUNCTION gdk_visual_get_best_with_type ##### -->
199
<!-- ##### FUNCTION gdk_visual_get_best_with_both ##### -->
209
<!-- ##### MACRO gdk_visual_ref ##### -->
211
Deprecated equivalent of g_object_ref().
215
@Returns: the same visual
218
<!-- ##### MACRO gdk_visual_unref ##### -->
220
Deprecated equivalent of g_object_unref().
226
<!-- ##### FUNCTION gdk_visual_get_screen ##### -->
235
<!-- ##### FUNCTION gdk_visual_get_bits_per_rgb ##### -->
244
<!-- ##### FUNCTION gdk_visual_get_blue_pixel_details ##### -->
255
<!-- ##### FUNCTION gdk_visual_get_byte_order ##### -->
264
<!-- ##### FUNCTION gdk_visual_get_colormap_size ##### -->
273
<!-- ##### FUNCTION gdk_visual_get_depth ##### -->
282
<!-- ##### FUNCTION gdk_visual_get_green_pixel_details ##### -->
293
<!-- ##### FUNCTION gdk_visual_get_red_pixel_details ##### -->
304
<!-- ##### FUNCTION gdk_visual_get_visual_type ##### -->