Package: cairo

Function cairo-create

Lambda List

cairo-create (target)

Arguments

target -- a cairo-surface-t target surface for the Cairo context

Return Value

A newly allocated cairo-t context with a reference count of 1.

Details

Creates a new Cairo context with all graphics state parameters set to default values and with target as a target surface. The target surface should be constructed with a backend-specific function such as the cairo-image-surface-create function, or any other variant.

The initial reference count should be released with the cairo-destroy function when you are done using the Cairo context. This function will always return a valid pointer. If memory cannot be allocated, a special Cairo context will be returned on which the cairo-status function returns :no-memory. If you attempt to target a surface which does not support writing, then a :write-error will be raised. You can use this object normally, but no drawing will be done.

This function references target, so you can immediately call the cairo-surface-destroy function on it if you do not need to maintain a separate reference to it.
 

See also

*2021-12-12