Package: cairo

Macro cairo:with-context-for-surface

Lambda List

cairo:with-context-for-surface ((context &rest args) &body body)

Syntax

(cairo:with-context-for-surface (context target content width height) body) => result
(cairo:with-context-for-surface (context target format width height) body) => result
(cairo:with-context-for-surface (context target x y width height) body) => result

Arguments

context -- a cairo:context-t instance to create and initialize
surface -- a cairo:surface-t instance to create and initialize
target -- an existing cairo:surface-t instance used to select the backend of the new surface
content -- a cairo:content-t value for the content for the new surface
format -- a cairo:format-t value for the format of pixels in the surface to create
x -- a number coerced to a double float for the x origin of the subsurface from the top-left of the target surface, in device-space units
y -- a number coerced to a double float for the y origin of the subsurface from the top-left of the target surface, in device-space units
width -- a number coerced to a double float for the width of the subsurface, in device-space units
height -- a number coerced to a double float for the height of the subsurface, in device-space units

Details

The cairo:with-context-for-surface macro allocates a new cairo:context-t instance for a surface, initializes the Cairo context with the given values and executes the body that uses the Cairo context. After execution of the body the allocated memory for the Cairo context is released.

The context is created with the cairo:create function and destroyed with the cairo:destroy function. The context uses a surface that is created with one of the cairo:surface-create-similar, cairo:surface-create-similar-image, or cairo:surface-create-for-rectangle functions. You can access the cairo:surface-t instance for the created context with the cairo:target function. See also the cairo:with-surface macro.
 

See also

2025-1-18