Offset Var Contents
0 a x multiplier, for new x
4 b x multiplier, for new y
8 c y multiplier, for new x
12 d y multiplier, for new y
16 e x translation, in draw units
20 f y translation, in draw units
The new co-ordinates are calculated :
newx = ax + cy + e
newy = bx + dy + f
Or, in matrix form : é a b 0 ù
ê c d 0 ú
ë e f 1 û
Standard examples
Transformation examples
Rotation can be performed by using :
a = cos( angle ) b = sin ( angle )
c = - sin( angle ) d = cos ( angle )
Scaling can be performed by using :
a = scale b = 0
c = 0 d = scale
Translation can be performed by using :
e = x translation f = y translation
So to render a non-rotated 1:1 Draw file at (x, y) (screen coordinates in OS units) the transformation matrix is :
é 1 << 16 0 0 ù
ê 0 1 << 16 0 ú
ë 256 * x 256 * y 1 û
and thus
a = 1 << 16 b = 0
c = 0 d = 1 << 16
e = 256 * x f = 256 * y
|
|
|