Package: cairo

Function cairo:create

Lambda List

cairo:create (target)

Arguments

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

Return Value

The newly allocated cairo:context-t instance.

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 Cairo context. If memory cannot be allocated, a special Cairo context will be returned on which the cairo:status function returns the :no-memory value. If you attempt to target a surface which does not support writing, then a :write-error value 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

2025-1-2