December 2010
Intermediate to advanced
110 pages
2h 31m
English
CRC.setTransform() — sets the transformation matrix
void setTransform(floata, floatb, floatc, floatd, floate, floatf)
a,
b,
c,
d,
e,
fSix elements of a 3 × 3 affine transformation matrix
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
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
Read now
Unlock full access