Name
CRC.setTransform() — sets the transformation matrix
Synopsis
void setTransform(floata
, floatb
, floatc
, floatd
, floate
, floatf
)
Arguments
a
,
b
,
c
,
d
,
e
,
f
Six elements of a 3 × 3 affine transformation matrix
Description
This method allows you to set the current transformation matrix
directly rather than through a series of calls to
translate()
, scale()
, and
rotate()
. After calling this method, the new
transformation is:
x' a c e x = ax + cy + e y' = b d f × y = bx + dy + f 1 0 0 1 1
Example
You can temporarily reset the transformation of a context
c
to the identity transform, so that you can work
with raw canvas coordinates, using code like this:
c.save(); // Save current transform c.setTransform(1,0,0,1,0,0); // Set identity transform /* Now use raw canvas coordinates here */ c.restore(); // Revert to old transform
See Also
Get Canvas Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.