Reference » Service classes » MTransform

Elgrint::MTransform class

Declared in elStructs.h

Description

Defines a 4x4 coordinate transformation matrix (currently limited to translation and scaling only).

Initializers:

Name Description
MTransform(dp,sc) Default/init constructor. Creates translational+scaling transformation.

Mutators:

Name Description
scaleBy(sc) Changes the current scaling by the specified factors in each dimension.
translateBy(dp) Shifts the origin point of the coordinate system by a valid dp.

Revealers:

Name Description
operator()(i,j) Returns the (i,j) element of the 4x4 transformation matrix.

Converters:

Name Description
operator()(p) Transforms p according to transformation defined by this transform.
operator()(r) Transforms r according to transformation defined by this transform.
operator()(s) Transforms valid s according to transformation defined by this transform.

Details

Defines and performs translation and scaling transformations on variables of types MSize, MPoint, and MRect. Mostly used with the painting functions.

The transformation is needed for convenience, to convert from some virtual space to the actual window/screen coordinates. In other words, while drawing in the window, you can specify coordinates which are convenient for you and then simply use a suitable MTransform to convert them into the coordinates suitable for the painting functions, or simply call MWindow::setDrawTransform, which does that automatically for all subsequent drawing operations.

One good example for using transforms is MScrollBar, which defines a convenient virtual scroll. You can draw on that scroll, as if it was a static window, yet the drawings appear in the proper place (i.e. scrolled in all directions), accounting for the position of the scroll within the window. This is achieved by using the translational transform.

Remarks

Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.