summaryrefslogtreecommitdiff
path: root/doc/public/html/cairo-cairo-surface-t.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/public/html/cairo-cairo-surface-t.html')
-rw-r--r--doc/public/html/cairo-cairo-surface-t.html64
1 files changed, 19 insertions, 45 deletions
diff --git a/doc/public/html/cairo-cairo-surface-t.html b/doc/public/html/cairo-cairo-surface-t.html
index 4231110..9501f75 100644
--- a/doc/public/html/cairo-cairo-surface-t.html
+++ b/doc/public/html/cairo-cairo-surface-t.html
@@ -124,54 +124,28 @@ functions. If you do this, keep in mind that it is mandatory that you call
you must use <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> after modifying it.
</p>
<div class="example">
-<a name="id3054006"></a><p class="title"><b>Example 1. Directly modifying an image surface</b></p>
-<div class="example-contents">
- <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
- <tbody>
- <tr>
- <td class="listing_lines" align="right"><pre>1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19</pre></td>
- <td class="listing_code"><pre class="programlisting"><span class="type">void</span>
-<span class="function">modify_image_surface</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">cairo_surface_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">surface</span><span class="symbol">)</span>
-<span class="cbracket">{</span>
-<span class="normal"> </span><span class="type">unsigned</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">data</span><span class="symbol">;</span>
-<span class="normal"> </span><span class="type">int</span><span class="normal"> width</span><span class="symbol">,</span><span class="normal"> height</span><span class="symbol">,</span><span class="normal"> stride</span><span class="symbol">;</span>
+<a name="id2748408"></a><p class="title"><b>Example 1. Directly modifying an image surface</b></p>
+<div class="example-contents"><pre class="programlisting">
+void
+modify_image_surface (cairo_surface_t *surface)
+{
+ unsigned char *data;
+ int width, height, stride;
-<span class="normal"> </span><span class="comment">// flush to ensure all writing to the image was done</span>
-<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-flush">cairo_surface_flush</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">surface</span><span class="symbol">);</span>
+ // flush to ensure all writing to the image was done
+ cairo_surface_flush (surface);
-<span class="normal"> </span><span class="comment">// modify the image</span>
-<span class="normal"> data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html#cairo-image-surface-get-data">cairo_image_surface_get_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">surface</span><span class="symbol">);</span>
-<span class="normal"> width </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html#cairo-image-surface-get-width">cairo_image_surface_get_width</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">surface</span><span class="symbol">);</span>
-<span class="normal"> height </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html#cairo-image-surface-get-height">cairo_image_surface_get_height</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">surface</span><span class="symbol">);</span>
-<span class="normal"> stride </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html#cairo-image-surface-get-stride">cairo_image_surface_get_stride</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">surface</span><span class="symbol">);</span>
-<span class="normal"> </span><span class="function">modify_image_data</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data</span><span class="symbol">,</span><span class="normal"> width</span><span class="symbol">,</span><span class="normal"> height</span><span class="symbol">,</span><span class="normal"> stride</span><span class="symbol">);</span>
-
-<span class="normal"> </span><span class="comment">// mark the image dirty so Cairo clears its caches.</span>
-<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-mark-dirty">cairo_surface_mark_dirty</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">surface</span><span class="symbol">);</span>
-<span class="cbracket">}</span></pre></td>
- </tr>
- </tbody>
- </table>
-</div>
+ // modify the image
+ data = cairo_image_surface_get_data (surface);
+ width = cairo_image_surface_get_width (surface);
+ height = cairo_image_surface_get_height (surface);
+ stride = cairo_image_surface_get_stride (surface);
+ modify_image_data (data, width, height, stride);
+ // mark the image dirty so Cairo clears its caches.
+ cairo_surface_mark_dirty (surface);
+}
+</pre></div>
</div>
<p><br class="example-break">
Note that for other surface types it might be necessary to acquire the