Declared in elStructs.h
Defines a 4x4 coordinate transformation matrix (currently limited to translation and scaling only).
|MTransform(dp,sc)||Default/init constructor. Creates translational+scaling transformation.|
|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.|
|operator()(i,j)||Returns the (i,j) element of the 4x4 transformation matrix.|
|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.|
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.
- The transform is not an essential concept. It is needed mostly for convenience, to prevent tedious manual calculations
Let us know
Please Contact us to report any errors on this page, or to suggest any improvements.