Current File : //proc/self/root/kunden/usr/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-cairo.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Using RSVG with cairo: Librsvg Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Librsvg Reference Manual">
<link rel="up" href="rsvg.html" title="Part I. API Reference">
<link rel="prev" href="rsvg-Using-RSVG-with-GIO.html" title="Using RSVG with GIO">
<link rel="next" href="rsvg-Using-RSVG-with-GdkPixbuf.html" title="Using RSVG with GdkPixbuf">
<meta name="generator" content="GTK-Doc V1.32 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#rsvg-Using-RSVG-with-cairo.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="rsvg.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="rsvg-Using-RSVG-with-GIO.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="rsvg-Using-RSVG-with-GdkPixbuf.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="rsvg-Using-RSVG-with-cairo"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="rsvg-Using-RSVG-with-cairo.top_of_page"></a>Using RSVG with cairo</span></h2>
<p>Using RSVG with cairo</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="rsvg-Using-RSVG-with-cairo.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-get-intrinsic-dimensions" title="rsvg_handle_get_intrinsic_dimensions ()">rsvg_handle_get_intrinsic_dimensions</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-document" title="rsvg_handle_render_document ()">rsvg_handle_render_document</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-get-geometry-for-layer" title="rsvg_handle_get_geometry_for_layer ()">rsvg_handle_get_geometry_for_layer</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-layer" title="rsvg_handle_render_layer ()">rsvg_handle_render_layer</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-get-geometry-for-element" title="rsvg_handle_get_geometry_for_element ()">rsvg_handle_get_geometry_for_element</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-element" title="rsvg_handle_render_element ()">rsvg_handle_render_element</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-cairo" title="rsvg_handle_render_cairo ()">rsvg_handle_render_cairo</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-cairo-sub" title="rsvg_handle_render_cairo_sub ()">rsvg_handle_render_cairo_sub</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="rsvg-Using-RSVG-with-cairo.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="rsvg-Using-RSVG-with-cairo.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="rsvg-handle-get-intrinsic-dimensions"></a><h3>rsvg_handle_get_intrinsic_dimensions ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
rsvg_handle_get_intrinsic_dimensions (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> *out_has_width</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgLength" title="RsvgLength"><span class="type">RsvgLength</span></a> *out_width</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> *out_has_height</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgLength" title="RsvgLength"><span class="type">RsvgLength</span></a> *out_height</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> *out_has_viewbox</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *out_viewbox</code></em>);</pre>
<p>Queries the <code class="literal">width</code>, <code class="literal">height</code>, and
<code class="literal">viewBox</code> attributes in an SVG document.</p>
<p>If you are calling this function to compute a scaling factor to render the SVG,
consider simply using <a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-document" title="rsvg_handle_render_document ()"><code class="function">rsvg_handle_render_document()</code></a> instead; it will do the
scaling computations automatically.</p>
<p>As an example, the following SVG element has a <code class="literal">width</code> of 100 pixels and a <code class="literal">height</code> of 400 pixels, but no <code class="literal">viewBox</code>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="o"><</span><span class="n">svg</span> <span class="n">xmlns</span><span class="o">=</span><span class="s">"http://www.w3.org/2000/svg"</span> <span class="n">width</span><span class="o">=</span><span class="s">"100"</span> <span class="n">height</span><span class="o">=</span><span class="s">"400"</span><span class="o">></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>Conversely, the following element has a <code class="literal">viewBox</code>, but no <code class="literal">width</code> or <code class="literal">height</code>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="o"><</span><span class="n">svg</span> <span class="n">xmlns</span><span class="o">=</span><span class="s">"http://www.w3.org/2000/svg"</span> <span class="n">viewBox</span><span class="o">=</span><span class="s">"0 0 100 400"</span><span class="o">></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>Note that the <a class="link" href="RsvgHandle.html#RsvgLength" title="RsvgLength"><span class="type">RsvgLength</span></a> return values have <a href="RsvgHandle.html#RsvgUnit"><span class="type">RsvgUnits</span></a> in them; you should
not assume that they are always in pixels. For example, the following SVG element
will return a width value whose <code class="literal">units</code> field is RSVG_UNIT_MM.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="o"><</span><span class="n">svg</span> <span class="n">xmlns</span><span class="o">=</span><span class="s">"http://www.w3.org/2000/svg"</span> <span class="n">width</span><span class="o">=</span><span class="s">"210mm"</span> <span class="n">height</span><span class="o">=</span><span class="s">"297mm"</span><span class="o">></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>API ordering: This function must be called on a fully-loaded <em class="parameter"><code>handle</code></em>
. See
the section <a class="ulink" href="#API-ordering" target="_top">API ordering</a> for details.</p>
<p>Panics: this function will panic if the <em class="parameter"><code>handle</code></em>
is not fully-loaded.</p>
<div class="refsect3">
<a name="rsvg-handle-get-intrinsic-dimensions.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>An <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out_has_width</p></td>
<td class="parameter_description"><p>Will be set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><span class="type">TRUE</span></a> if the toplevel SVG has a <code class="literal">width</code> attribute. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_width</p></td>
<td class="parameter_description"><p>Will be set to the value of the <code class="literal">width</code> attribute in the toplevel SVG. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_has_height</p></td>
<td class="parameter_description"><p>Will be set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><span class="type">TRUE</span></a> if the toplevel SVG has a <code class="literal">height</code> attribute. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_height</p></td>
<td class="parameter_description"><p>Will be set to the value of the <code class="literal">height</code> attribute in the toplevel SVG. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_has_viewbox</p></td>
<td class="parameter_description"><p>Will be set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><span class="type">TRUE</span></a> if the toplevel SVG has a <code class="literal">viewBox</code> attribute. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_viewbox</p></td>
<td class="parameter_description"><p>Will be set to the value of the <code class="literal">viewBox</code> attribute in the toplevel SVG. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-render-document"></a><h3>rsvg_handle_render_document ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_render_document (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
<em class="parameter"><code>const <a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *viewport</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Renders the whole SVG document fitted to a viewport.</p>
<p>The <em class="parameter"><code>viewport</code></em>
gives the position and size at which the whole SVG
document will be rendered.</p>
<p>The <em class="parameter"><code>cr</code></em>
must be in a <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS"><span class="type">CAIRO_STATUS_SUCCESS</span></a> state, or this function will not
render anything, and instead will return an error.</p>
<p>API ordering: This function must be called on a fully-loaded <em class="parameter"><code>handle</code></em>
. See
the section <a class="ulink" href="#API-ordering" target="_top">API ordering</a> for details.</p>
<p>Panics: this function will panic if the <em class="parameter"><code>handle</code></em>
is not fully-loaded.</p>
<div class="refsect3">
<a name="rsvg-handle-render-document.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>An <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cr</p></td>
<td class="parameter_description"><p>A Cairo context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>viewport</p></td>
<td class="parameter_description"><p>Viewport size at which the whole SVG would be fitted.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a location to store a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-get-geometry-for-layer"></a><h3>rsvg_handle_get_geometry_for_layer ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_get_geometry_for_layer (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *id</code></em>,
<em class="parameter"><code>const <a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *viewport</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *out_ink_rect</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *out_logical_rect</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Computes the ink rectangle and logical rectangle of an SVG element, or the
whole SVG, as if the whole SVG were rendered to a specific viewport.</p>
<p>Element IDs should look like an URL fragment identifier; for example, pass
"#<span class="type">foo</span>" (hash <code class="literal">foo</code>) to get the geometry of the element that
has an <code class="literal">id="foo"</code> attribute.</p>
<p>The "ink rectangle" is the bounding box that would be painted
for fully- stroked and filled elements.</p>
<p>The "logical rectangle" just takes into account the unstroked
paths and text outlines.</p>
<p>Note that these bounds are not minimum bounds; for example,
clipping paths are not taken into account.</p>
<p>You can pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> for the <em class="parameter"><code>id</code></em>
if you want to measure all
the elements in the SVG, i.e. to measure everything from the
root element.</p>
<p>This operation is not constant-time, as it involves going through all
the child elements.</p>
<p>API ordering: This function must be called on a fully-loaded <em class="parameter"><code>handle</code></em>
. See
the section <a class="ulink" href="#API-ordering" target="_top">API ordering</a> for details.</p>
<p>Panics: this function will panic if the <em class="parameter"><code>handle</code></em>
is not fully-loaded.</p>
<div class="refsect3">
<a name="rsvg-handle-get-geometry-for-layer.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>An <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>An element's id within the SVG, starting with "##" (a single
hash character), for example, "#<span class="type">layer1</span>". This notation corresponds to a
URL's fragment ID. Alternatively, pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to compute the geometry for the
whole SVG. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>viewport</p></td>
<td class="parameter_description"><p>Viewport size at which the whole SVG would be fitted.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out_ink_rect</p></td>
<td class="parameter_description"><p>Place to store the ink rectangle of the element. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_logical_rect</p></td>
<td class="parameter_description"><p>Place to store the logical rectangle of the element. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a location to store a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-render-layer"></a><h3>rsvg_handle_render_layer ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_render_layer (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *id</code></em>,
<em class="parameter"><code>const <a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *viewport</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Renders a single SVG element in the same place as for a whole SVG document.</p>
<p>This is equivalent to <a class="link" href="rsvg-Using-RSVG-with-cairo.html#rsvg-handle-render-document" title="rsvg_handle_render_document ()"><code class="function">rsvg_handle_render_document()</code></a>, but it renders only a
single element and its children, as if they composed an individual layer in
the SVG. The element is rendered with the same transformation matrix as it
has within the whole SVG document. Applications can use this to re-render a
single element and repaint it on top of a previously-rendered document, for
example.</p>
<p>Element IDs should look like an URL fragment identifier; for example, pass
"#<span class="type">foo</span>" (hash <code class="literal">foo</code>) to get the geometry of the element that
has an <code class="literal">id="foo"</code> attribute.</p>
<p>You can pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> for the <em class="parameter"><code>id</code></em>
if you want to render all
the elements in the SVG, i.e. to render everything from the
root element.</p>
<p>API ordering: This function must be called on a fully-loaded <em class="parameter"><code>handle</code></em>
. See
the section <a class="ulink" href="#API-ordering" target="_top">API ordering</a> for details.</p>
<p>Panics: this function will panic if the <em class="parameter"><code>handle</code></em>
is not fully-loaded.</p>
<div class="refsect3">
<a name="rsvg-handle-render-layer.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>An <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cr</p></td>
<td class="parameter_description"><p>A Cairo context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>An element's id within the SVG, starting with "##" (a single
hash character), for example, "#<span class="type">layer1</span>". This notation corresponds to a
URL's fragment ID. Alternatively, pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to render the whole SVG document tree. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>viewport</p></td>
<td class="parameter_description"><p>Viewport size at which the whole SVG would be fitted.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a location to store a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-get-geometry-for-element"></a><h3>rsvg_handle_get_geometry_for_element ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_get_geometry_for_element (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *id</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *out_ink_rect</code></em>,
<em class="parameter"><code><a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *out_logical_rect</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Computes the ink rectangle and logical rectangle of a single SVG element.</p>
<p>While <code class="literal">rsvg_handle_get_geometry_for_layer</code> computes the geometry of an SVG element subtree with
its transformation matrix, this other function will compute the element's geometry
as if it were being rendered under an identity transformation by itself. That is,
the resulting geometry is as if the element got extracted by itself from the SVG.</p>
<p>This function is the counterpart to <code class="literal">rsvg_handle_render_element</code>.</p>
<p>Element IDs should look like an URL fragment identifier; for example, pass
"#<span class="type">foo</span>" (hash <code class="literal">foo</code>) to get the geometry of the element that
has an <code class="literal">id="foo"</code> attribute.</p>
<p>The "ink rectangle" is the bounding box that would be painted
for fully- stroked and filled elements.</p>
<p>The "logical rectangle" just takes into account the unstroked
paths and text outlines.</p>
<p>Note that these bounds are not minimum bounds; for example,
clipping paths are not taken into account.</p>
<p>You can pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> for the <em class="parameter"><code>id</code></em>
if you want to measure all
the elements in the SVG, i.e. to measure everything from the
root element.</p>
<p>This operation is not constant-time, as it involves going through all
the child elements.</p>
<p>API ordering: This function must be called on a fully-loaded <em class="parameter"><code>handle</code></em>
. See
the section <a class="ulink" href="#API-ordering" target="_top">API ordering</a> for details.</p>
<p>Panics: this function will panic if the <em class="parameter"><code>handle</code></em>
is not fully-loaded.</p>
<div class="refsect3">
<a name="rsvg-handle-get-geometry-for-element.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>An <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>An element's id within the SVG, starting with "##" (a single
hash character), for example, "#<span class="type">layer1</span>". This notation corresponds to a
URL's fragment ID. Alternatively, pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to compute the geometry for the
whole SVG. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_ink_rect</p></td>
<td class="parameter_description"><p>Place to store the ink rectangle of the element. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_logical_rect</p></td>
<td class="parameter_description"><p>Place to store the logical rectangle of the element. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a location to store a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-render-element"></a><h3>rsvg_handle_render_element ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_render_element (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *id</code></em>,
<em class="parameter"><code>const <a class="link" href="RsvgHandle.html#RsvgRectangle" title="struct RsvgRectangle"><span class="type">RsvgRectangle</span></a> *element_viewport</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Renders a single SVG element to a given viewport</p>
<p>This function can be used to extract individual element subtrees and render them,
scaled to a given <em class="parameter"><code>element_viewport</code></em>
. This is useful for applications which have
reusable objects in an SVG and want to render them individually; for example, an
SVG full of icons that are meant to be be rendered independently of each other.</p>
<p>Element IDs should look like an URL fragment identifier; for example, pass
"#<span class="type">foo</span>" (hash <code class="literal">foo</code>) to get the geometry of the element that
has an <code class="literal">id="foo"</code> attribute.</p>
<p>You can pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> for the <em class="parameter"><code>id</code></em>
if you want to render all
the elements in the SVG, i.e. to render everything from the
root element.</p>
<p>The <code class="literal">element_viewport</code> gives the position and size at which the named element will
be rendered. FIXME: mention proportional scaling.</p>
<p>API ordering: This function must be called on a fully-loaded <em class="parameter"><code>handle</code></em>
. See
the section <a class="ulink" href="#API-ordering" target="_top">API ordering</a> for details.</p>
<p>Panics: this function will panic if the <em class="parameter"><code>handle</code></em>
is not fully-loaded.</p>
<div class="refsect3">
<a name="rsvg-handle-render-element.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>An <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cr</p></td>
<td class="parameter_description"><p>A Cairo context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>An element's id within the SVG, starting with "##" (a single
hash character), for example, "#<span class="type">layer1</span>". This notation corresponds to a
URL's fragment ID. Alternatively, pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to render the whole SVG document tree. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>element_viewport</p></td>
<td class="parameter_description"><p>Viewport size in which to fit the element</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a location to store a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-render-cairo"></a><h3>rsvg_handle_render_cairo ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_render_cairo (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>);</pre>
<p>Draws a loaded SVG handle to a Cairo context. Drawing will occur with
respect to the <em class="parameter"><code>cr</code></em>
's current transformation: for example, if the <em class="parameter"><code>cr</code></em>
has a
rotated current transformation matrix, the whole SVG will be rotated in the
rendered version.</p>
<p>This function depends on the <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a>'s DPI to compute dimensions in
pixels, so you should call <a class="link" href="RsvgHandle.html#rsvg-handle-set-dpi" title="rsvg_handle_set_dpi ()"><code class="function">rsvg_handle_set_dpi()</code></a> beforehand.</p>
<p>Note that <em class="parameter"><code>cr</code></em>
must be a Cairo context that is not in an error state, that is,
<a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-status"><code class="function">cairo_status()</code></a> must return <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS"><span class="type">CAIRO_STATUS_SUCCESS</span></a> for it. Cairo can set a
context to be in an error state in various situations, for example, if it was
passed an invalid matrix or if it was created for an invalid surface.</p>
<div class="refsect3">
<a name="rsvg-handle-render-cairo.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>A <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cr</p></td>
<td class="parameter_description"><p>A Cairo context</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="rsvg-handle-render-cairo.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if drawing succeeded; <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="rsvg-handle-render-cairo-sub"></a><h3>rsvg_handle_render_cairo_sub ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
rsvg_handle_render_cairo_sub (<em class="parameter"><code><a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a> *handle</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *id</code></em>);</pre>
<p>Draws a subset of a loaded SVG handle to a Cairo context. Drawing will occur with
respect to the <em class="parameter"><code>cr</code></em>
's current transformation: for example, if the <em class="parameter"><code>cr</code></em>
has a
rotated current transformation matrix, the whole SVG will be rotated in the
rendered version.</p>
<p>This function depends on the <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a>'s DPI to compute dimensions in
pixels, so you should call <a class="link" href="RsvgHandle.html#rsvg-handle-set-dpi" title="rsvg_handle_set_dpi ()"><code class="function">rsvg_handle_set_dpi()</code></a> beforehand.</p>
<p>Note that <em class="parameter"><code>cr</code></em>
must be a Cairo context that is not in an error state, that is,
<a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-status"><code class="function">cairo_status()</code></a> must return <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS"><span class="type">CAIRO_STATUS_SUCCESS</span></a> for it. Cairo can set a
context to be in an error state in various situations, for example, if it was
passed an invalid matrix or if it was created for an invalid surface.</p>
<p>Element IDs should look like an URL fragment identifier; for example, pass
"#<span class="type">foo</span>" (hash <code class="literal">foo</code>) to get the geometry of the element that
has an <code class="literal">id="foo"</code> attribute.</p>
<div class="refsect3">
<a name="rsvg-handle-render-cairo-sub.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>handle</p></td>
<td class="parameter_description"><p>A <a class="link" href="RsvgHandle.html" title="RsvgHandle"><span class="type">RsvgHandle</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cr</p></td>
<td class="parameter_description"><p>A Cairo context</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>An element's id within the SVG, starting with "##" (a single
hash character), for example, "#<span class="type">layer1</span>". This notation corresponds to a
URL's fragment ID. Alternatively, pass <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to render the whole SVG. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="rsvg-handle-render-cairo-sub.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if drawing succeeded; <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.32</div>
</body>
</html>