~ubuntu-branches/ubuntu/precise/gtk+2.0/precise-updates

« back to all changes in this revision

Viewing changes to docs/reference/gdk/tmpl/visuals.sgml

  • Committer: Package Import Robot
  • Author(s): Ken VanDine
  • Date: 2011-12-01 11:40:06 UTC
  • mfrom: (1.14.11)
  • Revision ID: package-import@ubuntu.com-20111201114006-nrmf6qu3pg512veo
Tags: 2.24.8-0ubuntu1
* New upstream release 
  - gtkfilechooser should be more robust to malformed URIs
    in .gtk-bookmarks (LP: #189494)
* debian/patches/010_make_bg_changes_queue_repaint.patch
  - dropped it introduces performance regressions in some gtk2 
    apps (LP: #889019)
* 101_filechooser.patch, 000git_file_chooser.patch: dropped, upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!-- ##### SECTION Title ##### -->
2
 
Visuals
3
 
 
4
 
<!-- ##### SECTION Short_Description ##### -->
5
 
 
6
 
Low-level display hardware information
7
 
 
8
 
<!-- ##### SECTION Long_Description ##### -->
9
 
<para>
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 
17
 
4 bits.
18
 
</para>
19
 
<para>
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.
26
 
</para>
27
 
<para>
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()).
35
 
</para>
36
 
<para>
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.
47
 
</para>
48
 
 
49
 
<!-- ##### SECTION See_Also ##### -->
50
 
<para>
51
 
#GdkImage, #GdkColormap, #GdkRGB
52
 
</para>
53
 
 
54
 
<!-- ##### SECTION Stability_Level ##### -->
55
 
 
56
 
 
57
 
<!-- ##### SECTION Image ##### -->
58
 
 
59
 
 
60
 
<!-- ##### STRUCT GdkVisual ##### -->
61
 
<para>
62
 
The <type>GdkVisual</type> structure contains information about
63
 
a particular visual.
64
 
</para>
65
 
 
66
 
<example id="rgbmask">
67
 
<title>Constructing a pixel value from components</title>
68
 
<programlisting>
69
 
guint
70
 
pixel_from_rgb (GdkVisual *visual,
71
 
                guchar r, guchar b, guchar g)
72
 
{
73
 
  return ((r &gt;&gt; (16 - visual-&gt;red_prec))   &lt;&lt; visual-&gt;red_shift) |
74
 
         ((g &gt;&gt; (16 - visual-&gt;green_prec)) &lt;&lt; visual-&gt;green_shift) |
75
 
         ((r &gt;&gt; (16 - visual-&gt;blue_prec))  &lt;&lt; visual-&gt;blue_shift);
76
 
}
77
 
</programlisting>
78
 
</example>
79
 
 
80
 
@parent_instance: inherited portion from #GObject
81
 
 
82
 
<!-- ##### ENUM GdkVisualType ##### -->
83
 
<para>
84
 
A set of values that describe the manner in which the
85
 
pixel values for a visual are converted into RGB
86
 
values for display.
87
 
</para>
88
 
 
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.
104
 
 
105
 
<!-- ##### ENUM GdkByteOrder ##### -->
106
 
<para>
107
 
A set of values describing the possible byte-orders
108
 
for storing pixel values in memory.
109
 
</para>
110
 
 
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.
117
 
 
118
 
<!-- ##### FUNCTION gdk_query_depths ##### -->
119
 
<para>
120
 
 
121
 
</para>
122
 
 
123
 
@depths: 
124
 
@count: 
125
 
 
126
 
 
127
 
<!-- ##### FUNCTION gdk_query_visual_types ##### -->
128
 
<para>
129
 
 
130
 
</para>
131
 
 
132
 
@visual_types: 
133
 
@count: 
134
 
 
135
 
 
136
 
<!-- ##### FUNCTION gdk_list_visuals ##### -->
137
 
<para>
138
 
 
139
 
</para>
140
 
 
141
 
@void: 
142
 
@Returns: 
143
 
 
144
 
 
145
 
<!-- ##### FUNCTION gdk_visual_get_best_depth ##### -->
146
 
<para>
147
 
 
148
 
</para>
149
 
 
150
 
@void: 
151
 
@Returns: 
152
 
 
153
 
 
154
 
<!-- ##### FUNCTION gdk_visual_get_best_type ##### -->
155
 
<para>
156
 
 
157
 
</para>
158
 
 
159
 
@void: 
160
 
@Returns: 
161
 
 
162
 
 
163
 
<!-- ##### FUNCTION gdk_visual_get_system ##### -->
164
 
<para>
165
 
 
166
 
</para>
167
 
 
168
 
@void: 
169
 
@Returns: 
170
 
 
171
 
 
172
 
<!-- ##### FUNCTION gdk_visual_get_best ##### -->
173
 
<para>
174
 
 
175
 
</para>
176
 
 
177
 
@void: 
178
 
@Returns: 
179
 
 
180
 
 
181
 
<!-- ##### FUNCTION gdk_visual_get_best_with_depth ##### -->
182
 
<para>
183
 
 
184
 
</para>
185
 
 
186
 
@depth: 
187
 
@Returns: 
188
 
 
189
 
 
190
 
<!-- ##### FUNCTION gdk_visual_get_best_with_type ##### -->
191
 
<para>
192
 
 
193
 
</para>
194
 
 
195
 
@visual_type: 
196
 
@Returns: 
197
 
 
198
 
 
199
 
<!-- ##### FUNCTION gdk_visual_get_best_with_both ##### -->
200
 
<para>
201
 
 
202
 
</para>
203
 
 
204
 
@depth: 
205
 
@visual_type: 
206
 
@Returns: 
207
 
 
208
 
 
209
 
<!-- ##### MACRO gdk_visual_ref ##### -->
210
 
<para>
211
 
Deprecated equivalent of g_object_ref().
212
 
</para>
213
 
 
214
 
@v: a #GdkVisual
215
 
@Returns: the same visual
216
 
 
217
 
 
218
 
<!-- ##### MACRO gdk_visual_unref ##### -->
219
 
<para>
220
 
Deprecated equivalent of g_object_unref().
221
 
</para>
222
 
 
223
 
@v: a #GdkVisual
224
 
 
225
 
 
226
 
<!-- ##### FUNCTION gdk_visual_get_screen ##### -->
227
 
<para>
228
 
 
229
 
</para>
230
 
 
231
 
@visual: 
232
 
@Returns: 
233
 
 
234
 
 
235
 
<!-- ##### FUNCTION gdk_visual_get_bits_per_rgb ##### -->
236
 
<para>
237
 
 
238
 
</para>
239
 
 
240
 
@visual: 
241
 
@Returns: 
242
 
 
243
 
 
244
 
<!-- ##### FUNCTION gdk_visual_get_blue_pixel_details ##### -->
245
 
<para>
246
 
 
247
 
</para>
248
 
 
249
 
@visual: 
250
 
@mask: 
251
 
@shift: 
252
 
@precision: 
253
 
 
254
 
 
255
 
<!-- ##### FUNCTION gdk_visual_get_byte_order ##### -->
256
 
<para>
257
 
 
258
 
</para>
259
 
 
260
 
@visual: 
261
 
@Returns: 
262
 
 
263
 
 
264
 
<!-- ##### FUNCTION gdk_visual_get_colormap_size ##### -->
265
 
<para>
266
 
 
267
 
</para>
268
 
 
269
 
@visual: 
270
 
@Returns: 
271
 
 
272
 
 
273
 
<!-- ##### FUNCTION gdk_visual_get_depth ##### -->
274
 
<para>
275
 
 
276
 
</para>
277
 
 
278
 
@visual: 
279
 
@Returns: 
280
 
 
281
 
 
282
 
<!-- ##### FUNCTION gdk_visual_get_green_pixel_details ##### -->
283
 
<para>
284
 
 
285
 
</para>
286
 
 
287
 
@visual: 
288
 
@mask: 
289
 
@shift: 
290
 
@precision: 
291
 
 
292
 
 
293
 
<!-- ##### FUNCTION gdk_visual_get_red_pixel_details ##### -->
294
 
<para>
295
 
 
296
 
</para>
297
 
 
298
 
@visual: 
299
 
@mask: 
300
 
@shift: 
301
 
@precision: 
302
 
 
303
 
 
304
 
<!-- ##### FUNCTION gdk_visual_get_visual_type ##### -->
305
 
<para>
306
 
 
307
 
</para>
308
 
 
309
 
@visual: 
310
 
@Returns: 
311
 
 
312