uLib
User mode C/C++ extended API library for Win32 programmers.
|
XFORM transformation support
Two dimensional transformations, used for e.g SetWorldTransform(),
are matrix operations with this general definition.
The individual transforms defined by these functions can be combined
into composite transformations using the GDI CombineTransform() function.
Note: To use HDC world transforms you must set the HDC mode to 'advanced'
by calling SetGraphicsMode( hdc, GM_ADVANCED )
.
XFORM transformations are also used for ExtCreateRegion().
Macros | |
#define | ClearXform(pxfm) SetXformScale( pxfm, 1.0f, 1.0f ) |
#define | AppendXform(Dst, append) CombineTransform( (XFORM*)(Dst), (XFORM*)(Dst), (XFORM*)(append) ) |
#define | PrependXform(Dst, prepend) CombineTransform( (XFORM*)(Dst), (XFORM*)(prepend), (XFORM*)(Dst) ) |
Functions | |
XFORM * | SetXformTranslate (XFORM *pxfm, float dx, float dy) |
XFORM * | SetXformScale (XFORM *pxfm, float dx, float dy) |
XFORM * | SetXformRotate (XFORM *pxfm, double angle) |
XFORM * | SetXformShear (XFORM *pxfm, float sx, float sy) |
XFORM * | SetXformReflect (XFORM *pxfm, bool rx, bool ry) |
#define ClearXform | ( | pxfm | ) | SetXformScale( pxfm, 1.0f, 1.0f ) |
ClearXform() sets the XFORM to the identity matrix (no transform).
Definition at line 2273 of file UtilFunc.h.
#define AppendXform | ( | Dst, | |
append | |||
) | CombineTransform( (XFORM*)(Dst), (XFORM*)(Dst), (XFORM*)(append) ) |
AppendXform() combines two transforms, with 'Dst' as the primary.
Definition at line 2277 of file UtilFunc.h.
#define PrependXform | ( | Dst, | |
prepend | |||
) | CombineTransform( (XFORM*)(Dst), (XFORM*)(prepend), (XFORM*)(Dst) ) |
PrependXform() combines two transforms, with 'prepend' as the primary.
Definition at line 2282 of file UtilFunc.h.
XFORM* SetXformTranslate | ( | XFORM * | pxfm, |
float | dx, | ||
float | dy | ||
) |
SetXformTranslate() sets a translation (move) matrix.
Translate: x' = x + dx ; y' = y + dy
The function returns the XFORM* passed in (for chaining).
XFORM* SetXformScale | ( | XFORM * | pxfm, |
float | dx, | ||
float | dy | ||
) |
SetXformScale() sets a scaling transform.
Scale: x' = x * dx ; y' = y * dy
The function returns the XFORM* passed in (for chaining).
XFORM* SetXformRotate | ( | XFORM * | pxfm, |
double | angle | ||
) |
SetXformRotate() sets a rotation transform.
Note: Rotation is around the origin {0,0}, so to rotate around
another point, first translate (move) to the desired distance from
the origin, then rotate, and finally translate back to the destination.
The function returns the XFORM* passed in (for chaining).
XFORM* SetXformShear | ( | XFORM * | pxfm, |
float | sx, | ||
float | sy | ||
) |
SetXformShear() sets a shearing transform.
Shear: x' = x + (Sx * y) ; y' = y + (Sy * x)
The function returns the XFORM* passed in (for chaining).
XFORM* SetXformReflect | ( | XFORM * | pxfm, |
bool | rx, | ||
bool | ry | ||
) |
SetXformReflect() sets a reflection (mirror) transform.
Reflect: x' = -x ; y' = -y
The function returns the XFORM* passed in (for chaining).