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