The class CairoMatrix (gb.cairo) represents a transformation matrix that is used, among other things, to execute affine mappings such as translation, scaling or rotation. You can nest several transformations inside each other.
A new CairoMatrix can be generated with New CairoMatrix ([…]):
Dim hCairoMatrix As CairoMatrix hCairoMatrix = New CairoMatrix ([XX As Float,YX As Float,XY As Float,YY As Float,X0 As Float,Y0 As Float])
If the matrix elements are not specified, a unit matrix (identity) is created. You can also use the class like a static function that returns a function value of type CairoMatrix:
Function CairoMatrix ([XX As Float,YX As Float,XY As Float,YY As Float,X0 As Float,Y0 As Float]) As CairoMatrix
The CairoMatrix class only has methods.
Method | Description |
---|---|
Translate ( TX As Float, TY As Float ) As CairoMatrix | The function changes the CairoMatrix by the shifts TX and TY and returns the changed (result) matrix. |
Scale ( SX As Float, SY As Float ) As CairoMatrix | The function changes the CairoMatrix with the scaling factors SX and SY and returns the changed matrix. |
Rotate ( Angle As Float ) As CairoMatrix | The function changes the CairoMatrix with the rotation angle (radians) and returns the changed matrix. |
Multiply ( Matrix2 As CairoMatrix ) As CairoMatrix | The function changes the CairoMatrix by multiplying from the left with the specified Matrix2 and returns the changed matrix. |
Invert ( ) As CairoMatrix | The function inverts the matrix and returns the modified matrix. If the matrix cannot be inverted, NULL is returned - which must be checked. |
Table 25.1.4.2.1 : Methods of the CairoMatrix class
In → Chapter 23.3.8 PaintMatrix you will find descriptions of selected transformation equations.