<?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-SVG-Surfaces">
<refmeta>
<refentrytitle role="top_of_page">SVG Surfaces</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>SVG Surfaces</refname>
<refpurpose>Rendering SVG documents</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>



#define             <link linkend="CAIRO-HAS-SVG-SURFACE:CAPS">CAIRO_HAS_SVG_SURFACE</link>
<link linkend="cairo-surface-t">cairo_surface_t</link>*    <link linkend="cairo-svg-surface-create">cairo_svg_surface_create</link>            (const <link linkend="char">char</link> *filename,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);
<link linkend="cairo-surface-t">cairo_surface_t</link>*    <link linkend="cairo-svg-surface-create-for-stream">cairo_svg_surface_create_for_stream</link> (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
                                                         <link linkend="void">void</link> *closure,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);
<link linkend="void">void</link>                <link linkend="cairo-svg-surface-restrict-to-version">cairo_svg_surface_restrict_to_version</link>
                                                        (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
                                                         <link linkend="cairo-svg-version-t">cairo_svg_version_t</link> version);
enum                <link linkend="cairo-svg-version-t">cairo_svg_version_t</link>;
<link linkend="void">void</link>                <link linkend="cairo-svg-get-versions">cairo_svg_get_versions</link>              (<link linkend="cairo-svg-version-t">cairo_svg_version_t</link> const **versions,
                                                         <link linkend="int">int</link> *num_versions);
const <link linkend="char">char</link>*         <link linkend="cairo-svg-version-to-string">cairo_svg_version_to_string</link>         (<link linkend="cairo-svg-version-t">cairo_svg_version_t</link> version);
</synopsis>
</refsynopsisdiv>









<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
The SVG surface is used to render cairo graphics to
SVG files and is a multi-page vector surface backend.
</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="CAIRO-HAS-SVG-SURFACE:CAPS" role="macro"/>CAIRO_HAS_SVG_SURFACE</title>
<indexterm><primary>CAIRO_HAS_SVG_SURFACE</primary></indexterm><programlisting>#define CAIRO_HAS_SVG_SURFACE 1
</programlisting>
<para>
Defined if the SVG surface backend is available.
This macro can be used to conditionally compile backend-specific code.
</para></refsect2>
<refsect2>
<title><anchor id="cairo-svg-surface-create" role="function" condition="since:1.2"/>cairo_svg_surface_create ()</title>
<indexterm role="1.2"><primary>cairo_svg_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>*    cairo_svg_surface_create            (const <link linkend="char">char</link> *filename,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);</programlisting>
<para>
Creates a SVG surface of the specified size in points to be written
to <parameter>filename</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
<listitem><simpara> a filename for the SVG output (must be writable)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width_in_points</parameter>&nbsp;:</term>
<listitem><simpara> width of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height_in_points</parameter>&nbsp;:</term>
<listitem><simpara> height of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a pointer to the newly created surface. The caller
owns the surface and should call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> when done
with it.

This function always returns a valid pointer, but it will return a
pointer to a "nil" surface if an error such as out of memory
occurs. You can use <link linkend="cairo-surface-status"><function>cairo_surface_status()</function></link> to check for this.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.2
</para></refsect2>
<refsect2>
<title><anchor id="cairo-svg-surface-create-for-stream" role="function" condition="since:1.2"/>cairo_svg_surface_create_for_stream ()</title>
<indexterm role="1.2"><primary>cairo_svg_surface_create_for_stream</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>*    cairo_svg_surface_create_for_stream (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
                                                         <link linkend="void">void</link> *closure,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);</programlisting>
<para>
Creates a SVG surface of the specified size in points to be written
incrementally to the stream represented by <parameter>write_func</parameter> and <parameter>closure</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>write_func</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link> to accept the output data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
<listitem><simpara> the closure argument for <parameter>write_func</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width_in_points</parameter>&nbsp;:</term>
<listitem><simpara> width of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height_in_points</parameter>&nbsp;:</term>
<listitem><simpara> height of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a pointer to the newly created surface. The caller
owns the surface and should call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> when done
with it.

This function always returns a valid pointer, but it will return a
pointer to a "nil" surface if an error such as out of memory
occurs. You can use <link linkend="cairo-surface-status"><function>cairo_surface_status()</function></link> to check for this.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.2
</para></refsect2>
<refsect2>
<title><anchor id="cairo-svg-surface-restrict-to-version" role="function" condition="since:1.2"/>cairo_svg_surface_restrict_to_version ()</title>
<indexterm role="1.2"><primary>cairo_svg_surface_restrict_to_version</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_svg_surface_restrict_to_version
                                                        (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
                                                         <link linkend="cairo-svg-version-t">cairo_svg_version_t</link> version);</programlisting>
<para>
Restricts the generated SVG file to <parameter>version</parameter>. See <link linkend="cairo-svg-get-versions"><function>cairo_svg_get_versions()</function></link>
for a list of available version values that can be used here.
</para>
<para>
This function should only be called before any drawing operations
have been performed on the given surface. The simplest way to do
this is to call this function immediately after creating the
surface.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
<listitem><simpara> a SVG <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>version</parameter>&nbsp;:</term>
<listitem><simpara> SVG version
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.2
</para></refsect2>
<refsect2>
<title><anchor id="cairo-svg-version-t" role="enum"/>enum cairo_svg_version_t</title>
<indexterm><primary>cairo_svg_version_t</primary></indexterm><programlisting>typedef enum _cairo_svg_version {
    CAIRO_SVG_VERSION_1_1,
    CAIRO_SVG_VERSION_1_2
} cairo_svg_version_t;
</programlisting>
<para>
<link linkend="cairo-svg-version-t"><type>cairo_svg_version_t</type></link> is used to describe the version number of the SVG
specification that a generated SVG file will conform to.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="CAIRO-SVG-VERSION-1-1:CAPS" role="constant"/><literal>CAIRO_SVG_VERSION_1_1</literal></term>
<listitem><simpara> The version 1.1 of the SVG specification.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-SVG-VERSION-1-2:CAPS" role="constant"/><literal>CAIRO_SVG_VERSION_1_2</literal></term>
<listitem><simpara> The version 1.2 of the SVG specification.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-svg-get-versions" role="function" condition="since:1.2"/>cairo_svg_get_versions ()</title>
<indexterm role="1.2"><primary>cairo_svg_get_versions</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_svg_get_versions              (<link linkend="cairo-svg-version-t">cairo_svg_version_t</link> const **versions,
                                                         <link linkend="int">int</link> *num_versions);</programlisting>
<para>
Used to retrieve the list of supported versions. See
<link linkend="cairo-svg-surface-restrict-to-version"><function>cairo_svg_surface_restrict_to_version()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>versions</parameter>&nbsp;:</term>
<listitem><simpara> supported version list
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_versions</parameter>&nbsp;:</term>
<listitem><simpara> list length
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.2
</para></refsect2>
<refsect2>
<title><anchor id="cairo-svg-version-to-string" role="function" condition="since:1.2"/>cairo_svg_version_to_string ()</title>
<indexterm role="1.2"><primary>cairo_svg_version_to_string</primary></indexterm><programlisting>const <link linkend="char">char</link>*         cairo_svg_version_to_string         (<link linkend="cairo-svg-version-t">cairo_svg_version_t</link> version);</programlisting>
<para>
Get the string representation of the given <parameter>version</parameter> id. This function
will return <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>version</parameter> isn't valid. See <link linkend="cairo-svg-get-versions"><function>cairo_svg_get_versions()</function></link>
for a way to get the list of valid version ids.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>version</parameter>&nbsp;:</term>
<listitem><simpara> a version id
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the string associated to given version.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  1.2
</para></refsect2>

</refsect1>



<refsect1>
<title>See Also</title>
<para>
<itemizedlist>
<listitem>#<link linkend="cairo-surface-t"><function>cairo_surface_t()</function></link></listitem>
</itemizedlist>
</para>
</refsect1>


<refsect1><refsect2 /><refsect2 /></refsect1>
</refentry>
