Matrix

cairo_matrix_t is used throughout cairo to convert between different coordinate spaces. A cairo_matrix_t holds an affine transformation, such as a scale, rotation, shear, or a combination of these. The transformation of a point (x,y) is given by:

x_new = xx * x + xy * y + x0; y_new = yx * x + yy * y + y0;

The current transformation matrix of a cairo_t, represented as a cairo_matrix_t, defines the transformation from user-space coordinates to device-space coordinates. See cairo_get_matrix() and cairo_set_matrix().

Constructors

this
this(cairo_matrix_t* cairo_matrix, bool ownedRef)

Sets our main struct and passes it to the parent class

Members

Functions

getMatrixStruct
cairo_matrix_t* getMatrixStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

init
void init(double xx, double yx, double xy, double yy, double x0, double y0)

Sets matrix to be the affine transformation given by xx, yx, xy, yy, x0, y0. The transformation is given Since 1.0

initIdentity
void initIdentity()

Modifies matrix to be an identity transformation. Since 1.0

initRotate
void initRotate(double radians)

Initialized matrix to a transformation that rotates by radians. Since 1.0

initScale
void initScale(double sx, double sy)

Initializes matrix to a transformation that scales by sx and sy in the X and Y dimensions, respectively. Since 1.0

initTranslate
void initTranslate(double tx, double ty)

Initializes matrix to a transformation that translates by tx and ty in the X and Y dimensions, respectively. Since 1.0

invert
cairo_status_t invert()

Changes matrix to be the inverse of its original value. Not all transformation matrices have inverses; if the matrix collapses points together (it is degenerate), then it has no inverse and this function will fail. Since 1.0

multiply
void multiply(Matrix a, Matrix b)

Multiplies the affine transformations in a and b together and stores the result in result. The effect of the resulting transformation is to first apply the transformation in a to the coordinates and then apply the transformation in b to the coordinates. It is allowable for result to be identical to either a or b. Since 1.0

rotate
void rotate(double radians)

Applies rotation by radians to the transformation in matrix. The effect of the new transformation is to first rotate the coordinates by radians, then apply the original transformation to the coordinates. Since 1.0

scale
void scale(double sx, double sy)

Applies scaling by sx, sy to the transformation in matrix. The effect of the new transformation is to first scale the coordinates by sx and sy, then apply the original transformation to the coordinates. Since 1.0

transformDistance
void transformDistance(double dx, double dy)

Transforms the distance vector (dx,dy) by matrix. This is similar to cairo_matrix_transform_point() except that the translation components of the transformation are ignored. The calculation of Since 1.0

transformPoint
void transformPoint(double x, double y)

Transforms the point (x, y) by matrix. Since 1.0

translate
void translate(double tx, double ty)

Applies a translation by tx, ty to the transformation in matrix. The effect of the new transformation is to first translate the coordinates by tx and ty, then apply the original transformation to the coordinates. Since 1.0

Variables

cairo_matrix
cairo_matrix_t* cairo_matrix;

the main Gtk struct

Meta