summaryrefslogtreecommitdiff
path: root/libs/cairo-1.16.0/doc/public/xml/cairo-script.xml
blob: c535be398396ca3514c65c0c929fb1450b0b42ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<?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>