<?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-Script-Surfaces">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-Script-Surfaces.top_of_page">Script Surfaces</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Script Surfaces</refname>
<refpurpose>Rendering to replayable scripts</refpurpose>
</refnamediv>

<refsect1 id="cairo-Script-Surfaces.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="function_type"><link linkend="cairo-device-t"><returnvalue>cairo_device_t</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="cairo-script-create">cairo_script_create</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="cairo-device-t"><returnvalue>cairo_device_t</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="cairo-script-create-for-stream">cairo_script_create_for_stream</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="cairo-status-t"><returnvalue>cairo_status_t</returnvalue></link>
</entry><entry role="function_name"><link linkend="cairo-script-from-recording-surface">cairo_script_from_recording_surface</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="cairo-script-mode-t"><returnvalue>cairo_script_mode_t</returnvalue></link>
</entry><entry role="function_name"><link linkend="cairo-script-get-mode">cairo_script_get_mode</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="cairo-script-set-mode">cairo_script_set_mode</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="cairo-script-surface-create">cairo_script_surface_create</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="cairo-script-surface-create-for-target">cairo_script_surface_create_for_target</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="cairo-script-write-comment">cairo_script_write_comment</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="cairo-Script-Surfaces.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="name" colwidth="150px"/>
<colspec colname="description"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="CAIRO-HAS-SCRIPT-SURFACE:CAPS">CAIRO_HAS_SCRIPT_SURFACE</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="cairo-script-mode-t">cairo_script_mode_t</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>


<refsect1 id="cairo-Script-Surfaces.description" role="desc">
<title role="desc.title">Description</title>
<para>The script surface provides the ability to render to a native
script that matches the cairo drawing model. The scripts can
be replayed using tools under the util/cairo-script directory,
or with cairo-perf-trace.</para>

</refsect1>
<refsect1 id="cairo-Script-Surfaces.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="cairo-script-create" role="function" condition="since:1.12">
<title>cairo_script_create&#160;()</title>
<indexterm zone="cairo-script-create" role="1.12"><primary sortas="script_create">cairo_script_create</primary></indexterm>
<programlisting language="C"><link linkend="cairo-device-t"><returnvalue>cairo_device_t</returnvalue></link>&#160;*
cairo_script_create (<parameter>const <link linkend="char"><type>char</type></link> *filename</parameter>);</programlisting>
<para>Creates a output device for emitting the script, used when
creating the individual surfaces.</para>
<refsect3 id="cairo-script-create.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>the name (path) of the file to write the script to</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-script-create.returns" role="returns">
<title>Returns</title>
<para> a pointer to the newly created device. The caller
owns the surface and should call <link linkend="cairo-device-destroy"><function>cairo_device_destroy()</function></link> when done
with it.</para>
<para>This function always returns a valid pointer, but it will return a
pointer to a "nil" device if an error such as out of memory
occurs. You can use <link linkend="cairo-device-status"><function>cairo_device_status()</function></link> to check for this.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-create-for-stream" role="function" condition="since:1.12">
<title>cairo_script_create_for_stream&#160;()</title>
<indexterm zone="cairo-script-create-for-stream" role="1.12"><primary sortas="script_create_for_stream">cairo_script_create_for_stream</primary></indexterm>
<programlisting language="C"><link linkend="cairo-device-t"><returnvalue>cairo_device_t</returnvalue></link>&#160;*
cairo_script_create_for_stream (<parameter><link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link> write_func</parameter>,
                                <parameter><link linkend="void"><type>void</type></link> *closure</parameter>);</programlisting>
<para>Creates a output device for emitting the script, used when
creating the individual surfaces.</para>
<refsect3 id="cairo-script-create-for-stream.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>write_func</para></entry>
<entry role="parameter_description"><para>callback function passed the bytes written to the script</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>closure</para></entry>
<entry role="parameter_description"><para>user data to be passed to the callback</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-script-create-for-stream.returns" role="returns">
<title>Returns</title>
<para> a pointer to the newly created device. The caller
owns the surface and should call <link linkend="cairo-device-destroy"><function>cairo_device_destroy()</function></link> when done
with it.</para>
<para>This function always returns a valid pointer, but it will return a
pointer to a "nil" device if an error such as out of memory
occurs. You can use <link linkend="cairo-device-status"><function>cairo_device_status()</function></link> to check for this.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-from-recording-surface" role="function" condition="since:1.12">
<title>cairo_script_from_recording_surface&#160;()</title>
<indexterm zone="cairo-script-from-recording-surface" role="1.12"><primary sortas="script_from_recording_surface">cairo_script_from_recording_surface</primary></indexterm>
<programlisting language="C"><link linkend="cairo-status-t"><returnvalue>cairo_status_t</returnvalue></link>
cairo_script_from_recording_surface (<parameter><link linkend="cairo-device-t"><type>cairo_device_t</type></link> *script</parameter>,
                                     <parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *recording_surface</parameter>);</programlisting>
<para>Converts the record operations in <parameter>recording_surface</parameter>
 into a script.</para>
<refsect3 id="cairo-script-from-recording-surface.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>script</para></entry>
<entry role="parameter_description"><para>the script (output device)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>recording_surface</para></entry>
<entry role="parameter_description"><para>the recording surface to replay</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-script-from-recording-surface.returns" role="returns">
<title>Returns</title>
<para> <link linkend="CAIRO-STATUS-SUCCESS:CAPS"><type>CAIRO_STATUS_SUCCESS</type></link> on successful completion or an error code.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-get-mode" role="function" condition="since:1.12">
<title>cairo_script_get_mode&#160;()</title>
<indexterm zone="cairo-script-get-mode" role="1.12"><primary sortas="script_get_mode">cairo_script_get_mode</primary></indexterm>
<programlisting language="C"><link linkend="cairo-script-mode-t"><returnvalue>cairo_script_mode_t</returnvalue></link>
cairo_script_get_mode (<parameter><link linkend="cairo-device-t"><type>cairo_device_t</type></link> *script</parameter>);</programlisting>
<para>Queries the script for its current output mode.</para>
<refsect3 id="cairo-script-get-mode.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>script</para></entry>
<entry role="parameter_description"><para>The script (output device) to query</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-script-get-mode.returns" role="returns">
<title>Returns</title>
<para> the current output mode of the script</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-set-mode" role="function" condition="since:1.12">
<title>cairo_script_set_mode&#160;()</title>
<indexterm zone="cairo-script-set-mode" role="1.12"><primary sortas="script_set_mode">cairo_script_set_mode</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
cairo_script_set_mode (<parameter><link linkend="cairo-device-t"><type>cairo_device_t</type></link> *script</parameter>,
                       <parameter><link linkend="cairo-script-mode-t"><type>cairo_script_mode_t</type></link> mode</parameter>);</programlisting>
<para>Change the output mode of the script</para>
<refsect3 id="cairo-script-set-mode.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>script</para></entry>
<entry role="parameter_description"><para>The script (output device)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>the new mode</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-surface-create" role="function" condition="since:1.12">
<title>cairo_script_surface_create&#160;()</title>
<indexterm zone="cairo-script-surface-create" role="1.12"><primary sortas="script_surface_create">cairo_script_surface_create</primary></indexterm>
<programlisting language="C"><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link>&#160;*
cairo_script_surface_create (<parameter><link linkend="cairo-device-t"><type>cairo_device_t</type></link> *script</parameter>,
                             <parameter><link linkend="cairo-content-t"><type>cairo_content_t</type></link> content</parameter>,
                             <parameter><link linkend="double"><type>double</type></link> width</parameter>,
                             <parameter><link linkend="double"><type>double</type></link> height</parameter>);</programlisting>
<para>Create a new surface that will emit its rendering through <parameter>script</parameter>
</para>
<refsect3 id="cairo-script-surface-create.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>script</para></entry>
<entry role="parameter_description"><para>the script (output device)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>content</para></entry>
<entry role="parameter_description"><para>the content of the surface</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>width</para></entry>
<entry role="parameter_description"><para>width in pixels</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>height</para></entry>
<entry role="parameter_description"><para>height in pixels</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-script-surface-create.returns" role="returns">
<title>Returns</title>
<para> 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.</para>
<para>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.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-surface-create-for-target" role="function" condition="since:1.12">
<title>cairo_script_surface_create_for_target&#160;()</title>
<indexterm zone="cairo-script-surface-create-for-target" role="1.12"><primary sortas="script_surface_create_for_target">cairo_script_surface_create_for_target</primary></indexterm>
<programlisting language="C"><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link>&#160;*
cairo_script_surface_create_for_target
                               (<parameter><link linkend="cairo-device-t"><type>cairo_device_t</type></link> *script</parameter>,
                                <parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *target</parameter>);</programlisting>
<para>Create a pxoy surface that will render to <parameter>target</parameter>
 and record
the operations to <parameter>device</parameter>
.</para>
<refsect3 id="cairo-script-surface-create-for-target.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>script</para></entry>
<entry role="parameter_description"><para>the script (output device)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>target</para></entry>
<entry role="parameter_description"><para>a target surface to wrap</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="cairo-script-surface-create-for-target.returns" role="returns">
<title>Returns</title>
<para> 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.</para>
<para>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.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-write-comment" role="function" condition="since:1.12">
<title>cairo_script_write_comment&#160;()</title>
<indexterm zone="cairo-script-write-comment" role="1.12"><primary sortas="script_write_comment">cairo_script_write_comment</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
cairo_script_write_comment (<parameter><link linkend="cairo-device-t"><type>cairo_device_t</type></link> *script</parameter>,
                            <parameter>const <link linkend="char"><type>char</type></link> *comment</parameter>,
                            <parameter><link linkend="int"><type>int</type></link> len</parameter>);</programlisting>
<para>Emit a string verbatim into the script.</para>
<refsect3 id="cairo-script-write-comment.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>script</para></entry>
<entry role="parameter_description"><para>the script (output device)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>comment</para></entry>
<entry role="parameter_description"><para>the string to emit</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>len</para></entry>
<entry role="parameter_description"><para>the length of the sting to write, or -1 to use <link linkend="strlen"><function>strlen()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>

</refsect1>
<refsect1 id="cairo-Script-Surfaces.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="CAIRO-HAS-SCRIPT-SURFACE:CAPS" role="macro" condition="since:1.12">
<title>CAIRO_HAS_SCRIPT_SURFACE</title>
<indexterm zone="CAIRO-HAS-SCRIPT-SURFACE:CAPS" role="1.12"><primary sortas="HAS_SCRIPT_SURFACE">CAIRO_HAS_SCRIPT_SURFACE</primary></indexterm>
<programlisting language="C">#define CAIRO_HAS_SCRIPT_SURFACE 1
</programlisting>
<para>Defined if the script surface backend is available.
The script surface backend is always built in since 1.12.</para>
<para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>
<refsect2 id="cairo-script-mode-t" role="enum" condition="since:1.12">
<title>enum cairo_script_mode_t</title>
<indexterm zone="cairo-script-mode-t" role="1.12"><primary sortas="script_mode_t">cairo_script_mode_t</primary></indexterm>
<para>A set of script output variants.</para>
<refsect3 id="cairo-script-mode-t.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="CAIRO-SCRIPT-MODE-ASCII:CAPS">CAIRO_SCRIPT_MODE_ASCII</para></entry>
<entry role="enum_member_description"><para>the output will be in readable text (default). (Since 1.12)</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="CAIRO-SCRIPT-MODE-BINARY:CAPS">CAIRO_SCRIPT_MODE_BINARY</para></entry>
<entry role="enum_member_description"><para>the output will use byte codes. (Since 1.12)</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.12">1.12</link></para></refsect2>

</refsect1>
<refsect1 id="cairo-Script-Surfaces.see-also">
<title>See Also</title>
<para><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link></para>

</refsect1>

</refentry>
