Script

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 directoriy, or with cairo-perf-trace.

Constructors

this
this(cairo_device_t* cairo_device)

Sets our main struct and passes it to the parent class

Members

Functions

fromRecordingSurface
cairo_status_t fromRecordingSurface(RecordingSurface recordingSurface)

Converts the record operations in recording_surface into a script. Since 1.12

getMode
cairo_script_mode_t getMode()

Queries the script for its current output mode. Since 1.12

getScriptStruct
cairo_device_t* getScriptStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setMode
void setMode(cairo_script_mode_t mode)

Change the output mode of the script Since 1.12

writeComment
void writeComment(string comment)

Emit a string verbatim into the script. Since 1.12

Static functions

create
Script create(string filename)

Creates a output device for emitting the script, used when creating the individual surfaces. Since 1.12

createForStream
Script createForStream(cairo_write_func_t writeFunc, void* closure)

Creates a output device for emitting the script, used when creating the individual surfaces. Since 1.12

Variables

cairo_device
cairo_device_t* cairo_device;

the main Gtk struct

Inherited Members

From Device

cairo_device
cairo_device_t* cairo_device;

the main Gtk struct

getDeviceStruct
cairo_device_t* getDeviceStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

reference
Device reference()

Increases the reference count on device by one. This prevents device from being destroyed until a matching call to Device.destroy is made. The number of references to a cairo_device_t can be get using Device.getReferenceCount. Since 1.10

destroy
void destroy()

Decreases the reference count on device by one. If the result is zero, then device and all associated resources are freed. See Device.reference. This function may acquire devices if the last reference was dropped. Since 1.10

status
cairo_status_t status()

Checks whether an error has previously occurred for this device. Since 1.10

finish
void finish()

This function finishes the device and drops all references to external resources. All surfaces, fonts and other objects created for this device will be finished, too. Further operations on the device will not affect the device but will instead trigger a CAIRO_STATUS_DEVICE_FINISHED error. When the last call to Device.destroy decreases the reference count to zero, cairo will call Device.finish if it hasn't been called already, before freeing the resources associated with the device. This function may acquire devices. Since 1.10

flush
void flush()

Finish any pending operations for the device and also restore any temporary modifications cairo has made to the device's state. This function must be called before switching from using the device with Cairo to operating on it directly with native APIs. If the device doesn't support direct access, then this function does nothing. This function may acquire devices. Since 1.10

getType
cairo_device_type_t getType()

This function returns the type of the device. See cairo_device_type_t for available types. Since 1.10

getReferenceCount
uint getReferenceCount()

Returns the current reference count of device. Since 1.10

setUserData
cairo_status_t setUserData(cairo_user_data_key_t* key, void* userData, cairo_destroy_func_t destroy)

Attach user data to device. To remove user data from a surface, call this function with the key that was used to set it and NULL for data. Since 1.10

getUserData
void* getUserData(cairo_user_data_key_t* key)

Return user data previously attached to device using the specified key. If no user data has been attached with the given key this function returns NULL. Since 1.10

acquire
cairo_status_t acquire()

Acquires the device for the current thread. This function will block until no other thread has acquired the device. If the return value is CAIRO_STATUS_SUCCESS, you successfully acquired the device. From now on your thread owns the device and no other thread will be able to acquire it until a matching call to Device.release. It is allowed to recursively acquire the device multiple times from the same thread. Note You must never acquire two different devices at the same time unless this is explicitly allowed. Otherwise the possibility of deadlocks exist. As various Cairo functions can acquire devices when called, these functions may also cause deadlocks when you call them with an acquired device. So you must not have a device acquired when calling them. These functions are marked in the documentation. Since 1.10

release
void release()

Releases a device previously acquired using Device.acquire. See that function for details. Since 1.10