All Manuals > CAPI User Guide and Reference Manual > 22 GRAPHICS-PORTS Reference Entries

with-graphics-rotation

with-graphics-scale

with-graphics-translation Macros

Summary

Combines a transformation (rotation, scaling or translation) with the transform of a port for the duration of the macro.

Package

graphics-ports

Signatures

with-graphics-rotation (port angle) &body body => result

with-graphics-scale (port sx sy) &body body => result

with-graphics-translation (port dx dy) &body body => result

Arguments
port
A graphics port.
angle
A real number.
body
A body of Lisp code.
sx, sy
Real numbers.
dx, dy
Real numbers.
Values
result
The return value(s) of the last form executed in body.
Description

The macros with-graphics-rotation, with-graphics-scale and with-graphics-translation combine the transform associated with port with an additional transform while evaluated the forms in body as an implicit progn. port is given a new transform obtained by pre-multiplying its current transform with the transform that the macro creates.

with-graphics-rotation creates a transformation that rotates by angle radians. If angle is positive, then the rotation is clockwise.

with-graphics-scale creates a transformation that scales by sx and sy in the X and Y dimensions.

with-graphics-translation creates a transformation that translates by dx and dy in the X and Y dimensions.

Notes
  1. These macros do the same as with-graphics-transform does with an appropriate transform.
  2. The transform associated with a graphics port is part of the port's graphics state. See graphics-state for details.
Examples
(example-edit-file "capi/graphics/catherine-wheel")
See also

graphics-state
with-graphics-post-translation
with-graphics-transform
13.6 Graphics state transforms
13.3.1 Setting the graphics state


CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:44