Package: cairo

Function cairo:surface-device-offset

Lambda List

cairo:surface-device-offset (surface)

Syntax

(cairo:surface-device-offset surface) => xoffset, yoffset
(setf (cairo:surface-device-offset surface) (list xoffset yoffset))

Arguments

surface -- a cairo:surface-t instance
xoffset -- a number coerced to a double float for the offset in the x direction, in device units
yoffset -- a number coerced to a double float for the offset in the y direction, in device units

Details

The cairo:surface-device-offset functions returns the device offset. The (setf cairo:surface-device-offset) function sets an offset that is added to the device coordinates determined by the current transformation matrix CTM when drawing to surface.

One use case for this function is when we want to create a cairo:surface-t instance that redirects drawing for a portion of an onscreen surface to an offscreen surface in a way that is completely invisible to the user of the Cairo API. Setting a transformation via the cairo:translate function is not sufficient to do this, since functions like the cairo:device-to-user function will expose the hidden offset.

Note that the offset affects drawing to the surface as well as using the surface in a source pattern.
 

See also

2025-1-18