cairo-surface.html   [plain text]


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cairo_surface_t</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library">
<link rel="up" href="cairo-surfaces.html" title="Surfaces">
<link rel="prev" href="cairo-surfaces.html" title="Surfaces">
<link rel="next" href="cairo-image-surface.html" title="Image Surfaces">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="cairo-drawing.html" title="Drawing">
<link rel="chapter" href="cairo-fonts.html" title="Fonts">
<link rel="chapter" href="cairo-surfaces.html" title="Surfaces">
<link rel="chapter" href="cairo-support.html" title="Utilities">
<link rel="index" href="index-all.html" title="Index">
<link rel="index" href="index-1.2.html" title="Index of new symbols in 1.2">
<link rel="index" href="index-1.4.html" title="Index of new symbols in 1.4">
<link rel="index" href="index-1.6.html" title="Index of new symbols in 1.6">
<link rel="index" href="index-1.8.html" title="Index of new symbols in 1.8">
<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-surfaces.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="cairo-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="cairo-image-surface.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#cairo-surface.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#cairo-surface.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-surface"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cairo-surface.top_of_page"></a>cairo_surface_t</span></h2>
<p>cairo_surface_t — Base class for surfaces</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="cairo-surface.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
typedef             <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a>;
enum                <a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t">cairo_content_t</a>;
<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *   <a class="link" href="cairo-surface.html#cairo-surface-create-similar" title="cairo_surface_create_similar ()">cairo_surface_create_similar</a>        (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *other,
                                                         <a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t">cairo_content_t</a> content,
                                                         int width,
                                                         int height);
<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *   <a class="link" href="cairo-surface.html#cairo-surface-reference" title="cairo_surface_reference ()">cairo_surface_reference</a>             (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-destroy" title="cairo_surface_destroy ()">cairo_surface_destroy</a>               (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
<a class="link" href="cairo-error-status.html#cairo-status-t" title="enum cairo_status_t">cairo_status_t</a>      <a class="link" href="cairo-surface.html#cairo-surface-status" title="cairo_surface_status ()">cairo_surface_status</a>                (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-finish" title="cairo_surface_finish ()">cairo_surface_finish</a>                (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-flush" title="cairo_surface_flush ()">cairo_surface_flush</a>                 (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-get-font-options" title="cairo_surface_get_font_options ()">cairo_surface_get_font_options</a>      (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         <a class="link" href="cairo-font-options.html#cairo-font-options-t" title="cairo_font_options_t">cairo_font_options_t</a> *options);
<a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t">cairo_content_t</a>     <a class="link" href="cairo-surface.html#cairo-surface-get-content" title="cairo_surface_get_content ()">cairo_surface_get_content</a>           (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-mark-dirty" title="cairo_surface_mark_dirty ()">cairo_surface_mark_dirty</a>            (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-mark-dirty-rectangle" title="cairo_surface_mark_dirty_rectangle ()">cairo_surface_mark_dirty_rectangle</a>  (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         int x,
                                                         int y,
                                                         int width,
                                                         int height);
void                <a class="link" href="cairo-surface.html#cairo-surface-set-device-offset" title="cairo_surface_set_device_offset ()">cairo_surface_set_device_offset</a>     (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double x_offset,
                                                         double y_offset);
void                <a class="link" href="cairo-surface.html#cairo-surface-get-device-offset" title="cairo_surface_get_device_offset ()">cairo_surface_get_device_offset</a>     (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double *x_offset,
                                                         double *y_offset);
void                <a class="link" href="cairo-surface.html#cairo-surface-set-fallback-resolution" title="cairo_surface_set_fallback_resolution ()">cairo_surface_set_fallback_resolution</a>
                                                        (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double x_pixels_per_inch,
                                                         double y_pixels_per_inch);
void                <a class="link" href="cairo-surface.html#cairo-surface-get-fallback-resolution" title="cairo_surface_get_fallback_resolution ()">cairo_surface_get_fallback_resolution</a>
                                                        (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double *x_pixels_per_inch,
                                                         double *y_pixels_per_inch);
enum                <a class="link" href="cairo-surface.html#cairo-surface-type-t" title="enum cairo_surface_type_t">cairo_surface_type_t</a>;
<a class="link" href="cairo-surface.html#cairo-surface-type-t" title="enum cairo_surface_type_t">cairo_surface_type_t</a>  <a class="link" href="cairo-surface.html#cairo-surface-get-type" title="cairo_surface_get_type ()">cairo_surface_get_type</a>            (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
unsigned int        <a class="link" href="cairo-surface.html#cairo-surface-get-reference-count" title="cairo_surface_get_reference_count ()">cairo_surface_get_reference_count</a>   (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
<a class="link" href="cairo-error-status.html#cairo-status-t" title="enum cairo_status_t">cairo_status_t</a>      <a class="link" href="cairo-surface.html#cairo-surface-set-user-data" title="cairo_surface_set_user_data ()">cairo_surface_set_user_data</a>         (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         const <a class="link" href="cairo-types.html#cairo-user-data-key-t" title="cairo_user_data_key_t">cairo_user_data_key_t</a> *key,
                                                         void *user_data,
                                                         <a class="link" href="cairo-types.html#cairo-destroy-func-t" title="cairo_destroy_func_t ()">cairo_destroy_func_t</a> destroy);
void *              <a class="link" href="cairo-surface.html#cairo-surface-get-user-data" title="cairo_surface_get_user_data ()">cairo_surface_get_user_data</a>         (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         const <a class="link" href="cairo-types.html#cairo-user-data-key-t" title="cairo_user_data_key_t">cairo_user_data_key_t</a> *key);
void                <a class="link" href="cairo-surface.html#cairo-surface-copy-page" title="cairo_surface_copy_page ()">cairo_surface_copy_page</a>             (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
void                <a class="link" href="cairo-surface.html#cairo-surface-show-page" title="cairo_surface_show_page ()">cairo_surface_show_page</a>             (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
<a class="link" href="cairo-types.html#cairo-bool-t" title="cairo_bool_t">cairo_bool_t</a>        <a class="link" href="cairo-surface.html#cairo-surface-has-show-text-glyphs" title="cairo_surface_has_show_text_glyphs ()">cairo_surface_has_show_text_glyphs</a>  (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="cairo-surface.description"></a><h2>Description</h2>
<p>
<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> is the abstract type representing all different drawing
targets that cairo can render to.  The actual drawings are
performed using a cairo <em class="firstterm">context</em>.
</p>
<p>
A cairo surface is created by using <em class="firstterm">backend</em>-specific
constructors, typically of the form
cairo_<span class="emphasis"><em>backend</em></span><code class="function">_surface_create()</code>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="cairo-surface.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="cairo-surface-t"></a><h3>cairo_surface_t</h3>
<pre class="programlisting">typedef struct _cairo_surface cairo_surface_t;
</pre>
<p>
A <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> represents an image, either as the destination
of a drawing operation or as source when drawing onto another
surface.  To draw to a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>, create a cairo context
with the surface as the target, using <a class="link" href="cairo-context.html#cairo-create" title="cairo_create ()"><code class="function">cairo_create()</code></a>.
</p>
<p>
There are different subtypes of <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> for
different drawing backends; for example, <a class="link" href="cairo-image-surface.html#cairo-image-surface-create" title="cairo_image_surface_create ()"><code class="function">cairo_image_surface_create()</code></a>
creates a bitmap image in memory.
The type of a surface can be queried with <a class="link" href="cairo-surface.html#cairo-surface-get-type" title="cairo_surface_get_type ()"><code class="function">cairo_surface_get_type()</code></a>.
</p>
<p>
Memory management of <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> is done with
<a class="link" href="cairo-surface.html#cairo-surface-reference" title="cairo_surface_reference ()"><code class="function">cairo_surface_reference()</code></a> and <a class="link" href="cairo-surface.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a>.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-content-t"></a><h3>enum cairo_content_t</h3>
<pre class="programlisting">typedef enum _cairo_content {
    CAIRO_CONTENT_COLOR		= 0x1000,
    CAIRO_CONTENT_ALPHA		= 0x2000,
    CAIRO_CONTENT_COLOR_ALPHA	= 0x3000
} cairo_content_t;
</pre>
<p>
<a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t"><span class="type">cairo_content_t</span></a> is used to describe the content that a surface will
contain, whether color information, alpha information (translucence
vs. opacity), or both.
</p>
<p>
Note: The large values here are designed to keep <a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t"><span class="type">cairo_content_t</span></a>
values distinct from <a class="link" href="cairo-image-surface.html#cairo-format-t" title="enum cairo_format_t"><span class="type">cairo_format_t</span></a> values so that the
implementation can detect the error if users confuse the two types.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="CAIRO-CONTENT-COLOR--CAPS"></a><span class="term"><code class="literal">CAIRO_CONTENT_COLOR</code></span></p></td>
<td> The surface will hold color content only.
</td>
</tr>
<tr>
<td><p><a name="CAIRO-CONTENT-ALPHA--CAPS"></a><span class="term"><code class="literal">CAIRO_CONTENT_ALPHA</code></span></p></td>
<td> The surface will hold alpha content only.
</td>
</tr>
<tr>
<td><p><a name="CAIRO-CONTENT-COLOR-ALPHA--CAPS"></a><span class="term"><code class="literal">CAIRO_CONTENT_COLOR_ALPHA</code></span></p></td>
<td> The surface will hold color and alpha content.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-create-similar"></a><h3>cairo_surface_create_similar ()</h3>
<pre class="programlisting"><a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *   cairo_surface_create_similar        (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *other,
                                                         <a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t">cairo_content_t</a> content,
                                                         int width,
                                                         int height);</pre>
<p>
Create a new surface that is as compatible as possible with an
existing surface. For example the new surface will have the same
fallback resolution and font options as <em class="parameter"><code>other</code></em>. Generally, the new
surface will also use the same backend as <em class="parameter"><code>other</code></em>, unless that is
not possible for some reason. The type of the returned surface may
be examined with <a class="link" href="cairo-surface.html#cairo-surface-get-type" title="cairo_surface_get_type ()"><code class="function">cairo_surface_get_type()</code></a>.
</p>
<p>
Initially the surface contents are all 0 (transparent if contents
have transparency, black otherwise.)</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>other</code></em> :</span></p></td>
<td> an existing surface used to select the backend of the new surface
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>content</code></em> :</span></p></td>
<td> the content for the new surface
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td> width of the new surface, (in device-space units)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td> height of the new surface (in device-space units)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a pointer to the newly allocated surface. The caller
owns the surface and should call <a class="link" href="cairo-surface.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a> when done
with it.

This function always returns a valid pointer, but it will return a
pointer to a "nil" surface if <em class="parameter"><code>other</code></em> is already in an error state
or any other error occurs.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-reference"></a><h3>cairo_surface_reference ()</h3>
<pre class="programlisting"><a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *   cairo_surface_reference             (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Increases the reference count on <em class="parameter"><code>surface</code></em> by one. This prevents
<em class="parameter"><code>surface</code></em> from being destroyed until a matching call to
<a class="link" href="cairo-surface.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a> is made.
</p>
<p>
The number of references to a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> can be get using
<a class="link" href="cairo-surface.html#cairo-surface-get-reference-count" title="cairo_surface_get_reference_count ()"><code class="function">cairo_surface_get_reference_count()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the referenced <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-destroy"></a><h3>cairo_surface_destroy ()</h3>
<pre class="programlisting">void                cairo_surface_destroy               (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Decreases the reference count on <em class="parameter"><code>surface</code></em> by one. If the result is
zero, then <em class="parameter"><code>surface</code></em> and all associated resources are freed.  See
<a class="link" href="cairo-surface.html#cairo-surface-reference" title="cairo_surface_reference ()"><code class="function">cairo_surface_reference()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-status"></a><h3>cairo_surface_status ()</h3>
<pre class="programlisting"><a class="link" href="cairo-error-status.html#cairo-status-t" title="enum cairo_status_t">cairo_status_t</a>      cairo_surface_status                (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Checks whether an error has previously occurred for this
surface.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a class="link" href="cairo-error-status.html#CAIRO-STATUS-SUCCESS--CAPS"><code class="literal">CAIRO_STATUS_SUCCESS</code></a>, <a class="link" href="cairo-error-status.html#CAIRO-STATUS-NULL-POINTER--CAPS"><code class="literal">CAIRO_STATUS_NULL_POINTER</code></a>,
<a class="link" href="cairo-error-status.html#CAIRO-STATUS-NO-MEMORY--CAPS"><code class="literal">CAIRO_STATUS_NO_MEMORY</code></a>, <a class="link" href="cairo-error-status.html#CAIRO-STATUS-READ-ERROR--CAPS"><code class="literal">CAIRO_STATUS_READ_ERROR</code></a>,
<a class="link" href="cairo-error-status.html#CAIRO-STATUS-INVALID-CONTENT--CAPS"><code class="literal">CAIRO_STATUS_INVALID_CONTENT</code></a>, <a class="link" href="cairo-error-status.html#CAIRO-STATUS-INVALID-FORMAT--CAPS"><code class="literal">CAIRO_STATUS_INVALID_FORMAT</code></a>, or
<a class="link" href="cairo-error-status.html#CAIRO-STATUS-INVALID-VISUAL--CAPS"><code class="literal">CAIRO_STATUS_INVALID_VISUAL</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-finish"></a><h3>cairo_surface_finish ()</h3>
<pre class="programlisting">void                cairo_surface_finish                (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
This function finishes the surface and drops all references to
external resources.  For example, for the Xlib backend it means
that cairo will no longer access the drawable, which can be freed.
After calling <a class="link" href="cairo-surface.html#cairo-surface-finish" title="cairo_surface_finish ()"><code class="function">cairo_surface_finish()</code></a> the only valid operations on a
surface are getting and setting user, referencing and
destroying, and flushing and finishing it.
Further drawing to the surface will not affect the
surface but will instead trigger a <a class="link" href="cairo-error-status.html#CAIRO-STATUS-SURFACE-FINISHED--CAPS"><code class="literal">CAIRO_STATUS_SURFACE_FINISHED</code></a>
error.
</p>
<p>
When the last call to <a class="link" href="cairo-surface.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a> decreases the
reference count to zero, cairo will call <a class="link" href="cairo-surface.html#cairo-surface-finish" title="cairo_surface_finish ()"><code class="function">cairo_surface_finish()</code></a> if
it hasn't been called already, before freeing the resources
associated with the surface.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> the <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> to finish
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-flush"></a><h3>cairo_surface_flush ()</h3>
<pre class="programlisting">void                cairo_surface_flush                 (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Do any pending drawing for the surface and also restore any
temporary modification's cairo has made to the surface's
state. This function must be called before switching from
drawing on the surface with cairo to drawing on it directly
with native APIs. If the surface doesn't support direct access,
then this function does nothing.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-font-options"></a><h3>cairo_surface_get_font_options ()</h3>
<pre class="programlisting">void                cairo_surface_get_font_options      (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         <a class="link" href="cairo-font-options.html#cairo-font-options-t" title="cairo_font_options_t">cairo_font_options_t</a> *options);</pre>
<p>
Retrieves the default font rendering options for the surface.
This allows display surfaces to report the correct subpixel order
for rendering on them, print surfaces to disable hinting of
metrics and so forth. The result can then be used with
<a class="link" href="cairo-scaled-font.html#cairo-scaled-font-create" title="cairo_scaled_font_create ()"><code class="function">cairo_scaled_font_create()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>options</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-font-options.html#cairo-font-options-t" title="cairo_font_options_t"><span class="type">cairo_font_options_t</span></a> object into which to store
  the retrieved options. All existing values are overwritten
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-content"></a><h3>cairo_surface_get_content ()</h3>
<pre class="programlisting"><a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t">cairo_content_t</a>     cairo_surface_get_content           (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
This function returns the content type of <em class="parameter"><code>surface</code></em> which indicates
whether the surface contains color and/or alpha information. See
<a class="link" href="cairo-surface.html#cairo-content-t" title="enum cairo_content_t"><span class="type">cairo_content_t</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The content type of <em class="parameter"><code>surface</code></em>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-mark-dirty"></a><h3>cairo_surface_mark_dirty ()</h3>
<pre class="programlisting">void                cairo_surface_mark_dirty            (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Tells cairo that drawing has been done to surface using means other
than cairo, and that cairo should reread any cached areas. Note
that you must call <a class="link" href="cairo-surface.html#cairo-surface-flush" title="cairo_surface_flush ()"><code class="function">cairo_surface_flush()</code></a> before doing such drawing.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-mark-dirty-rectangle"></a><h3>cairo_surface_mark_dirty_rectangle ()</h3>
<pre class="programlisting">void                cairo_surface_mark_dirty_rectangle  (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         int x,
                                                         int y,
                                                         int width,
                                                         int height);</pre>
<p>
Like <a class="link" href="cairo-surface.html#cairo-surface-mark-dirty" title="cairo_surface_mark_dirty ()"><code class="function">cairo_surface_mark_dirty()</code></a>, but drawing has been done only to
the specified rectangle, so that cairo can retain cached contents
for other parts of the surface.
</p>
<p>
Any cached clip set on the surface will be reset by this function,
to make sure that future cairo calls have the clip set that they
expect.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td> X coordinate of dirty rectangle
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td> Y coordinate of dirty rectangle
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td> width of dirty rectangle
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td> height of dirty rectangle
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-set-device-offset"></a><h3>cairo_surface_set_device_offset ()</h3>
<pre class="programlisting">void                cairo_surface_set_device_offset     (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double x_offset,
                                                         double y_offset);</pre>
<p>
Sets an offset that is added to the device coordinates determined
by the CTM when drawing to <em class="parameter"><code>surface</code></em>. One use case for this function
is when we want to create a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> that redirects drawing
for a portion of an onscreen surface to an offscreen surface in a
way that is completely invisible to the user of the cairo
API. Setting a transformation via <a class="link" href="cairo-transformations.html#cairo-translate" title="cairo_translate ()"><code class="function">cairo_translate()</code></a> isn't
sufficient to do this, since functions like
<a class="link" href="cairo-transformations.html#cairo-device-to-user" title="cairo_device_to_user ()"><code class="function">cairo_device_to_user()</code></a> will expose the hidden offset.
</p>
<p>
Note that the offset affects drawing to the surface as well as
using the surface in a source pattern.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x_offset</code></em> :</span></p></td>
<td> the offset in the X direction, in device units
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y_offset</code></em> :</span></p></td>
<td> the offset in the Y direction, in device units
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-device-offset"></a><h3>cairo_surface_get_device_offset ()</h3>
<pre class="programlisting">void                cairo_surface_get_device_offset     (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double *x_offset,
                                                         double *y_offset);</pre>
<p>
This function returns the previous device offset set by
<a class="link" href="cairo-surface.html#cairo-surface-set-device-offset" title="cairo_surface_set_device_offset ()"><code class="function">cairo_surface_set_device_offset()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x_offset</code></em> :</span></p></td>
<td> the offset in the X direction, in device units
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y_offset</code></em> :</span></p></td>
<td> the offset in the Y direction, in device units
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-set-fallback-resolution"></a><h3>cairo_surface_set_fallback_resolution ()</h3>
<pre class="programlisting">void                cairo_surface_set_fallback_resolution
                                                        (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double x_pixels_per_inch,
                                                         double y_pixels_per_inch);</pre>
<p>
Set the horizontal and vertical resolution for image fallbacks.
</p>
<p>
When certain operations aren't supported natively by a backend,
cairo will fallback by rendering operations to an image and then
overlaying that image onto the output. For backends that are
natively vector-oriented, this function can be used to set the
resolution used for these image fallbacks, (larger values will
result in more detailed images, but also larger file sizes).
</p>
<p>
Some examples of natively vector-oriented backends are the ps, pdf,
and svg backends.
</p>
<p>
For backends that are natively raster-oriented, image fallbacks are
still possible, but they are always performed at the native
device resolution. So this function has no effect on those
backends.
</p>
<p>
Note: The fallback resolution only takes effect at the time of
completing a page (with <a class="link" href="cairo-context.html#cairo-show-page" title="cairo_show_page ()"><code class="function">cairo_show_page()</code></a> or <a class="link" href="cairo-context.html#cairo-copy-page" title="cairo_copy_page ()"><code class="function">cairo_copy_page()</code></a>) so
there is currently no way to have more than one fallback resolution
in effect on a single page.
</p>
<p>
The default fallback resoultion is 300 pixels per inch in both
dimensions.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x_pixels_per_inch</code></em> :</span></p></td>
<td> horizontal setting for pixels per inch
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y_pixels_per_inch</code></em> :</span></p></td>
<td> vertical setting for pixels per inch
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-fallback-resolution"></a><h3>cairo_surface_get_fallback_resolution ()</h3>
<pre class="programlisting">void                cairo_surface_get_fallback_resolution
                                                        (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         double *x_pixels_per_inch,
                                                         double *y_pixels_per_inch);</pre>
<p>
This function returns the previous fallback resolution set by
<a class="link" href="cairo-surface.html#cairo-surface-set-fallback-resolution" title="cairo_surface_set_fallback_resolution ()"><code class="function">cairo_surface_set_fallback_resolution()</code></a>, or default fallback
resolution if never set.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x_pixels_per_inch</code></em> :</span></p></td>
<td> horizontal pixels per inch
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y_pixels_per_inch</code></em> :</span></p></td>
<td> vertical pixels per inch
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.8</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-type-t"></a><h3>enum cairo_surface_type_t</h3>
<pre class="programlisting">typedef enum _cairo_surface_type {
    CAIRO_SURFACE_TYPE_IMAGE,
    CAIRO_SURFACE_TYPE_PDF,
    CAIRO_SURFACE_TYPE_PS,
    CAIRO_SURFACE_TYPE_XLIB,
    CAIRO_SURFACE_TYPE_XCB,
    CAIRO_SURFACE_TYPE_GLITZ,
    CAIRO_SURFACE_TYPE_QUARTZ,
    CAIRO_SURFACE_TYPE_WIN32,
    CAIRO_SURFACE_TYPE_BEOS,
    CAIRO_SURFACE_TYPE_DIRECTFB,
    CAIRO_SURFACE_TYPE_SVG,
    CAIRO_SURFACE_TYPE_OS2,
    CAIRO_SURFACE_TYPE_WIN32_PRINTING,
    CAIRO_SURFACE_TYPE_QUARTZ_IMAGE
} cairo_surface_type_t;
</pre>
<p>
<a class="link" href="cairo-surface.html#cairo-surface-type-t" title="enum cairo_surface_type_t"><span class="type">cairo_surface_type_t</span></a> is used to describe the type of a given
surface. The surface types are also known as "backends" or "surface
backends" within cairo.
</p>
<p>
The type of a surface is determined by the function used to create
it, which will generally be of the form cairo_<span class="emphasis"><em>type</em></span><code class="function">_surface_create()</code>,
(though see <a class="link" href="cairo-surface.html#cairo-surface-create-similar" title="cairo_surface_create_similar ()"><code class="function">cairo_surface_create_similar()</code></a> as well).
</p>
<p>
The surface type can be queried with <a class="link" href="cairo-surface.html#cairo-surface-get-type" title="cairo_surface_get_type ()"><code class="function">cairo_surface_get_type()</code></a>
</p>
<p>
The various <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> functions can be used with surfaces of
any type, but some backends also provide type-specific functions
that must only be called with a surface of the appropriate
type. These functions have names that begin with
cairo_<span class="emphasis"><em>type</em></span>_surface such as <a class="link" href="cairo-image-surface.html#cairo-image-surface-get-width" title="cairo_image_surface_get_width ()"><code class="function">cairo_image_surface_get_width()</code></a>.
</p>
<p>
The behavior of calling a type-specific function with a surface of
the wrong type is undefined.
</p>
<p>
New entries may be added in future versions.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-IMAGE--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_IMAGE</code></span></p></td>
<td> The surface is of type image
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-PDF--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_PDF</code></span></p></td>
<td> The surface is of type pdf
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-PS--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_PS</code></span></p></td>
<td> The surface is of type ps
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-XLIB--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_XLIB</code></span></p></td>
<td> The surface is of type xlib
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-XCB--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_XCB</code></span></p></td>
<td> The surface is of type xcb
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-GLITZ--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_GLITZ</code></span></p></td>
<td> The surface is of type glitz
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-QUARTZ--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_QUARTZ</code></span></p></td>
<td> The surface is of type quartz
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-WIN32--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_WIN32</code></span></p></td>
<td> The surface is of type win32
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-BEOS--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_BEOS</code></span></p></td>
<td> The surface is of type beos
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-DIRECTFB--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_DIRECTFB</code></span></p></td>
<td> The surface is of type directfb
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-SVG--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_SVG</code></span></p></td>
<td> The surface is of type svg
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-OS2--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_OS2</code></span></p></td>
<td> The surface is of type os2
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-WIN32-PRINTING--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_WIN32_PRINTING</code></span></p></td>
<td> The surface is a win32 printing surface
</td>
</tr>
<tr>
<td><p><a name="CAIRO-SURFACE-TYPE-QUARTZ-IMAGE--CAPS"></a><span class="term"><code class="literal">CAIRO_SURFACE_TYPE_QUARTZ_IMAGE</code></span></p></td>
<td> The surface is of type quartz_image
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-type"></a><h3>cairo_surface_get_type ()</h3>
<pre class="programlisting"><a class="link" href="cairo-surface.html#cairo-surface-type-t" title="enum cairo_surface_type_t">cairo_surface_type_t</a>  cairo_surface_get_type            (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
This function returns the type of the backend used to create
a surface. See <a class="link" href="cairo-surface.html#cairo-surface-type-t" title="enum cairo_surface_type_t"><span class="type">cairo_surface_type_t</span></a> for available types.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The type of <em class="parameter"><code>surface</code></em>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-reference-count"></a><h3>cairo_surface_get_reference_count ()</h3>
<pre class="programlisting">unsigned int        cairo_surface_get_reference_count   (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Returns the current reference count of <em class="parameter"><code>surface</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the current reference count of <em class="parameter"><code>surface</code></em>.  If the
object is a nil object, 0 will be returned.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-set-user-data"></a><h3>cairo_surface_set_user_data ()</h3>
<pre class="programlisting"><a class="link" href="cairo-error-status.html#cairo-status-t" title="enum cairo_status_t">cairo_status_t</a>      cairo_surface_set_user_data         (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         const <a class="link" href="cairo-types.html#cairo-user-data-key-t" title="cairo_user_data_key_t">cairo_user_data_key_t</a> *key,
                                                         void *user_data,
                                                         <a class="link" href="cairo-types.html#cairo-destroy-func-t" title="cairo_destroy_func_t ()">cairo_destroy_func_t</a> destroy);</pre>
<p>
Attach user data to <em class="parameter"><code>surface</code></em>.  To remove user data from a surface,
call this function with the key that was used to set it and <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
for <em class="parameter"><code>data</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td> the address of a <a class="link" href="cairo-types.html#cairo-user-data-key-t" title="cairo_user_data_key_t"><span class="type">cairo_user_data_key_t</span></a> to attach the user data to
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> the user data to attach to the surface
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-types.html#cairo-destroy-func-t" title="cairo_destroy_func_t ()"><span class="type">cairo_destroy_func_t</span></a> which will be called when the
surface is destroyed or when new user data is attached using the
same key.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a class="link" href="cairo-error-status.html#CAIRO-STATUS-SUCCESS--CAPS"><code class="literal">CAIRO_STATUS_SUCCESS</code></a> or <a class="link" href="cairo-error-status.html#CAIRO-STATUS-NO-MEMORY--CAPS"><code class="literal">CAIRO_STATUS_NO_MEMORY</code></a> if a
slot could not be allocated for the user data.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-get-user-data"></a><h3>cairo_surface_get_user_data ()</h3>
<pre class="programlisting">void *              cairo_surface_get_user_data         (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
                                                         const <a class="link" href="cairo-types.html#cairo-user-data-key-t" title="cairo_user_data_key_t">cairo_user_data_key_t</a> *key);</pre>
<p>
Return user data previously attached to <em class="parameter"><code>surface</code></em> using the specified
key.  If no user data has been attached with the given key this
function returns <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td> the address of the <a class="link" href="cairo-types.html#cairo-user-data-key-t" title="cairo_user_data_key_t"><span class="type">cairo_user_data_key_t</span></a> the user data was
attached to
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the user data previously attached or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-copy-page"></a><h3>cairo_surface_copy_page ()</h3>
<pre class="programlisting">void                cairo_surface_copy_page             (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Emits the current page for backends that support multiple pages,
but doesn't clear it, so that the contents of the current page will
be retained for the next page.  Use <a class="link" href="cairo-surface.html#cairo-surface-show-page" title="cairo_surface_show_page ()"><code class="function">cairo_surface_show_page()</code></a> if you
want to get an empty page after the emission.
</p>
<p>
There is a convenience function for this that takes a <a class="link" href="cairo-context.html#cairo-t" title="cairo_t"><span class="type">cairo_t</span></a>,
namely <a class="link" href="cairo-context.html#cairo-copy-page" title="cairo_copy_page ()"><code class="function">cairo_copy_page()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 1.6</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-show-page"></a><h3>cairo_surface_show_page ()</h3>
<pre class="programlisting">void                cairo_surface_show_page             (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Emits and clears the current page for backends that support multiple
pages.  Use <a class="link" href="cairo-surface.html#cairo-surface-copy-page" title="cairo_surface_copy_page ()"><code class="function">cairo_surface_copy_page()</code></a> if you don't want to clear the page.
</p>
<p>
There is a convenience function for this that takes a <a class="link" href="cairo-context.html#cairo-t" title="cairo_t"><span class="type">cairo_t</span></a>,
namely <a class="link" href="cairo-context.html#cairo-show-page" title="cairo_show_page ()"><code class="function">cairo_show_page()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <span class="type">cairo_Surface_t</span>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 1.6</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-surface-has-show-text-glyphs"></a><h3>cairo_surface_has_show_text_glyphs ()</h3>
<pre class="programlisting"><a class="link" href="cairo-types.html#cairo-bool-t" title="cairo_bool_t">cairo_bool_t</a>        cairo_surface_has_show_text_glyphs  (<a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface);</pre>
<p>
Returns whether the surface supports
sophisticated <a class="link" href="cairo-text.html#cairo-show-text-glyphs" title="cairo_show_text_glyphs ()"><code class="function">cairo_show_text_glyphs()</code></a> operations.  That is,
whether it actually uses the provided text and cluster data
to a <a class="link" href="cairo-text.html#cairo-show-text-glyphs" title="cairo_show_text_glyphs ()"><code class="function">cairo_show_text_glyphs()</code></a> call.
</p>
<p>
Note: Even if this function returns <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a>, a
<a class="link" href="cairo-text.html#cairo-show-text-glyphs" title="cairo_show_text_glyphs ()"><code class="function">cairo_show_text_glyphs()</code></a> operation targeted at <em class="parameter"><code>surface</code></em> will
still succeed.  It just will
act like a <a class="link" href="cairo-text.html#cairo-show-glyphs" title="cairo_show_glyphs ()"><code class="function">cairo_show_glyphs()</code></a> operation.  Users can use this
function to avoid computing UTF-8 text and cluster mapping if the
target surface does not use it.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-surface.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a> if <em class="parameter"><code>surface</code></em> supports
              <a class="link" href="cairo-text.html#cairo-show-text-glyphs" title="cairo_show_text_glyphs ()"><code class="function">cairo_show_text_glyphs()</code></a>, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> otherwise

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.8</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="cairo-surface.see-also"></a><h2>See Also</h2>
<p>
</p>
<div class="itemizedlist"><ul type="disc">
<li>#<a class="link" href="cairo-context.html#cairo-t" title="cairo_t"><code class="function">cairo_t()</code></a>
</li>
<li>#<a class="link" href="cairo-pattern.html#cairo-pattern-t" title="cairo_pattern_t"><code class="function">cairo_pattern_t()</code></a>
</li>
</ul></div>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>