comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 68:5028fdace37b
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Image Surfaces: Cairo: A Vector Graphics Library</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
8 <link rel="up" href="cairo-surfaces.html" title="Surfaces">
9 <link rel="prev" href="cairo-cairo-surface-t.html" title="cairo_surface_t">
10 <link rel="next" href="cairo-PDF-Surfaces.html" title="PDF Surfaces">
11 <meta name="generator" content="GTK-Doc V1.27 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18 <a href="#cairo-Image-Surfaces.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="cairo-surfaces.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="cairo-cairo-surface-t.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="cairo-PDF-Surfaces.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="cairo-Image-Surfaces"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="cairo-Image-Surfaces.top_of_page"></a>Image Surfaces</span></h2>
30 <p>Image Surfaces — Rendering to memory buffers</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="cairo-Image-Surfaces.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
37 <colgroup>
38 <col width="150px" class="functions_return">
39 <col class="functions_name">
40 </colgroup>
41 <tbody>
42 <tr>
43 <td class="function_type">
44 <span class="returnvalue">int</span>
45 </td>
46 <td class="function_name">
47 <a class="link" href="cairo-Image-Surfaces.html#cairo-format-stride-for-width" title="cairo_format_stride_for_width ()">cairo_format_stride_for_width</a> <span class="c_punctuation">()</span>
48 </td>
49 </tr>
50 <tr>
51 <td class="function_type">
52 <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="returnvalue">cairo_surface_t</span></a> *
53 </td>
54 <td class="function_name">
55 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-create" title="cairo_image_surface_create ()">cairo_image_surface_create</a> <span class="c_punctuation">()</span>
56 </td>
57 </tr>
58 <tr>
59 <td class="function_type">
60 <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="returnvalue">cairo_surface_t</span></a> *
61 </td>
62 <td class="function_name">
63 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-create-for-data" title="cairo_image_surface_create_for_data ()">cairo_image_surface_create_for_data</a> <span class="c_punctuation">()</span>
64 </td>
65 </tr>
66 <tr>
67 <td class="function_type">unsigned <span class="returnvalue">char</span> *
68 </td>
69 <td class="function_name">
70 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-get-data" title="cairo_image_surface_get_data ()">cairo_image_surface_get_data</a> <span class="c_punctuation">()</span>
71 </td>
72 </tr>
73 <tr>
74 <td class="function_type">
75 <a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="returnvalue">cairo_format_t</span></a>
76 </td>
77 <td class="function_name">
78 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-get-format" title="cairo_image_surface_get_format ()">cairo_image_surface_get_format</a> <span class="c_punctuation">()</span>
79 </td>
80 </tr>
81 <tr>
82 <td class="function_type">
83 <span class="returnvalue">int</span>
84 </td>
85 <td class="function_name">
86 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-get-width" title="cairo_image_surface_get_width ()">cairo_image_surface_get_width</a> <span class="c_punctuation">()</span>
87 </td>
88 </tr>
89 <tr>
90 <td class="function_type">
91 <span class="returnvalue">int</span>
92 </td>
93 <td class="function_name">
94 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-get-height" title="cairo_image_surface_get_height ()">cairo_image_surface_get_height</a> <span class="c_punctuation">()</span>
95 </td>
96 </tr>
97 <tr>
98 <td class="function_type">
99 <span class="returnvalue">int</span>
100 </td>
101 <td class="function_name">
102 <a class="link" href="cairo-Image-Surfaces.html#cairo-image-surface-get-stride" title="cairo_image_surface_get_stride ()">cairo_image_surface_get_stride</a> <span class="c_punctuation">()</span>
103 </td>
104 </tr>
105 </tbody>
106 </table></div>
107 </div>
108 <div class="refsect1">
109 <a name="cairo-Image-Surfaces.other"></a><h2>Types and Values</h2>
110 <div class="informaltable"><table class="informaltable" width="100%" border="0">
111 <colgroup>
112 <col width="150px" class="name">
113 <col class="description">
114 </colgroup>
115 <tbody>
116 <tr>
117 <td class="define_keyword">#define</td>
118 <td class="function_name"><a class="link" href="cairo-Image-Surfaces.html#CAIRO-HAS-IMAGE-SURFACE:CAPS" title="CAIRO_HAS_IMAGE_SURFACE">CAIRO_HAS_IMAGE_SURFACE</a></td>
119 </tr>
120 <tr>
121 <td class="datatype_keyword">enum</td>
122 <td class="function_name"><a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t">cairo_format_t</a></td>
123 </tr>
124 </tbody>
125 </table></div>
126 </div>
127 <div class="refsect1">
128 <a name="cairo-Image-Surfaces.description"></a><h2>Description</h2>
129 <p>Image surfaces provide the ability to render to memory buffers
130 either allocated by cairo or by the calling code. The supported
131 image formats are those defined in <a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a>.</p>
132 </div>
133 <div class="refsect1">
134 <a name="cairo-Image-Surfaces.functions_details"></a><h2>Functions</h2>
135 <div class="refsect2">
136 <a name="cairo-format-stride-for-width"></a><h3>cairo_format_stride_for_width ()</h3>
137 <pre class="programlisting"><span class="returnvalue">int</span>
138 cairo_format_stride_for_width (<em class="parameter"><code><a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a> format</code></em>,
139 <em class="parameter"><code><span class="type">int</span> width</code></em>);</pre>
140 <p>This function provides a stride value that will respect all
141 alignment requirements of the accelerated image-rendering code
142 within cairo. Typical usage will be of the form:</p>
143 <div class="informalexample">
144 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
145 <tbody>
146 <tr>
147 <td class="listing_lines" align="right"><pre>1
148 2
149 3
150 4
151 5
152 6
153 7
154 8
155 9</pre></td>
156 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">int</span> stride<span class="gtkdoc opt">;</span>
157 <span class="gtkdoc kwb">unsigned char</span> <span class="gtkdoc opt">*</span>data<span class="gtkdoc opt">;</span>
158 cairo_surface_t <span class="gtkdoc opt">*</span>surface<span class="gtkdoc opt">;</span>
159
160 stride <span class="gtkdoc opt">=</span> <span class="function"><a href="cairo-Image-Surfaces.html#cairo-format-stride-for-width">cairo_format_stride_for_width</a></span> <span class="gtkdoc opt">(</span>format<span class="gtkdoc opt">,</span> width<span class="gtkdoc opt">);</span>
161 data <span class="gtkdoc opt">=</span> <span class="function">malloc</span> <span class="gtkdoc opt">(</span>stride <span class="gtkdoc opt">*</span> height<span class="gtkdoc opt">);</span>
162 surface <span class="gtkdoc opt">=</span> <span class="function"><a href="cairo-Image-Surfaces.html#cairo-image-surface-create-for-data">cairo_image_surface_create_for_data</a></span> <span class="gtkdoc opt">(</span>data<span class="gtkdoc opt">,</span> format<span class="gtkdoc opt">,</span>
163 width<span class="gtkdoc opt">,</span> height<span class="gtkdoc opt">,</span>
164 stride<span class="gtkdoc opt">);</span></pre></td>
165 </tr>
166 </tbody>
167 </table>
168 </div>
169
170 <div class="refsect3">
171 <a name="cairo-format-stride-for-width.parameters"></a><h4>Parameters</h4>
172 <div class="informaltable"><table class="informaltable" width="100%" border="0">
173 <colgroup>
174 <col width="150px" class="parameters_name">
175 <col class="parameters_description">
176 <col width="200px" class="parameters_annotations">
177 </colgroup>
178 <tbody>
179 <tr>
180 <td class="parameter_name"><p>format</p></td>
181 <td class="parameter_description"><p>A <a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a> value</p></td>
182 <td class="parameter_annotations"> </td>
183 </tr>
184 <tr>
185 <td class="parameter_name"><p>width</p></td>
186 <td class="parameter_description"><p>The desired width of an image surface to be created.</p></td>
187 <td class="parameter_annotations"> </td>
188 </tr>
189 </tbody>
190 </table></div>
191 </div>
192 <div class="refsect3">
193 <a name="cairo-format-stride-for-width.returns"></a><h4>Returns</h4>
194 <p> the appropriate stride to use given the desired
195 format and width, or -1 if either the format is invalid or the width
196 too large.</p>
197 </div>
198 <p class="since">Since: 1.6</p>
199 </div>
200 <hr>
201 <div class="refsect2">
202 <a name="cairo-image-surface-create"></a><h3>cairo_image_surface_create ()</h3>
203 <pre class="programlisting"><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="returnvalue">cairo_surface_t</span></a> *
204 cairo_image_surface_create (<em class="parameter"><code><a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a> format</code></em>,
205 <em class="parameter"><code><span class="type">int</span> width</code></em>,
206 <em class="parameter"><code><span class="type">int</span> height</code></em>);</pre>
207 <p>Creates an image surface of the specified format and
208 dimensions. Initially the surface contents are set to 0.
209 (Specifically, within each pixel, each color or alpha channel
210 belonging to format will be 0. The contents of bits within a pixel,
211 but not belonging to the given format are undefined).</p>
212 <div class="refsect3">
213 <a name="cairo-image-surface-create.parameters"></a><h4>Parameters</h4>
214 <div class="informaltable"><table class="informaltable" width="100%" border="0">
215 <colgroup>
216 <col width="150px" class="parameters_name">
217 <col class="parameters_description">
218 <col width="200px" class="parameters_annotations">
219 </colgroup>
220 <tbody>
221 <tr>
222 <td class="parameter_name"><p>format</p></td>
223 <td class="parameter_description"><p>format of pixels in the surface to create</p></td>
224 <td class="parameter_annotations"> </td>
225 </tr>
226 <tr>
227 <td class="parameter_name"><p>width</p></td>
228 <td class="parameter_description"><p>width of the surface, in pixels</p></td>
229 <td class="parameter_annotations"> </td>
230 </tr>
231 <tr>
232 <td class="parameter_name"><p>height</p></td>
233 <td class="parameter_description"><p>height of the surface, in pixels</p></td>
234 <td class="parameter_annotations"> </td>
235 </tr>
236 </tbody>
237 </table></div>
238 </div>
239 <div class="refsect3">
240 <a name="cairo-image-surface-create.returns"></a><h4>Returns</h4>
241 <p> a pointer to the newly created surface. The caller
242 owns the surface and should call <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a> when done
243 with it.</p>
244 <p>This function always returns a valid pointer, but it will return a
245 pointer to a "nil" surface if an error such as out of memory
246 occurs. You can use <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-status" title="cairo_surface_status ()"><code class="function">cairo_surface_status()</code></a> to check for this.</p>
247 </div>
248 <p class="since">Since: 1.0</p>
249 </div>
250 <hr>
251 <div class="refsect2">
252 <a name="cairo-image-surface-create-for-data"></a><h3>cairo_image_surface_create_for_data ()</h3>
253 <pre class="programlisting"><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="returnvalue">cairo_surface_t</span></a> *
254 cairo_image_surface_create_for_data (<em class="parameter"><code>unsigned <span class="type">char</span> *data</code></em>,
255 <em class="parameter"><code><a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a> format</code></em>,
256 <em class="parameter"><code><span class="type">int</span> width</code></em>,
257 <em class="parameter"><code><span class="type">int</span> height</code></em>,
258 <em class="parameter"><code><span class="type">int</span> stride</code></em>);</pre>
259 <p>Creates an image surface for the provided pixel data. The output
260 buffer must be kept around until the <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> is destroyed
261 or <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-finish" title="cairo_surface_finish ()"><code class="function">cairo_surface_finish()</code></a> is called on the surface. The initial
262 contents of <em class="parameter"><code>data</code></em>
263 will be used as the initial image contents; you
264 must explicitly clear the buffer, using, for example,
265 <a class="link" href="cairo-Paths.html#cairo-rectangle" title="cairo_rectangle ()"><code class="function">cairo_rectangle()</code></a> and <a class="link" href="cairo-cairo-t.html#cairo-fill" title="cairo_fill ()"><code class="function">cairo_fill()</code></a> if you want it cleared.</p>
266 <p>Note that the stride may be larger than
267 width*bytes_per_pixel to provide proper alignment for each pixel
268 and row. This alignment is required to allow high-performance rendering
269 within cairo. The correct way to obtain a legal stride value is to
270 call <a class="link" href="cairo-Image-Surfaces.html#cairo-format-stride-for-width" title="cairo_format_stride_for_width ()"><code class="function">cairo_format_stride_for_width()</code></a> with the desired format and
271 maximum image width value, and then use the resulting stride value
272 to allocate the data and to create the image surface. See
273 <a class="link" href="cairo-Image-Surfaces.html#cairo-format-stride-for-width" title="cairo_format_stride_for_width ()"><code class="function">cairo_format_stride_for_width()</code></a> for example code.</p>
274 <div class="refsect3">
275 <a name="cairo-image-surface-create-for-data.parameters"></a><h4>Parameters</h4>
276 <div class="informaltable"><table class="informaltable" width="100%" border="0">
277 <colgroup>
278 <col width="150px" class="parameters_name">
279 <col class="parameters_description">
280 <col width="200px" class="parameters_annotations">
281 </colgroup>
282 <tbody>
283 <tr>
284 <td class="parameter_name"><p>data</p></td>
285 <td class="parameter_description"><p>a pointer to a buffer supplied by the application in which
286 to write contents. This pointer must be suitably aligned for any
287 kind of variable, (for example, a pointer returned by malloc).</p></td>
288 <td class="parameter_annotations"> </td>
289 </tr>
290 <tr>
291 <td class="parameter_name"><p>format</p></td>
292 <td class="parameter_description"><p>the format of pixels in the buffer</p></td>
293 <td class="parameter_annotations"> </td>
294 </tr>
295 <tr>
296 <td class="parameter_name"><p>width</p></td>
297 <td class="parameter_description"><p>the width of the image to be stored in the buffer</p></td>
298 <td class="parameter_annotations"> </td>
299 </tr>
300 <tr>
301 <td class="parameter_name"><p>height</p></td>
302 <td class="parameter_description"><p>the height of the image to be stored in the buffer</p></td>
303 <td class="parameter_annotations"> </td>
304 </tr>
305 <tr>
306 <td class="parameter_name"><p>stride</p></td>
307 <td class="parameter_description"><p>the number of bytes between the start of rows in the
308 buffer as allocated. This value should always be computed by
309 <a class="link" href="cairo-Image-Surfaces.html#cairo-format-stride-for-width" title="cairo_format_stride_for_width ()"><code class="function">cairo_format_stride_for_width()</code></a> before allocating the data
310 buffer.</p></td>
311 <td class="parameter_annotations"> </td>
312 </tr>
313 </tbody>
314 </table></div>
315 </div>
316 <div class="refsect3">
317 <a name="cairo-image-surface-create-for-data.returns"></a><h4>Returns</h4>
318 <p> a pointer to the newly created surface. The caller
319 owns the surface and should call <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a> when done
320 with it.</p>
321 <p>This function always returns a valid pointer, but it will return a
322 pointer to a "nil" surface in the case of an error such as out of
323 memory or an invalid stride value. In case of invalid stride value
324 the error status of the returned surface will be
325 <a class="link" href="cairo-Error-handling.html#CAIRO-STATUS-INVALID-STRIDE:CAPS"><code class="literal">CAIRO_STATUS_INVALID_STRIDE</code></a>. You can use
326 <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-status" title="cairo_surface_status ()"><code class="function">cairo_surface_status()</code></a> to check for this.</p>
327 <p>See <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-set-user-data" title="cairo_surface_set_user_data ()"><code class="function">cairo_surface_set_user_data()</code></a> for a means of attaching a
328 destroy-notification fallback to the surface if necessary.</p>
329 </div>
330 <p class="since">Since: 1.0</p>
331 </div>
332 <hr>
333 <div class="refsect2">
334 <a name="cairo-image-surface-get-data"></a><h3>cairo_image_surface_get_data ()</h3>
335 <pre class="programlisting">unsigned <span class="returnvalue">char</span> *
336 cairo_image_surface_get_data (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>);</pre>
337 <p>Get a pointer to the data of the image surface, for direct
338 inspection or modification.</p>
339 <p>A call to <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-flush" title="cairo_surface_flush ()"><code class="function">cairo_surface_flush()</code></a> is required before accessing the
340 pixel data to ensure that all pending drawing operations are
341 finished. A call to <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-mark-dirty" title="cairo_surface_mark_dirty ()"><code class="function">cairo_surface_mark_dirty()</code></a> is required after
342 the data is modified.</p>
343 <div class="refsect3">
344 <a name="cairo-image-surface-get-data.parameters"></a><h4>Parameters</h4>
345 <div class="informaltable"><table class="informaltable" width="100%" border="0">
346 <colgroup>
347 <col width="150px" class="parameters_name">
348 <col class="parameters_description">
349 <col width="200px" class="parameters_annotations">
350 </colgroup>
351 <tbody><tr>
352 <td class="parameter_name"><p>surface</p></td>
353 <td class="parameter_description"><p>a <span class="type">cairo_image_surface_t</span></p></td>
354 <td class="parameter_annotations"> </td>
355 </tr></tbody>
356 </table></div>
357 </div>
358 <div class="refsect3">
359 <a name="cairo-image-surface-get-data.returns"></a><h4>Returns</h4>
360 <p> a pointer to the image data of this surface or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
361 if <em class="parameter"><code>surface</code></em>
362 is not an image surface, or if <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-finish" title="cairo_surface_finish ()"><code class="function">cairo_surface_finish()</code></a>
363 has been called.</p>
364 </div>
365 <p class="since">Since: 1.2</p>
366 </div>
367 <hr>
368 <div class="refsect2">
369 <a name="cairo-image-surface-get-format"></a><h3>cairo_image_surface_get_format ()</h3>
370 <pre class="programlisting"><a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="returnvalue">cairo_format_t</span></a>
371 cairo_image_surface_get_format (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>);</pre>
372 <p>Get the format of the surface.</p>
373 <div class="refsect3">
374 <a name="cairo-image-surface-get-format.parameters"></a><h4>Parameters</h4>
375 <div class="informaltable"><table class="informaltable" width="100%" border="0">
376 <colgroup>
377 <col width="150px" class="parameters_name">
378 <col class="parameters_description">
379 <col width="200px" class="parameters_annotations">
380 </colgroup>
381 <tbody><tr>
382 <td class="parameter_name"><p>surface</p></td>
383 <td class="parameter_description"><p>a <span class="type">cairo_image_surface_t</span></p></td>
384 <td class="parameter_annotations"> </td>
385 </tr></tbody>
386 </table></div>
387 </div>
388 <div class="refsect3">
389 <a name="cairo-image-surface-get-format.returns"></a><h4>Returns</h4>
390 <p> the format of the surface</p>
391 </div>
392 <p class="since">Since: 1.2</p>
393 </div>
394 <hr>
395 <div class="refsect2">
396 <a name="cairo-image-surface-get-width"></a><h3>cairo_image_surface_get_width ()</h3>
397 <pre class="programlisting"><span class="returnvalue">int</span>
398 cairo_image_surface_get_width (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>);</pre>
399 <p>Get the width of the image surface in pixels.</p>
400 <div class="refsect3">
401 <a name="cairo-image-surface-get-width.parameters"></a><h4>Parameters</h4>
402 <div class="informaltable"><table class="informaltable" width="100%" border="0">
403 <colgroup>
404 <col width="150px" class="parameters_name">
405 <col class="parameters_description">
406 <col width="200px" class="parameters_annotations">
407 </colgroup>
408 <tbody><tr>
409 <td class="parameter_name"><p>surface</p></td>
410 <td class="parameter_description"><p>a <span class="type">cairo_image_surface_t</span></p></td>
411 <td class="parameter_annotations"> </td>
412 </tr></tbody>
413 </table></div>
414 </div>
415 <div class="refsect3">
416 <a name="cairo-image-surface-get-width.returns"></a><h4>Returns</h4>
417 <p> the width of the surface in pixels.</p>
418 </div>
419 <p class="since">Since: 1.0</p>
420 </div>
421 <hr>
422 <div class="refsect2">
423 <a name="cairo-image-surface-get-height"></a><h3>cairo_image_surface_get_height ()</h3>
424 <pre class="programlisting"><span class="returnvalue">int</span>
425 cairo_image_surface_get_height (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>);</pre>
426 <p>Get the height of the image surface in pixels.</p>
427 <div class="refsect3">
428 <a name="cairo-image-surface-get-height.parameters"></a><h4>Parameters</h4>
429 <div class="informaltable"><table class="informaltable" width="100%" border="0">
430 <colgroup>
431 <col width="150px" class="parameters_name">
432 <col class="parameters_description">
433 <col width="200px" class="parameters_annotations">
434 </colgroup>
435 <tbody><tr>
436 <td class="parameter_name"><p>surface</p></td>
437 <td class="parameter_description"><p>a <span class="type">cairo_image_surface_t</span></p></td>
438 <td class="parameter_annotations"> </td>
439 </tr></tbody>
440 </table></div>
441 </div>
442 <div class="refsect3">
443 <a name="cairo-image-surface-get-height.returns"></a><h4>Returns</h4>
444 <p> the height of the surface in pixels.</p>
445 </div>
446 <p class="since">Since: 1.0</p>
447 </div>
448 <hr>
449 <div class="refsect2">
450 <a name="cairo-image-surface-get-stride"></a><h3>cairo_image_surface_get_stride ()</h3>
451 <pre class="programlisting"><span class="returnvalue">int</span>
452 cairo_image_surface_get_stride (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>);</pre>
453 <p>Get the stride of the image surface in bytes</p>
454 <div class="refsect3">
455 <a name="cairo-image-surface-get-stride.parameters"></a><h4>Parameters</h4>
456 <div class="informaltable"><table class="informaltable" width="100%" border="0">
457 <colgroup>
458 <col width="150px" class="parameters_name">
459 <col class="parameters_description">
460 <col width="200px" class="parameters_annotations">
461 </colgroup>
462 <tbody><tr>
463 <td class="parameter_name"><p>surface</p></td>
464 <td class="parameter_description"><p>a <span class="type">cairo_image_surface_t</span></p></td>
465 <td class="parameter_annotations"> </td>
466 </tr></tbody>
467 </table></div>
468 </div>
469 <div class="refsect3">
470 <a name="cairo-image-surface-get-stride.returns"></a><h4>Returns</h4>
471 <p> the stride of the image surface in bytes (or 0 if
472 <em class="parameter"><code>surface</code></em>
473 is not an image surface). The stride is the distance in
474 bytes from the beginning of one row of the image data to the
475 beginning of the next row.</p>
476 </div>
477 <p class="since">Since: 1.2</p>
478 </div>
479 </div>
480 <div class="refsect1">
481 <a name="cairo-Image-Surfaces.other_details"></a><h2>Types and Values</h2>
482 <div class="refsect2">
483 <a name="CAIRO-HAS-IMAGE-SURFACE:CAPS"></a><h3>CAIRO_HAS_IMAGE_SURFACE</h3>
484 <pre class="programlisting">#define CAIRO_HAS_IMAGE_SURFACE 1
485 </pre>
486 <p>Defined if the image surface backend is available.
487 The image surface backend is always built in.
488 This macro was added for completeness in cairo 1.8.</p>
489 <p class="since">Since: 1.8</p>
490 </div>
491 <hr>
492 <div class="refsect2">
493 <a name="cairo-format-t"></a><h3>enum cairo_format_t</h3>
494 <p><a class="link" href="cairo-Image-Surfaces.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a> is used to identify the memory format of
495 image data.</p>
496 <p>New entries may be added in future versions.</p>
497 <div class="refsect3">
498 <a name="cairo-format-t.members"></a><h4>Members</h4>
499 <div class="informaltable"><table class="informaltable" width="100%" border="0">
500 <colgroup>
501 <col width="300px" class="enum_members_name">
502 <col class="enum_members_description">
503 <col width="200px" class="enum_members_annotations">
504 </colgroup>
505 <tbody>
506 <tr>
507 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-INVALID:CAPS"></a>CAIRO_FORMAT_INVALID</p></td>
508 <td class="enum_member_description">
509 <p>no such format exists or is supported.</p>
510 </td>
511 <td class="enum_member_annotations"> </td>
512 </tr>
513 <tr>
514 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-ARGB32:CAPS"></a>CAIRO_FORMAT_ARGB32</p></td>
515 <td class="enum_member_description">
516 <p>each pixel is a 32-bit quantity, with
517 alpha in the upper 8 bits, then red, then green, then blue.
518 The 32-bit quantities are stored native-endian. Pre-multiplied
519 alpha is used. (That is, 50% transparent red is 0x80800000,
520 not 0x80ff0000.) (Since 1.0)</p>
521 </td>
522 <td class="enum_member_annotations"> </td>
523 </tr>
524 <tr>
525 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-RGB24:CAPS"></a>CAIRO_FORMAT_RGB24</p></td>
526 <td class="enum_member_description">
527 <p>each pixel is a 32-bit quantity, with
528 the upper 8 bits unused. Red, Green, and Blue are stored
529 in the remaining 24 bits in that order. (Since 1.0)</p>
530 </td>
531 <td class="enum_member_annotations"> </td>
532 </tr>
533 <tr>
534 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-A8:CAPS"></a>CAIRO_FORMAT_A8</p></td>
535 <td class="enum_member_description">
536 <p>each pixel is a 8-bit quantity holding
537 an alpha value. (Since 1.0)</p>
538 </td>
539 <td class="enum_member_annotations"> </td>
540 </tr>
541 <tr>
542 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-A1:CAPS"></a>CAIRO_FORMAT_A1</p></td>
543 <td class="enum_member_description">
544 <p>each pixel is a 1-bit quantity holding
545 an alpha value. Pixels are packed together into 32-bit
546 quantities. The ordering of the bits matches the
547 endianness of the platform. On a big-endian machine, the
548 first pixel is in the uppermost bit, on a little-endian
549 machine the first pixel is in the least-significant bit. (Since 1.0)</p>
550 </td>
551 <td class="enum_member_annotations"> </td>
552 </tr>
553 <tr>
554 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-RGB16-565:CAPS"></a>CAIRO_FORMAT_RGB16_565</p></td>
555 <td class="enum_member_description">
556 <p>each pixel is a 16-bit quantity
557 with red in the upper 5 bits, then green in the middle
558 6 bits, and blue in the lower 5 bits. (Since 1.2)</p>
559 </td>
560 <td class="enum_member_annotations"> </td>
561 </tr>
562 <tr>
563 <td class="enum_member_name"><p><a name="CAIRO-FORMAT-RGB30:CAPS"></a>CAIRO_FORMAT_RGB30</p></td>
564 <td class="enum_member_description">
565 <p>like RGB24 but with 10bpc. (Since 1.12)</p>
566 </td>
567 <td class="enum_member_annotations"> </td>
568 </tr>
569 </tbody>
570 </table></div>
571 </div>
572 <p class="since">Since: 1.0</p>
573 </div>
574 </div>
575 <div class="refsect1">
576 <a name="cairo-Image-Surfaces.see-also"></a><h2>See Also</h2>
577 <p><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a></p>
578 </div>
579 </div>
580 <div class="footer">
581 <hr>Generated by GTK-Doc V1.27</div>
582 </body>
583 </html>