package cairo2
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Cairo.MatrixSource
This is used throughout cairo to convert between different coordinate spaces.
init_translate tx ty return a transformation that translates by tx and ty in the X and Y dimensions, respectively.
init_scale sx sy return a transformation that scales by sx and sy in the X and Y dimensions, respectively.
init_rotate radians returns a a transformation that rotates by radians.
translate matrix tx 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.
scale matrix sx 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.
rotate matrix 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.
invert matrix changes matrix to be the inverse of it's 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 raise Error INVALID_MATRIX.
multiply a b multiplies the affine transformations in a and b together and return the 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.
transform_distance matrix dx 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 the returned vector is as follows:
dx2 = dx1 * a + dy1 * c;
dy2 = dx1 * b + dy1 * d;Affine transformations are position invariant, so the same vector always transforms to the same vector. If (x1,y1) transforms to (x2,y2) then (x1+dx1,y1+dy1) will transform to (x1+dx2,y1+dy2) for all values of x1 and x2.