User Tools

Site Tools


k25:k25.1.4:start

25.1.4 CairoMatrix

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.

25.1.4.1 Creating a CairoMatrix

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

25.1.4.2 Methods

The CairoMatrix class only has methods.

MethodDescription
Translate ( TX As Float, TY As Float ) As CairoMatrixThe function changes the CairoMatrix by the shifts TX and TY and returns the changed (result) matrix.
Scale ( SX As Float, SY As Float ) As CairoMatrixThe function changes the CairoMatrix with the scaling factors SX and SY and returns the changed matrix.
Rotate ( Angle As Float ) As CairoMatrixThe function changes the CairoMatrix with the rotation angle (radians) and returns the changed matrix.
Multiply ( Matrix2 As CairoMatrix ) As CairoMatrixThe function changes the CairoMatrix by multiplying from the left with the specified Matrix2 and returns the changed matrix.
Invert ( ) As CairoMatrixThe 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

25.1.4.3 Note

In → Chapter 23.3.8 PaintMatrix you will find descriptions of selected transformation equations.

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k25/k25.1.4/start.txt · Last modified: 20.02.2024 by emma

Page Tools