Package: cairo

Macro cairo:with-matrix

Lambda List

cairo:with-matrix ((var &rest args) &body body)

Syntax

(cairo:with-matrix (matrix) body) => result
(cairo:with-matrix (matrix rad) body) => result
(cairo:with-matrix (matrix :translate tx ty) body) => result
(cairo:with-matrix (matrix :scale sx sy) body) => result
(cairo:with-matrix (matrix xx yx xy yy x0 y0) body) => result

Arguments

matrix -- a cairo:matrix-t instance to create and initialize
rad -- a number coerced to a double float for the angle of rotation, in radians
tx -- a number for the amount to tanslate in the x direction
ty -- a number for the amount to tanslate in the y direction
sx -- a number for the scale factor in the x direction
sy -- a number for the scale factor in the y direction
xx -- a number for the xx component of the transformation
yx -- a number for the yx component of the transformation
xy -- a number for the xy component of the transformation
yy -- a number for the yy component of the transformation
x0 -- a number for the x translation component of the transformation
y0 -- a number for the y translation component of the transformation

Details

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

When no argument is given the matrix is initialized to the identity transformation with the cairo:matrix-init-identity function. The initialization with one argument initializes a rotation with the cairo:matrix-init-rotate function. The initialization with three arguments initializes a translation with the cairo:matrix-init-translate function or a transformation which scales with the cairo:matrix-init-scale function. When six numbers are given the matrix is initialized with the cairo:matrix-init function.

Notes

The arguments are coerced to double floats before being passed to the foreign C functions.
 

See also

2025-1-18