We have already seen how to use a scaling transformation
with 72 72 scale
. This command scales the
x and y coordinates respectively by 72. Since PostScript starts
with its units in points, and since there are 72 points in an
inch, we have effectively converted from points to inches.
In general the command is x-scale y-scale
scale
.
Translation works similarly; the syntax is x-shift y-shift
translate
. This command shifts the origin to
(x-shift,y-shift ). The origin starts at the lower
left of the page, so if the page were 8 1/2 by 11, the command
72 72 scale 4.25 5.5 translate
would shift the
origin to the centre of the page. Notice here that we
combined two transformations - the effect is cumulative. First
we scaled so that a unit is an inch, and then we shifted to the
centre of the page using the new units.
The final transfomation is rotation. The rotate command takes a
single argument: angle rotate
. This rotates
the frame of reference counter-clockwise by angle degrees.
The current transformation is part of the graphics state, so you
can save it and restore it using the gsave
and
grestore
commands, just as you have seen with other
graphics state variables (like the line width and greylevel).
![]() |