1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>SVG Surfaces</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
7
<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
8
<link rel="up" href="Surfaces.html" title="Surfaces">
9
<link rel="prev" href="cairo-Win32-Surfaces.html" title="Win32 Surfaces">
10
<link rel="next" href="cairo-Quartz-Surfaces.html" title="Quartz Surfaces">
11
<meta name="generator" content="GTK-Doc V1.10 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="chapter" href="Drawing.html" title="Drawing">
14
<link rel="chapter" href="Fonts.html" title="Fonts">
15
<link rel="chapter" href="Surfaces.html" title="Surfaces">
16
<link rel="chapter" href="Support.html" title="Utilities">
17
<link rel="index" href="ix01.html" title="Index">
18
<link rel="index" href="index-1.2.html" title="Index of new symbols in 1.2">
19
<link rel="index" href="index-1.4.html" title="Index of new symbols in 1.4">
20
<link rel="index" href="index-1.6.html" title="Index of new symbols in 1.6">
21
<link rel="index" href="index-1.8.html" title="Index of new symbols in 1.8">
22
<link rel="appendix" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo">
24
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
25
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
27
<td><a accesskey="p" href="cairo-Win32-Surfaces.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
28
<td><a accesskey="u" href="Surfaces.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
29
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
30
<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
31
<td><a accesskey="n" href="cairo-Quartz-Surfaces.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
33
<tr><td colspan="5" class="shortcuts"><nobr><a href="#cairo-SVG-Surfaces.synopsis" class="shortcut">Top</a>
35
<a href="#cairo-SVG-Surfaces.description" class="shortcut">Description</a></nobr></td></tr>
37
<div class="refentry" lang="en">
38
<a name="cairo-SVG-Surfaces"></a><div class="titlepage"></div>
39
<div class="refnamediv"><table width="100%"><tr>
41
<h2><span class="refentrytitle"><a name="cairo-SVG-Surfaces.top_of_page"></a>SVG Surfaces</span></h2>
42
<p>SVG Surfaces — Rendering SVG documents</p>
44
<td valign="top" align="right"></td>
46
<div class="refsynopsisdiv">
47
<a name="cairo-SVG-Surfaces.synopsis"></a><h2>Synopsis</h2>
48
<pre class="synopsis">
49
#define <a class="link" href="cairo-SVG-Surfaces.html#CAIRO-HAS-SVG-SURFACE:CAPS" title="CAIRO_HAS_SVG_SURFACE">CAIRO_HAS_SVG_SURFACE</a>
50
<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a>* <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-surface-create" title="cairo_svg_surface_create ()">cairo_svg_surface_create</a> (const char *filename,
51
double width_in_points,
52
double height_in_points);
53
<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a>* <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-surface-create-for-stream" title="cairo_svg_surface_create_for_stream ()">cairo_svg_surface_create_for_stream</a> (<a class="link" href="cairo-PNG-Support.html#cairo-write-func-t" title="cairo_write_func_t ()">cairo_write_func_t</a> write_func,
55
double width_in_points,
56
double height_in_points);
57
void <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-surface-restrict-to-version" title="cairo_svg_surface_restrict_to_version ()">cairo_svg_surface_restrict_to_version</a>
58
(<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
59
<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a> version);
60
enum <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a>;
61
void <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-get-versions" title="cairo_svg_get_versions ()">cairo_svg_get_versions</a> (<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a> const **versions,
63
const char* <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-to-string" title="cairo_svg_version_to_string ()">cairo_svg_version_to_string</a> (<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a> version);
66
<div class="refsect1" lang="en">
67
<a name="cairo-SVG-Surfaces.description"></a><h2>Description</h2>
69
The SVG surface is used to render cairo graphics to
70
SVG files and is a multi-page vector surface backend.
73
<div class="refsect1" lang="en">
74
<a name="cairo-SVG-Surfaces.details"></a><h2>Details</h2>
75
<div class="refsect2" lang="en">
76
<a name="CAIRO-HAS-SVG-SURFACE:CAPS"></a><h3>CAIRO_HAS_SVG_SURFACE</h3>
77
<pre class="programlisting">#define CAIRO_HAS_SVG_SURFACE 1
80
Defined if the SVG surface backend is available.
81
This macro can be used to conditionally compile backend-specific code.
85
<div class="refsect2" lang="en">
86
<a name="cairo-svg-surface-create"></a><h3>cairo_svg_surface_create ()</h3>
87
<pre class="programlisting"><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a>* cairo_svg_surface_create (const char *filename,
88
double width_in_points,
89
double height_in_points);</pre>
91
Creates a SVG surface of the specified size in points to be written
92
to <em class="parameter"><code>filename</code></em>.</p>
96
<div class="variablelist"><table border="0">
97
<col align="left" valign="top">
100
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
101
<td> a filename for the SVG output (must be writable)
105
<td><p><span class="term"><em class="parameter"><code>width_in_points</code></em> :</span></p></td>
106
<td> width of the surface, in points (1 point == 1/72.0 inch)
110
<td><p><span class="term"><em class="parameter"><code>height_in_points</code></em> :</span></p></td>
111
<td> height of the surface, in points (1 point == 1/72.0 inch)
115
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
116
<td> a pointer to the newly created surface. The caller
117
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
120
This function always returns a valid pointer, but it will return a
121
pointer to a "nil" surface if an error such as out of memory
122
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.
128
<p class="since">Since 1.2
132
<div class="refsect2" lang="en">
133
<a name="cairo-svg-surface-create-for-stream"></a><h3>cairo_svg_surface_create_for_stream ()</h3>
134
<pre class="programlisting"><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a>* cairo_svg_surface_create_for_stream (<a class="link" href="cairo-PNG-Support.html#cairo-write-func-t" title="cairo_write_func_t ()">cairo_write_func_t</a> write_func,
136
double width_in_points,
137
double height_in_points);</pre>
139
Creates a SVG surface of the specified size in points to be written
140
incrementally to the stream represented by <em class="parameter"><code>write_func</code></em> and <em class="parameter"><code>closure</code></em>.</p>
144
<div class="variablelist"><table border="0">
145
<col align="left" valign="top">
148
<td><p><span class="term"><em class="parameter"><code>write_func</code></em> :</span></p></td>
149
<td> a <a class="link" href="cairo-PNG-Support.html#cairo-write-func-t" title="cairo_write_func_t ()"><span class="type">cairo_write_func_t</span></a> to accept the output data
153
<td><p><span class="term"><em class="parameter"><code>closure</code></em> :</span></p></td>
154
<td> the closure argument for <em class="parameter"><code>write_func</code></em>
158
<td><p><span class="term"><em class="parameter"><code>width_in_points</code></em> :</span></p></td>
159
<td> width of the surface, in points (1 point == 1/72.0 inch)
163
<td><p><span class="term"><em class="parameter"><code>height_in_points</code></em> :</span></p></td>
164
<td> height of the surface, in points (1 point == 1/72.0 inch)
168
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
169
<td> a pointer to the newly created surface. The caller
170
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
173
This function always returns a valid pointer, but it will return a
174
pointer to a "nil" surface if an error such as out of memory
175
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.
181
<p class="since">Since 1.2
185
<div class="refsect2" lang="en">
186
<a name="cairo-svg-surface-restrict-to-version"></a><h3>cairo_svg_surface_restrict_to_version ()</h3>
187
<pre class="programlisting">void cairo_svg_surface_restrict_to_version
188
(<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t">cairo_surface_t</a> *surface,
189
<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a> version);</pre>
191
Restricts the generated SVG file to <em class="parameter"><code>version</code></em>. See <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-get-versions" title="cairo_svg_get_versions ()"><code class="function">cairo_svg_get_versions()</code></a>
192
for a list of available version values that can be used here.
195
This function should only be called before any drawing operations
196
have been performed on the given surface. The simplest way to do
197
this is to call this function immediately after creating the
202
<div class="variablelist"><table border="0">
203
<col align="left" valign="top">
206
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
207
<td> a SVG <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
211
<td><p><span class="term"><em class="parameter"><code>version</code></em> :</span></p></td>
217
<p class="since">Since 1.2
221
<div class="refsect2" lang="en">
222
<a name="cairo-svg-version-t"></a><h3>enum cairo_svg_version_t</h3>
223
<pre class="programlisting">typedef enum _cairo_svg_version {
224
CAIRO_SVG_VERSION_1_1,
225
CAIRO_SVG_VERSION_1_2
226
} cairo_svg_version_t;
229
<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t"><span class="type">cairo_svg_version_t</span></a> is used to describe the version number of the SVG
230
specification that a generated SVG file will conform to.</p>
234
<div class="variablelist"><table border="0">
235
<col align="left" valign="top">
238
<td><p><a name="CAIRO-SVG-VERSION-1-1:CAPS"></a><span class="term"><code class="literal">CAIRO_SVG_VERSION_1_1</code></span></p></td>
239
<td> The version 1.1 of the SVG specification.
243
<td><p><a name="CAIRO-SVG-VERSION-1-2:CAPS"></a><span class="term"><code class="literal">CAIRO_SVG_VERSION_1_2</code></span></p></td>
244
<td> The version 1.2 of the SVG specification.
251
<div class="refsect2" lang="en">
252
<a name="cairo-svg-get-versions"></a><h3>cairo_svg_get_versions ()</h3>
253
<pre class="programlisting">void cairo_svg_get_versions (<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a> const **versions,
254
int *num_versions);</pre>
256
Used to retrieve the list of supported versions. See
257
<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-surface-restrict-to-version" title="cairo_svg_surface_restrict_to_version ()"><code class="function">cairo_svg_surface_restrict_to_version()</code></a>.</p>
261
<div class="variablelist"><table border="0">
262
<col align="left" valign="top">
265
<td><p><span class="term"><em class="parameter"><code>versions</code></em> :</span></p></td>
266
<td> supported version list
270
<td><p><span class="term"><em class="parameter"><code>num_versions</code></em> :</span></p></td>
276
<p class="since">Since 1.2
280
<div class="refsect2" lang="en">
281
<a name="cairo-svg-version-to-string"></a><h3>cairo_svg_version_to_string ()</h3>
282
<pre class="programlisting">const char* cairo_svg_version_to_string (<a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-version-t" title="enum cairo_svg_version_t">cairo_svg_version_t</a> version);</pre>
284
Get the string representation of the given <em class="parameter"><code>version</code></em> id. This function
286
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
287
><code class="literal">NULL</code></a> if <em class="parameter"><code>version</code></em> isn't valid. See <a class="link" href="cairo-SVG-Surfaces.html#cairo-svg-get-versions" title="cairo_svg_get_versions ()"><code class="function">cairo_svg_get_versions()</code></a>
288
for a way to get the list of valid version ids.</p>
292
<div class="variablelist"><table border="0">
293
<col align="left" valign="top">
296
<td><p><span class="term"><em class="parameter"><code>version</code></em> :</span></p></td>
301
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
302
<td> the string associated to given version.
308
<p class="since">Since 1.2
312
<div class="refsect1" lang="en">
313
<a name="cairo-SVG-Surfaces.see-also"></a><h2>See Also</h2>
316
<div class="itemizedlist"><ul type="disc"><li>#<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><code class="function">cairo_surface_t()</code></a>
324
Generated by GTK-Doc V1.10</div>