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

with-graphics-post-translation Macro

Summary

Like with-graphics-translation except that the translation is done after applying all existing transforms.

Package

graphics-ports

Signature

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

Arguments
port
A graphics port.
dx
A real number.
dy
A real number.
body
Lisp forms.
Values
result
The value returned by the last form of body.
Description

The macro with-graphics-post-translation is the same as with-graphics-translation, but the translation of (dx, dy) is done after applying all existing transforms. That means that the translation is "absolute", not transformed. In contrast, when using with-graphics-translation the translation is transformed by any existing transform(s).

The forms in body are evaluated as an implicit progn with the new transform bound to port.

Examples

This form draws a 40x40 rectangle at (100,100), because the scale is applied to the coordinates of the rectangle, but not to the translation.

(gp:with-graphics-scale (port 2 2)
  (gp:with-graphics-post-translation (port 100 100)
    (gp:draw-rectangle port 0 0 20 20)))

Compare with this form, using with-graphics-translation instead, which draws a 40x40 rectangle at (200,200), because the scale applies to the translation too:

(gp:with-graphics-scale (port 2 2)
  (gp:with-graphics-translation (port 100 100)
    (gp:draw-rectangle port 0 0 20 20)))
See also

with-graphics-transform-reset
with-graphics-translation
13.3.1 Setting the graphics state


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