1. Coordinate Transformations
Commands for coordinate system transformations and matrix operations.
1.1. Overview
The PostScript coordinate transformation system provides powerful tools for manipulating the coordinate space in which graphics are drawn. These commands fall into three main categories:
1.1.2. Matrix Operations
-
matrix- Create identity matrix -
identmatrix- Replace matrix with identity -
defaultmatrix- Get device default matrix -
currentmatrix- Get current transformation matrix -
setmatrix- Replace CTM with matrix -
initmatrix- Reset CTM to default -
concatmatrix- Multiply two matrices -
invertmatrix- Invert a matrix
1.1.3. Coordinate Transformations
-
transform- Transform user→device coordinates -
itransform- Transform device→user coordinates -
dtransform- Transform distance vector -
idtransform- Inverse transform distance vector
1.2. Transformation Matrix
PostScript uses a 6-element matrix to represent coordinate transformations:
[a b c d tx ty]
This matrix transforms coordinates according to:
x' = a×x + c×y + tx y' = b×x + d×y + ty
Where:
-
a,d- Scaling factors in x and y -
b,c- Rotation/skewing components -
tx,ty- Translation components
The identity matrix is [1 0 0 1 0 0].
1.3. Current Transformation Matrix (CTM)
The CTM maps user space coordinates to device space coordinates. It is part of the graphics state and is affected by: