1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>XLib Surfaces</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library">
<link rel="up" href="Surfaces.html" title="Surfaces">
<link rel="prev" href="cairo-SVG-Surfaces.html" title="SVG Surfaces">
<link rel="next" href="Support.html" title="Utilities">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="pt01.html" title="Part I. Tutorial">
<link rel="part" href="pt02.html" title="Part II. Reference">
<link rel="chapter" href="Drawing.html" title="Drawing">
<link rel="chapter" href="Fonts.html" title="Fonts">
<link rel="chapter" href="Surfaces.html" title="Surfaces">
<link rel="chapter" href="Support.html" title="Utilities">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of new symbols in 1.2">
<link rel="appendix" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="cairo-SVG-Surfaces.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="Surfaces.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
<td><a accesskey="n" href="Support.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2562702" class="shortcut">Top</a>
 | 
<a href="#id2603539" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-XLib-Surfaces"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2562702"></a><span class="refentrytitle">XLib Surfaces</span>
</h2>
<p>XLib Surfaces — X Window System rendering using XLib</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-create">cairo_xlib_surface_create</a> (Display *dpy,
Drawable drawable,
Visual *visual,
int width,
int height);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-create-for-bitmap">cairo_xlib_surface_create_for_bitmap</a>
(Display *dpy,
Pixmap bitmap,
Screen *screen,
int width,
int height);
void <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-set-size">cairo_xlib_surface_set_size</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
int width,
int height);
Display* <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-display">cairo_xlib_surface_get_display</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
Screen* <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-screen">cairo_xlib_surface_get_screen</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
void <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-set-drawable">cairo_xlib_surface_set_drawable</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
Drawable drawable,
int width,
int height);
Drawable <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-drawable">cairo_xlib_surface_get_drawable</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
Visual* <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-visual">cairo_xlib_surface_get_visual</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
int <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-width">cairo_xlib_surface_get_width</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
int <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-height">cairo_xlib_surface_get_height</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
int <a href="cairo-XLib-Surfaces.html#cairo-xlib-surface-get-depth">cairo_xlib_surface_get_depth</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2603539"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2603555"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2603566"></a><h3>
<a name="cairo-xlib-surface-create"></a>cairo_xlib_surface_create ()</h3>
<a class="indexterm" name="id2603577"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create (Display *dpy,
Drawable drawable,
Visual *visual,
int width,
int height);</pre>
<p>
Creates an Xlib surface that draws to the given drawable.
The way that colors are represented in the drawable is specified
by the provided visual.
</p>
<p>
NOTE: If <em class="parameter"><code>drawable</code></em> is a Window, then the function
cairo_xlib_surface_set_size must be called whenever the size of the
window changes.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dpy</code></em> :</span></td>
<td> an X Display
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td> an X Drawable, (a Pixmap or a Window)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>visual</code></em> :</span></td>
<td> the visual to use for drawing to <em class="parameter"><code>drawable</code></em>. The depth
of the visual must match the depth of the drawable.
Currently, only TrueColor visuals are fully supported.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> the current width of <em class="parameter"><code>drawable</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> the current height of <em class="parameter"><code>drawable</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created surface
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2608273"></a><h3>
<a name="cairo-xlib-surface-create-for-bitmap"></a>cairo_xlib_surface_create_for_bitmap ()</h3>
<a class="indexterm" name="id2608286"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create_for_bitmap
(Display *dpy,
Pixmap bitmap,
Screen *screen,
int width,
int height);</pre>
<p>
Creates an Xlib surface that draws to the given bitmap.
This will be drawn to as a CAIRO_FORMAT_A1 object.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dpy</code></em> :</span></td>
<td> an X Display
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>bitmap</code></em> :</span></td>
<td> an X Drawable, (a depth-1 Pixmap)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>screen</code></em> :</span></td>
<td> the X Screen associated with <em class="parameter"><code>bitmap</code></em>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> the current width of <em class="parameter"><code>bitmap</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> the current height of <em class="parameter"><code>bitmap</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created surface
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2604020"></a><h3>
<a name="cairo-xlib-surface-set-size"></a>cairo_xlib_surface_set_size ()</h3>
<a class="indexterm" name="id2604031"></a><pre class="programlisting">void cairo_xlib_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
int width,
int height);</pre>
<p>
Informs cairo of the new size of the X Drawable underlying the
surface. For a surface created for a Window (rather than a Pixmap),
this function must be called each time the size of the window
changes. (For a subwindow, you are normally resizing the window
yourself, but for a toplevel window, it is necessary to listen for
ConfigureNotify events.)
</p>
<p>
A Pixmap can never change size, so it is never necessary to call
this function on a surface created for a Pixmap.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> for the XLib backend
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> the new width of the surface
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> the new height of the surface
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2604141"></a><h3>
<a name="cairo-xlib-surface-get-display"></a>cairo_xlib_surface_get_display ()</h3>
<a class="indexterm" name="id2604156"></a><pre class="programlisting">Display* cairo_xlib_surface_get_display (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the X Display for the underlying X Drawable.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the display.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2608597"></a><h3>
<a name="cairo-xlib-surface-get-screen"></a>cairo_xlib_surface_get_screen ()</h3>
<a class="indexterm" name="id2608611"></a><pre class="programlisting">Screen* cairo_xlib_surface_get_screen (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the X Screen for the underlying X Drawable.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the screen.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2608676"></a><h3>
<a name="cairo-xlib-surface-set-drawable"></a>cairo_xlib_surface_set_drawable ()</h3>
<a class="indexterm" name="id2608689"></a><pre class="programlisting">void cairo_xlib_surface_set_drawable (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
Drawable drawable,
int width,
int height);</pre>
<p>
Informs cairo of a new X Drawable underlying the
surface. The drawable must match the display, screen
and format of the existing drawable or the application
will get X protocol errors and will probably terminate.
No checks are done by this function to ensure this
compatibility.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> for the XLib backend
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td> the new drawable for the surface
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> the width of the new drawable
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> the height of the new drawable
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2608815"></a><h3>
<a name="cairo-xlib-surface-get-drawable"></a>cairo_xlib_surface_get_drawable ()</h3>
<a class="indexterm" name="id2608830"></a><pre class="programlisting">Drawable cairo_xlib_surface_get_drawable (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the underlying X Drawable used for the surface.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the drawable.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2608903"></a><h3>
<a name="cairo-xlib-surface-get-visual"></a>cairo_xlib_surface_get_visual ()</h3>
<a class="indexterm" name="id2608918"></a><pre class="programlisting">Visual* cairo_xlib_surface_get_visual (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the X Visual used for underlying X Drawable.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the visual.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2608991"></a><h3>
<a name="cairo-xlib-surface-get-width"></a>cairo_xlib_surface_get_width ()</h3>
<a class="indexterm" name="id2609007"></a><pre class="programlisting">int cairo_xlib_surface_get_width (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the width of the X Drawable underlying the surface in pixels.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the width of the surface in pixels.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2609079"></a><h3>
<a name="cairo-xlib-surface-get-height"></a>cairo_xlib_surface_get_height ()</h3>
<a class="indexterm" name="id2609094"></a><pre class="programlisting">int cairo_xlib_surface_get_height (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the height of the X Drawable underlying the surface in pixels.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the height of the surface in pixels.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2609168"></a><h3>
<a name="cairo-xlib-surface-get-depth"></a>cairo_xlib_surface_get_depth ()</h3>
<a class="indexterm" name="id2609183"></a><pre class="programlisting">int cairo_xlib_surface_get_depth (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Get the number of bits used to represent each pixel value.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> a <span class="type">cairo_xlib_surface_t</span>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the depth of the surface in bits.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
</div>
</div>
</body>
</html>
|