tbx  0.7.3
Public Member Functions | Public Attributes | List of all members
tbx::DrawTransform Class Reference

Class to represent Drawing transforms. More...

#include <drawtransform.h>

Public Member Functions

 DrawTransform ()
 Create the identity draw transform. More...
 
void translate_os (int x, int y)
 Set transform translation in os units.
 
void translate_os_x (int x)
 Set transform translation in os units.
 
void translate_os_y (int y)
 Set transform translation in os units.
 
void scale (int scale)
 Set matrix to scale without rotation. More...
 
void scale (const Fixed16 &scale)
 Set matrix to scale without rotation. More...
 
void scale_os ()
 Set matrix scale so 1 user unit = 1 os unit.
 

Public Attributes

Fixed16 a
 Top left of transform matrix.
 
Fixed16 b
 Top middle of transform matrix.
 
Fixed16 c
 Middle left of transform matrix.
 
Fixed16 d
 Middle of transform matrix.
 
int e
 Translation in x direction in 256th of an OS unit.
 
int f
 Translation in y direction in 256th of an OS unit.
 

Detailed Description

Class to represent Drawing transforms.

This is a three by three matrix that can be used to rotate, scale or translate a path in a single operation. It is laid out like this: a b 0 c d 0 e f 1

This matrix transforms a coordinate (x, y) into another coordinate (x', y') as follows:

x' = ax + cy + e y' = bx + dy + f

Translation by a given displacement is done by e for the x axis and f for the y axis. Scaling the x axis uses a, while the y axis uses d. Rotation can be performed by setting a = cos(angle), b= sin(angle), c = -sin(angle) and d = cos(angle) a, b, c and d given in 16.16 bit fixed point. e and f are as 256th of an OS unit.

Constructor & Destructor Documentation

tbx::DrawTransform::DrawTransform ( )
inline

Create the identity draw transform.

i.e. a transformed that does not move anything

Member Function Documentation

void tbx::DrawTransform::scale ( int  scale)
inline

Set matrix to scale without rotation.

Parameters
scaleinteger to scale by
void tbx::DrawTransform::scale ( const Fixed16 scale)
inline

Set matrix to scale without rotation.

Parameters
scaleFixed16 to scale by

The documentation for this class was generated from the following file: