jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: Script Surfaces: Cairo: A Vector Graphics Library jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68: jpayne@68: jpayne@68:
jpayne@68:

Script Surfaces

jpayne@68:

Script Surfaces — Rendering to replayable scripts

jpayne@68:
jpayne@68:
jpayne@68:

Functions

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68: cairo_device_t * jpayne@68: jpayne@68: cairo_script_create () jpayne@68:
jpayne@68: cairo_device_t * jpayne@68: jpayne@68: cairo_script_create_for_stream () jpayne@68:
jpayne@68: cairo_status_t jpayne@68: jpayne@68: cairo_script_from_recording_surface () jpayne@68:
jpayne@68: cairo_script_mode_t jpayne@68: jpayne@68: cairo_script_get_mode () jpayne@68:
jpayne@68: void jpayne@68: jpayne@68: cairo_script_set_mode () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_script_surface_create () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_script_surface_create_for_target () jpayne@68:
jpayne@68: void jpayne@68: jpayne@68: cairo_script_write_comment () jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

Types and Values

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
#defineCAIRO_HAS_SCRIPT_SURFACE
enumcairo_script_mode_t
jpayne@68:
jpayne@68:
jpayne@68:

Description

jpayne@68:

The script surface provides the ability to render to a native jpayne@68: script that matches the cairo drawing model. The scripts can jpayne@68: be replayed using tools under the util/cairo-script directory, jpayne@68: or with cairo-perf-trace.

jpayne@68:
jpayne@68:
jpayne@68:

Functions

jpayne@68:
jpayne@68:

cairo_script_create ()

jpayne@68:
cairo_device_t *
jpayne@68: cairo_script_create (const char *filename);
jpayne@68:

Creates a output device for emitting the script, used when jpayne@68: creating the individual surfaces.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

filename

the name (path) of the file to write the script to

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

a pointer to the newly created device. The caller jpayne@68: owns the surface and should call cairo_device_destroy() when done jpayne@68: with it.

jpayne@68:

This function always returns a valid pointer, but it will return a jpayne@68: pointer to a "nil" device if an error such as out of memory jpayne@68: occurs. You can use cairo_device_status() to check for this.

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_create_for_stream ()

jpayne@68:
cairo_device_t *
jpayne@68: cairo_script_create_for_stream (cairo_write_func_t write_func,
jpayne@68:                                 void *closure);
jpayne@68:

Creates a output device for emitting the script, used when jpayne@68: creating the individual surfaces.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

write_func

callback function passed the bytes written to the script

 

closure

user data to be passed to the callback

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

a pointer to the newly created device. The caller jpayne@68: owns the surface and should call cairo_device_destroy() when done jpayne@68: with it.

jpayne@68:

This function always returns a valid pointer, but it will return a jpayne@68: pointer to a "nil" device if an error such as out of memory jpayne@68: occurs. You can use cairo_device_status() to check for this.

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_from_recording_surface ()

jpayne@68:
cairo_status_t
jpayne@68: cairo_script_from_recording_surface (cairo_device_t *script,
jpayne@68:                                      cairo_surface_t *recording_surface);
jpayne@68:

Converts the record operations in recording_surface jpayne@68: into a script.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

script

the script (output device)

 

recording_surface

the recording surface to replay

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

CAIRO_STATUS_SUCCESS on successful completion or an error code.

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_get_mode ()

jpayne@68:
cairo_script_mode_t
jpayne@68: cairo_script_get_mode (cairo_device_t *script);
jpayne@68:

Queries the script for its current output mode.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

script

The script (output device) to query

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the current output mode of the script

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_set_mode ()

jpayne@68:
void
jpayne@68: cairo_script_set_mode (cairo_device_t *script,
jpayne@68:                        cairo_script_mode_t mode);
jpayne@68:

Change the output mode of the script

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

script

The script (output device)

 

mode

the new mode

 
jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_surface_create ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_script_surface_create (cairo_device_t *script,
jpayne@68:                              cairo_content_t content,
jpayne@68:                              double width,
jpayne@68:                              double height);
jpayne@68:

Create a new surface that will emit its rendering through script jpayne@68:

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

script

the script (output device)

 

content

the content of the surface

 

width

width in pixels

 

height

height in pixels

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

a pointer to the newly created surface. The caller jpayne@68: owns the surface and should call cairo_surface_destroy() when done jpayne@68: with it.

jpayne@68:

This function always returns a valid pointer, but it will return a jpayne@68: pointer to a "nil" surface if an error such as out of memory jpayne@68: occurs. You can use cairo_surface_status() to check for this.

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_surface_create_for_target ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_script_surface_create_for_target
jpayne@68:                                (cairo_device_t *script,
jpayne@68:                                 cairo_surface_t *target);
jpayne@68:

Create a pxoy surface that will render to target jpayne@68: and record jpayne@68: the operations to device jpayne@68: .

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

script

the script (output device)

 

target

a target surface to wrap

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

a pointer to the newly created surface. The caller jpayne@68: owns the surface and should call cairo_surface_destroy() when done jpayne@68: with it.

jpayne@68:

This function always returns a valid pointer, but it will return a jpayne@68: pointer to a "nil" surface if an error such as out of memory jpayne@68: occurs. You can use cairo_surface_status() to check for this.

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_script_write_comment ()

jpayne@68:
void
jpayne@68: cairo_script_write_comment (cairo_device_t *script,
jpayne@68:                             const char *comment,
jpayne@68:                             int len);
jpayne@68:

Emit a string verbatim into the script.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

script

the script (output device)

 

comment

the string to emit

 

len

the length of the sting to write, or -1 to use strlen()

 
jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

Types and Values

jpayne@68:
jpayne@68:

CAIRO_HAS_SCRIPT_SURFACE

jpayne@68:
#define CAIRO_HAS_SCRIPT_SURFACE 1
jpayne@68: 
jpayne@68:

Defined if the script surface backend is available. jpayne@68: The script surface backend is always built in since 1.12.

jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

enum cairo_script_mode_t

jpayne@68:

A set of script output variants.

jpayne@68:
jpayne@68:

Members

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

CAIRO_SCRIPT_MODE_ASCII

jpayne@68:

the output will be in readable text (default). (Since 1.12)

jpayne@68:
 

CAIRO_SCRIPT_MODE_BINARY

jpayne@68:

the output will use byte codes. (Since 1.12)

jpayne@68:
 
jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

See Also

jpayne@68:

cairo_surface_t

jpayne@68:
jpayne@68:
jpayne@68: jpayne@68: jpayne@68: