Matrix

class Matrix

Matrix holds a 3x3 matrix for transforming coordinates.

This allows mapping Point and vectors with translation, scaling, skewing, rotation, and perspective.

Matrix elements are in row major order. Matrix does not have a constructor, so it must be explicitly initialized. setIdentity() initializes Matrix so it has no effect. setTranslate(), setScale(), setSkew(), setRotate(), set9() and setAll() initializes all Matrix elements with the corresponding mapping.

Matrix includes a hidden variable that classifies the type of matrix to improve performance. Matrix is not thread safe unless getType() is called first.

Classes

ScaleToFit

Members:

TypeMask

Members:

Methods

Concat

Returns Matrix a multiplied by Matrix b.

I

Returns reference to const identity Matrix.

InvalidMatrix

Returns reference to a const Matrix with invalid values.

MakeAll

Sets Matrix to.

MakeRectToRect

Returns Matrix set to scale and translate src Rect to dst Rect.

RotateDeg

Overloaded function.

RotateRad

Scale

Sets Matrix to scale by (sx, sy).

SetAffineIdentity

Fills affine with identity values in column major order.

Translate

Overloaded function.

__init__

Overloaded function.

asAffine

Fills affine in column major order.

decomposeScale

Decomposes Matrix into scale components and whatever remains.

dirtyMatrixTypeCache

Sets internal cache to unknown state.

dump

Writes text representation of Matrix to standard output.

get

Returns one matrix value.

get9

Returns nine scalar values contained by Matrix into list, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.

getMaxScale

Returns the maximum scaling factor of Matrix by decomposing the scaling and skewing elements.

getMinMaxScales

Returns the minimum scaling factor and the maximum scaling factor.

getMinScale

Returns the minimum scaling factor of Matrix by decomposing the scaling and skewing elements.

getPerspX

Returns factor scaling input x-axis relative to input y-axis.

getPerspY

Returns factor scaling input y-axis relative to input x-axis.

getScaleX

Returns scale factor multiplied by x-axis input, contributing to x-axis output.

getScaleY

Returns scale factor multiplied by y-axis input, contributing to y-axis output.

getSkewX

Returns scale factor multiplied by y-axis input, contributing to x-axis output.

getSkewY

Returns scale factor multiplied by x-axis input, contributing to y-axis output.

getTranslateX

Returns translation contributing to x-axis output.

getTranslateY

Returns translation contributing to y-axis output.

getType

Returns a bit field describing the transformations the matrix may perform.

hasPerspective

Returns true if the matrix contains perspective elements.

invert

Sets inverse to reciprocal matrix, returning true if Matrix can be inverted.

isFinite

Returns true if all elements of the matrix are finite.

isIdentity

Returns true if Matrix is identity.

isScaleTranslate

Returns true if Matrix at most scales and translates.

isSimilarity

Returns true if Matrix contains only translation, rotation, reflection, and uniform scale.

isTranslate

Returns true if Matrix is identity, or translates.

mapHomogeneousPoints

Overloaded function.

mapPoints

Takes src Point array and returns mapped Point array.

mapRadius

Returns geometric mean radius of ellipse formed by constructing circle of size radius, and mapping constructed circle with Matrix.

mapRect

Returns bounds of src corners mapped by Matrix.

mapRectScaleTranslate

Returns bounds of src corners mapped by Matrix.

mapRectToQuad

Maps four corners of rect to dst.

mapVector

Returns vector (dx, dy) multiplied by Matrix, treating Matrix translation as zero.

mapVectors

Maps src vector array to vector Point array.

mapXY

Returns Point (x, y) multiplied by Matrix.

normalizePerspective

A matrix is categorized as 'perspective' if the bottom row is not [0, 0, 1].

postConcat

Sets Matrix to Matrix other multiplied by Matrix.

postRotate

Overloaded function.

postScale

Overloaded function.

postSkew

Overloaded function.

postTranslate

Sets Matrix to Matrix constructed from translation (dx, dy) multiplied by Matrix.

preConcat

Sets Matrix to Matrix multiplied by Matrix other.

preRotate

Overloaded function.

preScale

Overloaded function.

preSkew

Overloaded function.

preTranslate

Sets Matrix to Matrix multiplied by Matrix constructed from translation (dx, dy).

preservesAxisAlignment

Returns true Matrix maps Rect to another Rect.

preservesRightAngles

Returns true if Matrix contains only translation, rotation, reflection, and scale.

rc

Returns one matrix value from a particular row/column.

rectStaysRect

Returns true SkMatrix maps SkRect to another SkRect.

reset

Sets Matrix to identity; which has no effect on mapped Point.

set

Returns writable Matrix value.

set9

Sets Matrix to nine scalar values in values, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.

setAffine

Sets Matrix to affine values, passed in column major order.

setAll

Sets all values from parameters.

setConcat

Sets Matrix to Matrix a multiplied by Matrix b.

setIdentity

Sets Matrix to identity; which has no effect on mapped Point.

setPerspX

Sets input x-axis perspective factor, which causes mapXY() to vary input x-axis values inversely proportional to input y-axis values.

setPerspY

Sets input y-axis perspective factor, which causes mapXY() to vary input y-axis values inversely proportional to input x-axis values.

setPolyToPoly

Sets Matrix to map src to dst.

setRSXform

Sets Matrix to rotate, scale, and translate using a compressed matrix form.

setRectToRect

Sets Matrix to scale and translate src Rect to dst Rect.

setRotate

Overloaded function.

setScale

Overloaded function.

setScaleTranslate

Initializes Matrix with scale and translate elements.

setScaleX

Sets horizontal scale factor.

setScaleY

Sets vertical scale factor.

setSinCos

Overloaded function.

setSkew

Overloaded function.

setSkewX

Sets horizontal skew factor.

setSkewY

Sets vertical skew factor.

setTranslate

Overloaded function.

setTranslateX

Sets horizontal translation.

setTranslateY

Sets vertical translation.

Attributes

kAScaleX

kAScaleY

kASkewX

kASkewY

kATransX

kATransY

kAffine_Mask

kCenter_ScaleToFit

kEnd_ScaleToFit

kFill_ScaleToFit

kIdentity_Mask

kMPersp0

kMPersp1

kMPersp2

kMScaleX

kMScaleY

kMSkewX

kMSkewY

kMTransX

kMTransY

kPerspective_Mask

kScale_Mask

kStart_ScaleToFit

kTranslate_Mask

Methods

static Matrix.Concat(a: skia.Matrix, b: skia.Matrix) skia.Matrix

Returns Matrix a multiplied by Matrix b.

Given:

    | A B C |      | J K L |
a = | D E F |, b = | M N O |
    | G H I |      | P Q R |

sets Matrix to:

        | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
        | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
Parameters:
Returns:

Matrix computed from a times b

static Matrix.I() skia.Matrix

Returns reference to const identity Matrix.

Returned Matrix is set to:

1 0 0 |
0 1 0 |
0 0 1 |
Returns:

const identity Matrix

static Matrix.InvalidMatrix() skia.Matrix

Returns reference to a const Matrix with invalid values.

Returned Matrix is set to:

SK_ScalarMax SK_ScalarMax SK_ScalarMax |
SK_ScalarMax SK_ScalarMax SK_ScalarMax |
SK_ScalarMax SK_ScalarMax SK_ScalarMax |
Returns:

const invalid Matrix

static Matrix.MakeAll(scaleX: float, skewX: float, transX: float, skewY: float, scaleY: float, transY: float, pers0: float, pers1: float, pers2: float) skia.Matrix

Sets Matrix to:

| scaleX skewX transX |
| skewY scaleY transY |
| pers0  pers1  pers2 |
Parameters:
  • scaleX (float) – horizontal scale factor

  • skewX (float) – horizontal skew factor

  • transX (float) – horizontal translation

  • skewY (float) – vertical skew factor

  • scaleY (float) – vertical scale factor

  • transY (float) – vertical translation

  • pers0 (float) – input x-axis perspective factor

  • pers1 (float) – input y-axis perspective factor

  • pers2 (float) – perspective scale factor

Returns:

Matrix constructed from parameters

static Matrix.MakeRectToRect(src: skia.Rect, dst: skia.Rect, stf: skia.Matrix.ScaleToFit) skia.Matrix

Returns Matrix set to scale and translate src Rect to dst Rect.

stf selects whether mapping completely fills dst or preserves the aspect ratio, and how to align src within dst. Returns the identity Matrix if src is empty. If dst is empty, returns Matrix set to:

| 0 0 0 |
| 0 0 0 |
| 0 0 1 |
Parameters:
Returns:

Matrix mapping src to dst

static Matrix.RotateDeg(*args, **kwargs)

Overloaded function.

  1. RotateDeg(deg: float) -> skia.Matrix

    Sets Matrix to rotate by |deg| about a pivot point at (0, 0).

    param deg:

    rotation angle in degrees (positive rotates clockwise)

    return:

    Matrix with rotation

  2. RotateDeg(deg: float, pt: skia.Point) -> skia.Matrix

static Matrix.RotateRad(rad: float) skia.Matrix
static Matrix.Scale(sx: float, sy: float) skia.Matrix

Sets Matrix to scale by (sx, sy).

Returned matrix is:

sx 0 0 |
0 sy 0 |
0 0 1 |
Parameters:
  • sx (float) – horizontal scale factor

  • sy (float) – vertical scale factor

Returns:

Matrix with scale

static Matrix.SetAffineIdentity() List[float]

Fills affine with identity values in column major order.

Sets affine to:

1 0 0 |
0 1 0 |

Affine 3 by 2 matrices in column major order are used by OpenGL and XPS.

Returns:

List of float

static Matrix.Translate(*args, **kwargs)

Overloaded function.

  1. Translate(dx: float, dy: float) -> skia.Matrix

    Sets Matrix to translate by (dx, dy).

    Returned matrix is:

    1 0 dx |
    0 1 dy |
    0 0 1 |
    dx:

    horizontal translation

    dy:

    vertical translation

    return:

    Matrix with translation

  2. Translate(t: skia.Point) -> skia.Matrix

  3. Translate(t: skia.IPoint) -> skia.Matrix

Matrix.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: skia.Matrix) -> None

    Creates an identity Matrix:

    | 1 0 0 |
    | 0 1 0 |
    | 0 0 1 |
    
  2. __init__(self: skia.Matrix, array: numpy.ndarray[numpy.float32]) -> None

    Creates a Matrix from 3x3 float32 NumPy array.

Matrix.asAffine(self: skia.Matrix) object

Fills affine in column major order.

Sets affine to:

| scale-x skew-x translate-x | | skew-y scale-y translate-y |

If Matrix contains perspective, returns None.

Returns:

list of float if Matrix does not contain perspective, else None

Matrix.decomposeScale(self: skia.Matrix, scale: skia.Size, remaining: skia.Matrix) bool

Decomposes Matrix into scale components and whatever remains.

Returns false if Matrix could not be decomposed.

Sets scale to portion of Matrix that scale axes. Sets remaining to Matrix with scaling factored out. remaining may be passed as nullptr to determine if Matrix can be decomposed without computing remainder.

Returns true if scale components are found. scale and remaining are unchanged if Matrix contains perspective; scale factors are not finite, or are nearly zero.

On success: Matrix = Remaining * scale.

Parameters:
Returns:

true if scale can be computed

Matrix.dirtyMatrixTypeCache(self: skia.Matrix) None

Sets internal cache to unknown state.

Use to force update after repeated modifications to Matrix element reference returned by operator[](int index).

Matrix.dump(self: skia.Matrix) None

Writes text representation of Matrix to standard output.

Floating point values are written with limited precision; it may not be possible to reconstruct original Matrix from output.

Matrix.get(self: skia.Matrix, index: int) float

Returns one matrix value.

Asserts if index is out of range and SK_DEBUG is defined.

Parameters:

index (int) – one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2

Returns:

value corresponding to index

Matrix.get9(self: skia.Matrix) List[float]

Returns nine scalar values contained by Matrix into list, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.

Matrix.getMaxScale(self: skia.Matrix) float

Returns the maximum scaling factor of Matrix by decomposing the scaling and skewing elements.

Returns -1 if scale factor overflows or Matrix contains perspective.

Returns:

maximum scale factor

Matrix.getMinMaxScales(self: skia.Matrix) tuple

Returns the minimum scaling factor and the maximum scaling factor.

Scaling factors are computed by decomposing the Matrix scaling and skewing elements.

Returns (min, max) if scale factors are found; otherwise, returns (-1, -1).

Returns:

tuple of min and max factors

Matrix.getMinScale(self: skia.Matrix) float

Returns the minimum scaling factor of Matrix by decomposing the scaling and skewing elements.

Returns -1 if scale factor overflows or Matrix contains perspective.

Returns:

minimum scale factor

Matrix.getPerspX(self: skia.Matrix) float

Returns factor scaling input x-axis relative to input y-axis.

Returns:

input x-axis perspective factor

Matrix.getPerspY(self: skia.Matrix) float

Returns factor scaling input y-axis relative to input x-axis.

Returns:

input y-axis perspective factor

Matrix.getScaleX(self: skia.Matrix) float

Returns scale factor multiplied by x-axis input, contributing to x-axis output.

With mapPoints(), scales Point along the x-axis.

Returns:

horizontal scale factor

Matrix.getScaleY(self: skia.Matrix) float

Returns scale factor multiplied by y-axis input, contributing to y-axis output.

With mapPoints(), scales Point along the y-axis.

Returns:

vertical scale factor

Matrix.getSkewX(self: skia.Matrix) float

Returns scale factor multiplied by y-axis input, contributing to x-axis output.

With mapPoints(), skews Point along the x-axis. Skewing both axes can rotate Point.

Returns:

horizontal scale factor

Matrix.getSkewY(self: skia.Matrix) float

Returns scale factor multiplied by x-axis input, contributing to y-axis output.

With mapPoints(), skews Point along the y-axis. Skewing both axes can rotate Point.

Returns:

vertical skew factor

Matrix.getTranslateX(self: skia.Matrix) float

Returns translation contributing to x-axis output.

With mapPoints(), moves Point along the x-axis.

Returns:

horizontal translation factor

Matrix.getTranslateY(self: skia.Matrix) float

Returns translation contributing to y-axis output.

With mapPoints(), moves Point along the y-axis.

Returns:

vertical translation factor

Matrix.getType(self: skia.Matrix) skia.Matrix.TypeMask

Returns a bit field describing the transformations the matrix may perform.

The bit field is computed conservatively, so it may include false positives. For example, when kPerspective_Mask is set, all other bits are set.

Returns:

kIdentity_Mask, or combinations of: kTranslate_Mask, kScale_Mask, kAffine_Mask, kPerspective_Mask

Matrix.hasPerspective(self: skia.Matrix) bool

Returns true if the matrix contains perspective elements.

Matrix form is:

| – – – |
| – – – |
| perspective-x perspective-y perspective-scale |

where perspective-x or perspective-y is non-zero, or perspective-scale is not one. All other elements may have any value.

Returns:

true if Matrix is in most general form

Matrix.invert(self: skia.Matrix, inverse: skia.Matrix) bool

Sets inverse to reciprocal matrix, returning true if Matrix can be inverted.

Geometrically, if Matrix maps from source to destination, inverse Matrix maps from destination to source. If Matrix can not be inverted, inverse is unchanged.

Parameters:

inverse (skia.Matrix) – storage for inverted Matrix; may be nullptr

Returns:

true if Matrix can be inverted

Matrix.isFinite(self: skia.Matrix) bool

Returns true if all elements of the matrix are finite.

Returns false if any element is infinity, or NaN.

Returns:

true if matrix has only finite elements

Matrix.isIdentity(self: skia.Matrix) bool

Returns true if Matrix is identity.

Identity matrix is:

| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
Returns:

true if Matrix has no effect

Matrix.isScaleTranslate(self: skia.Matrix) bool

Returns true if Matrix at most scales and translates.

Matrix may be identity, contain only scale elements, only translate elements, or both. Matrix form is:

| scale-x    0    translate-x |
|    0    scale-y translate-y |
|    0       0         1      |
Returns:

true if Matrix is identity; or scales, translates, or both

Matrix.isSimilarity(self: skia.Matrix, tol: float = 0.000244140625) bool

Returns true if Matrix contains only translation, rotation, reflection, and uniform scale.

Returns false if Matrix contains different scales, skewing, perspective, or degenerate forms that collapse to a line or point.

Describes that the Matrix makes rendering with and without the matrix are visually alike; a transformed circle remains a circle. Mathematically, this is referred to as similarity of a Euclidean space, or a similarity transformation.

Preserves right angles, keeping the arms of the angle equal lengths.

Parameters:

tol (float) – to be deprecated

Returns:

true if Matrix only rotates, uniformly scales, translates

Matrix.isTranslate(self: skia.Matrix) bool

Returns true if Matrix is identity, or translates.

Matrix form is:

| 1 0 translate-x | | 0 1 translate-y | | 0 0 1 |
Returns:

true if Matrix is identity, or translates

Matrix.mapHomogeneousPoints(*args, **kwargs)

Overloaded function.

  1. mapHomogeneousPoints(self: skia.Matrix, pts: List[skia.Point3]) -> object

    Takes src Point3 array and returns mapped Point3 array.

    Point3 array is mapped by multiplying each Point3 by Matrix. Given:

             | A B C |        | x |
    Matrix = | D E F |, src = | y |
             | G H I |        | z |
    

    each resulting dst Point is computed as:

                   |A B C| |x|
    Matrix * src = |D E F| |y| = |Ax+By+Cz Dx+Ey+Fz Gx+Hy+Iz|
                   |G H I| |z|
    
    pts:

    Point3 array to transform

  2. mapHomogeneousPoints(self: skia.Matrix, pts: List[skia.Point]) -> object

    Returns homogeneous points, starting with 2D src points (with implied w = 1).

    pts:

    Point array to transform

Matrix.mapPoints(self: skia.Matrix, pts: List[skia.Point]) List[skia.Point]

Takes src Point array and returns mapped Point array.

Point are mapped by multiplying each Point by Matrix. Given:

         | A B C |       | x |
Matrix = | D E F |, pt = | y |
         | G H I |       | 1 |

where:

for (i = 0; i < count; ++i) {
    x = src[i].fX
    y = src[i].fY
}

each dst Point is computed as:

              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
Parameters:

src (List[skia.Point]) – list of Point to transform

Matrix.mapRadius(self: skia.Matrix, radius: float) float

Returns geometric mean radius of ellipse formed by constructing circle of size radius, and mapping constructed circle with Matrix.

The result squared is equal to the major axis length times the minor axis length. Result is not meaningful if Matrix contains perspective elements.

Parameters:

radius – circle size to map

Returns:

average mapped radius

Matrix.mapRect(self: skia.Matrix, src: skia.Rect, pc: skia.ApplyPerspectiveClip = <ApplyPerspectiveClip.kYes: 1>) skia.Rect

Returns bounds of src corners mapped by Matrix.

Parameters:
Returns:

mapped bounds

Matrix.mapRectScaleTranslate(self: skia.Matrix, src: skia.Rect) skia.Rect

Returns bounds of src corners mapped by Matrix.

If matrix contains elements other than scale or translate: asserts if SK_DEBUG is defined; otherwise, results are undefined.

Parameters:

src (skia.Rect) – Rect to map

Matrix.mapRectToQuad(self: skia.Matrix, rect: skia.Rect) List[skia.Point]

Maps four corners of rect to dst.

Point are mapped by multiplying each rect corner by Matrix. rect corner is processed in this order: (rect.fLeft, rect.fTop), (rect.fRight, rect.fTop), (rect.fRight, rect.fBottom), (rect.fLeft, rect.fBottom).

rect may be empty: rect.fLeft may be greater than or equal to rect.fRight; rect.fTop may be greater than or equal to rect.fBottom.

Given:

         | A B C |        | x |
Matrix = | D E F |,  pt = | y |
         | G H I |        | 1 |

where pt is initialized from each of (rect.fLeft, rect.fTop), (rect.fRight, rect.fTop), (rect.fRight, rect.fBottom), (rect.fLeft, rect.fBottom), each dst Point is computed as:

              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
Parameters:

rect (skia.Rect) – Rect to map

Note: this does not perform perspective clipping (as that might result in more than 4 points, so results are suspect if the matrix contains perspective.

Matrix.mapVector(self: skia.Matrix, dx: float, dy: float) skia.Point

Returns vector (dx, dy) multiplied by Matrix, treating Matrix translation as zero.

Given:

         | A B 0 |         | dx |
Matrix = | D E 0 |,  vec = | dy |
         | G H I |         |  1 |

each result vector is computed as:

               |A B 0| |dx|                                       A*dx+B*dy    D*dx+E*dy
Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = --------—--, --------—--
               |G H I| | 1|                                       G*dx+H*dy+I  G*dx+*dHy+I
Parameters:
  • dx (float) – x-axis value of vector to map

  • dy (float) – y-axis value of vector to map

Returns:

mapped vector

Matrix.mapVectors(self: skia.Matrix, src: List[skia.Point]) List[skia.Point]

Maps src vector array to vector Point array.

Vectors are mapped by multiplying each vector by Matrix, treating Matrix translation as zero. Given:

         | A B 0 |         | x |
Matrix = | D E 0 |,  src = | y |
         | G H I |         | 1 |

where:

for (i = 0; i < count; ++i) {
    x = src[i].fX
    y = src[i].fY
}

each dst vector is computed as:

               |A B 0| |x|                            Ax+By     Dx+Ey
Matrix * src = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , -------
               |G H I| |1|                           Gx+Hy+I   Gx+Hy+I
Parameters:

src (List[skia.Point]) – vectors to transform

Matrix.mapXY(self: skia.Matrix, x: float, y: float) skia.Point

Returns Point (x, y) multiplied by Matrix.

Given:

         | A B C |       | x |
Matrix = | D E F |, pt = | y |
         | G H I |       | 1 |

result is computed as:

              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
Parameters:
  • x (float) – x-axis value of Point to map

  • y (float) – y-axis value of Point to map

Returns:

mapped Point

Matrix.normalizePerspective(self: skia.Matrix) None

A matrix is categorized as ‘perspective’ if the bottom row is not [0, 0, 1].

However, for most uses (e.g. mapPoints) a bottom row of [0, 0, X] behaves like a non-perspective matrix, though it will be categorized as perspective. Calling normalizePerspective() will change the matrix such that, if its bottom row was [0, 0, X], it will be changed to [0, 0, 1] by scaling the rest of the matrix by 1/X:

| A B C | | A/X B/X C/X | | D E F | -> \
| D/X E/X F/X | for X != 0 | 0 0 X | | 0 0 1 |
Matrix.postConcat(self: skia.Matrix, other: skia.Matrix) skia.Matrix

Sets Matrix to Matrix other multiplied by Matrix.

This can be thought of mapping by other after applying Matrix.

Given:

         | J K L |           | A B C |
Matrix = | M N O |,  other = | D E F |
         | P Q R |           | G H I |

sets Matrix to:

                 | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
                 | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
Parameters:

other (skia.Matrix) – Matrix on left side of multiply expression

Matrix.postRotate(*args, **kwargs)

Overloaded function.

  1. postRotate(self: skia.Matrix, degrees: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to Matrix constructed from rotating by degrees about pivot point (px, py), multiplied by Matrix.

    This can be thought of as rotating about a pivot point after applying Matrix.

    Positive degrees rotates clockwise.

    Given:

             | J K L |                        | c -s dx |
    Matrix = | M N O |,  R(degrees, px, py) = | s  c dy |
             | P Q R |                        | 0  0  1 |
    

    where:

    c  = cos(degrees)
    s  = sin(degrees)
    dx =  s * py + (1 - c) * px
    dy = -s * px + (1 - c) * py
    

    sets Matrix to:

                                  |c -s dx| |J K L|   |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R|
    R(degrees, px, py) * Matrix = |s  c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R|
                                  |0  0  1| |P Q R|   |         P          Q          R|
    
    degrees:

    angle of axes relative to upright axes

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. postRotate(self: skia.Matrix, degrees: float) -> skia.Matrix

    Sets Matrix to Matrix constructed from rotating by degrees about pivot point (0, 0), multiplied by Matrix.

    This can be thought of as rotating about the origin after applying Matrix.

    Positive degrees rotates clockwise.

    Given:

             | J K L |                        | c -s 0 |
    Matrix = | M N O |,  R(degrees, px, py) = | s  c 0 |
             | P Q R |                        | 0  0 1 |
    

    where:

    c  = cos(degrees)
    s  = sin(degrees)
    

    sets Matrix to:

                                  | c -s dx | | J K L |   | cJ-sM cK-sN cL-sO |
    R(degrees, px, py) * Matrix = | s  c dy | | M N O | = | sJ+cM sK+cN sL+cO |
                                  | 0  0  1 | | P Q R |   |     P     Q     R |
    
    degrees:

    angle of axes relative to upright axes

Matrix.postScale(*args, **kwargs)

Overloaded function.

  1. postScale(self: skia.Matrix, sx: float, sy: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point (px, py), multiplied by Matrix.

    This can be thought of as scaling about a pivot point after applying Matrix.

    Given:

             | J K L |                       | sx  0 dx |
    Matrix = | M N O |,  S(sx, sy, px, py) = |  0 sy dy |
             | P Q R |                       |  0  0  1 |
    

    where:

    dx = px - sx * px
    dy = py - sy * py
    

    sets Matrix to:

                                 | sx  0 dx | | J K L |   | sx*J+dx*P sx*K+dx*Q sx*L+dx+R |
    S(sx, sy, px, py) * Matrix = |  0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R |
                                 |  0  0  1 | | P Q R |   |         P         Q         R |
    
    sx:

    horizontal scale factor

    sy:

    vertical scale factor

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. postScale(self: skia.Matrix, sx: float, sy: float) -> skia.Matrix

    Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point (0, 0), multiplied by Matrix.

    This can be thought of as scaling about the origin after applying Matrix.

    Given:

             | J K L |               | sx  0  0 |
    Matrix = | M N O |,  S(sx, sy) = |  0 sy  0 |
             | P Q R |               |  0  0  1 |
    

    sets Matrix to:

                         | sx  0  0 | | J K L |   | sx*J sx*K sx*L |
    S(sx, sy) * Matrix = |  0 sy  0 | | M N O | = | sy*M sy*N sy*O |
                         |  0  0  1 | | P Q R |   |    P    Q    R |
    
    sx:

    horizontal scale factor

    sy:

    vertical scale factor

Matrix.postSkew(*args, **kwargs)

Overloaded function.

  1. postSkew(self: skia.Matrix, kx: float, ky: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to Matrix constructed from skewing by (kx, ky) about pivot point (px, py), multiplied by Matrix.

    This can be thought of as skewing about a pivot point after applying Matrix.

    Given:

             | J K L |                       |  1 kx dx |
    Matrix = | M N O |,  K(kx, ky, px, py) = | ky  1 dy |
             | P Q R |                       |  0  0  1 |
    

    where:

    dx = -kx * py
    dy = -ky * px
    

    sets Matrix to:

                                 | 1 kx dx| |J K L|   |J+kx*M+dx*P K+kx*N+dx*Q L+kx*O+dx+R|
    K(kx, ky, px, py) * Matrix = |ky  1 dy| |M N O| = |ky*J+M+dy*P ky*K+N+dy*Q ky*L+O+dy*R|
                                 | 0  0  1| |P Q R|   |          P           Q           R|
    
    kx:

    horizontal skew factor

    ky:

    vertical skew factor

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. postSkew(self: skia.Matrix, kx: float, ky: float) -> skia.Matrix

    Sets Matrix to Matrix constructed from skewing by (kx, ky) about pivot point (0, 0), multiplied by Matrix.

    This can be thought of as skewing about the origin after applying Matrix.

    Given:

             | J K L |               |  1 kx 0 |
    Matrix = | M N O |,  K(kx, ky) = | ky  1 0 |
             | P Q R |               |  0  0 1 |
    

    sets Matrix to:

                         |  1 kx 0 | | J K L |   | J+kx*M K+kx*N L+kx*O |
    K(kx, ky) * Matrix = | ky  1 0 | | M N O | = | ky*J+M ky*K+N ky*L+O |
                         |  0  0 1 | | P Q R |   |      P      Q      R |
    
    kx:

    horizontal skew factor

    ky:

    vertical skew factor

Matrix.postTranslate(self: skia.Matrix, dx: float, dy: float) skia.Matrix

Sets Matrix to Matrix constructed from translation (dx, dy) multiplied by Matrix.

This can be thought of as moving the point to be mapped after applying Matrix.

Given:

         | J K L |               | 1 0 dx |
Matrix = | M N O |,  T(dx, dy) = | 0 1 dy |
         | P Q R |               | 0 0  1 |

sets Matrix to:

                     | 1 0 dx | | J K L |   | J+dx*P K+dx*Q L+dx*R |
T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R |
                     | 0 0  1 | | P Q R |   |      P      Q      R |
Parameters:
  • dx (float) – x-axis translation after applying Matrix

  • dy (float) – y-axis translation after applying Matrix

Matrix.preConcat(self: skia.Matrix, other: skia.Matrix) skia.Matrix

Sets Matrix to Matrix multiplied by Matrix other.

This can be thought of mapping by other before applying Matrix.

Given:

         | A B C |          | J K L |
Matrix = | D E F |, other = | M N O |
         | G H I |          | P Q R |

sets Matrix to:

                 | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
Matrix * other = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
                 | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
Parameters:

other (skia.Matrix) – Matrix on right side of multiply expression

Matrix.preRotate(*args, **kwargs)

Overloaded function.

  1. preRotate(self: skia.Matrix, degrees: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees about pivot point (px, py).

    This can be thought of as rotating about a pivot point before applying Matrix.

    Positive degrees rotates clockwise.

    Given:

             | A B C |                        | c -s dx |
    Matrix = | D E F |,  R(degrees, px, py) = | s  c dy |
             | G H I |                        | 0  0  1 |
    

    where:

    c  = cos(degrees)
    s  = sin(degrees)
    dx =  s * py + (1 - c) * px
    dy = -s * px + (1 - c) * py
    

    sets Matrix to:

                                  | A B C | | c -s dx |   | Ac+Bs -As+Bc A*dx+B*dy+C |
    Matrix * R(degrees, px, py) = | D E F | | s  c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F |
                                  | G H I | | 0  0  1 |   | Gc+Hs -Gs+Hc G*dx+H*dy+I |
    
    degrees:

    angle of axes relative to upright axes

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. preRotate(self: skia.Matrix, degrees: float) -> skia.Matrix

    Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees about pivot point (0, 0).

    This can be thought of as rotating about the origin before applying Matrix.

    Positive degrees rotates clockwise.

    Given:

             | A B C |                        | c -s 0 |
    Matrix = | D E F |,  R(degrees, px, py) = | s  c 0 |
             | G H I |                        | 0  0 1 |
    

    where:

    c  = cos(degrees)
    s  = sin(degrees)
    

    sets Matrix to:

                                  | A B C | | c -s 0 |   | Ac+Bs -As+Bc C |
    Matrix * R(degrees, px, py) = | D E F | | s  c 0 | = | Dc+Es -Ds+Ec F |
                                  | G H I | | 0  0 1 |   | Gc+Hs -Gs+Hc I |
    
    degrees:

    angle of axes relative to upright axes

Matrix.preScale(*args, **kwargs)

Overloaded function.

  1. preScale(self: skia.Matrix, sx: float, sy: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to Matrix multiplied by Matrix constructed from scaling by (sx, sy) about pivot point (px, py).

    This can be thought of as scaling about a pivot point before applying Matrix.

    Given:

             | A B C |                       | sx  0 dx |
    Matrix = | D E F |,  S(sx, sy, px, py) = |  0 sy dy |
             | G H I |                       |  0  0  1 |
    

    where:

    dx = px - sx * px
    dy = py - sy * py
    

    sets Matrix to:

                                 | A B C | | sx  0 dx |   | A*sx B*sy A*dx+B*dy+C |
    Matrix * S(sx, sy, px, py) = | D E F | |  0 sy dy | = | D*sx E*sy D*dx+E*dy+F |
                                 | G H I | |  0  0  1 |   | G*sx H*sy G*dx+H*dy+I |
    
    sx:

    horizontal scale factor

    sy:

    vertical scale factor

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. preScale(self: skia.Matrix, sx: float, sy: float) -> skia.Matrix

    Sets Matrix to Matrix multiplied by Matrix constructed from scaling by (sx, sy) about pivot point (0, 0).

    This can be thought of as scaling about the origin before applying Matrix.

    Given:

             | A B C |               | sx  0  0 |
    Matrix = | D E F |,  S(sx, sy) = |  0 sy  0 |
             | G H I |               |  0  0  1 |
    

    sets Matrix to:

                         | A B C | | sx  0  0 |   | A*sx B*sy C |
    Matrix * S(sx, sy) = | D E F | |  0 sy  0 | = | D*sx E*sy F |
                         | G H I | |  0  0  1 |   | G*sx H*sy I |
    
    sx:

    horizontal scale factor

    sy:

    vertical scale factor

Matrix.preSkew(*args, **kwargs)

Overloaded function.

  1. preSkew(self: skia.Matrix, kx: float, ky: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to Matrix multiplied by Matrix constructed from skewing by (kx, ky) about pivot point (px, py).

    This can be thought of as skewing about a pivot point before applying Matrix.

    Given:

             | A B C |                       |  1 kx dx |
    Matrix = | D E F |,  K(kx, ky, px, py) = | ky  1 dy |
             | G H I |                       |  0  0  1 |
    

    where:

    dx = -kx * py
    dy = -ky * px
    

    sets Matrix to:

                                 | A B C | |  1 kx dx |   | A+B*ky A*kx+B A*dx+B*dy+C |
    Matrix * K(kx, ky, px, py) = | D E F | | ky  1 dy | = | D+E*ky D*kx+E D*dx+E*dy+F |
                                 | G H I | |  0  0  1 |   | G+H*ky G*kx+H G*dx+H*dy+I |
    
    kx:

    horizontal skew factor

    ky:

    vertical skew factor

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. preSkew(self: skia.Matrix, kx: float, ky: float) -> skia.Matrix

    Sets Matrix to Matrix multiplied by Matrix constructed from skewing by (kx, ky) about pivot point (0, 0).

    This can be thought of as skewing about the origin before applying Matrix.

    Given:

             | A B C |               |  1 kx 0 |
    Matrix = | D E F |,  K(kx, ky) = | ky  1 0 |
             | G H I |               |  0  0 1 |
    

    sets Matrix to:

                         | A B C | |  1 kx 0 |   | A+B*ky A*kx+B C |
    Matrix * K(kx, ky) = | D E F | | ky  1 0 | = | D+E*ky D*kx+E F |
                         | G H I | |  0  0 1 |   | G+H*ky G*kx+H I |
    
    kx:

    horizontal skew factor

    ky:

    vertical skew factor

Matrix.preTranslate(self: skia.Matrix, dx: float, dy: float) skia.Matrix

Sets Matrix to Matrix multiplied by Matrix constructed from translation (dx, dy).

This can be thought of as moving the point to be mapped before applying Matrix.

Given:

         | A B C |               | 1 0 dx |
Matrix = | D E F |,  T(dx, dy) = | 0 1 dy |
         | G H I |               | 0 0  1 |

sets Matrix to:

                     | A B C | | 1 0 dx |   | A B A*dx+B*dy+C |
Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F |
                     | G H I | | 0 0  1 |   | G H G*dx+H*dy+I |
Parameters:
  • dx – x-axis translation before applying Matrix

  • dy – y-axis translation before applying Matrix

Matrix.preservesAxisAlignment(self: skia.Matrix) bool

Returns true Matrix maps Rect to another Rect.

If true, Matrix is identity, or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all cases, Matrix may also have translation. Matrix form is either:

| scale-x    0    translate-x |
|    0    scale-y translate-y |
|    0       0         1      |

or:

|    0     rotate-x translate-x |
| rotate-y    0     translate-y |
|    0        0          1      |

for non-zero values of scale-x, scale-y, rotate-x, and rotate-y.

Also called rectStaysRect(); use the one that provides better inline documentation.

Returns:

true if Matrix maps one Rect into another

Matrix.preservesRightAngles(self: skia.Matrix, tol: float = 0.000244140625) bool

Returns true if Matrix contains only translation, rotation, reflection, and scale.

Scale may differ along rotated axes. Returns false if Matrix skewing, perspective, or degenerate forms that collapse to a line or point.

Preserves right angles, but not requiring that the arms of the angle retain equal lengths.

Parameters:

tol (float) – to be deprecated

Returns:

true if Matrix only rotates, scales, translates

Matrix.rc(self: skia.Matrix, r: int, c: int) float

Returns one matrix value from a particular row/column. Asserts if index is out of range and SK_DEBUG is defined.

Parameters:
  • r – matrix row to fetch

  • c – matrix column to fetch

Returns:

value at the given matrix position

Matrix.rectStaysRect(self: skia.Matrix) bool

Returns true SkMatrix maps SkRect to another SkRect.

If true, Matrix is identity, or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all cases, Matrix may also have translation. Matrix form is either:

| scale-x    0    translate-x |
|    0    scale-y translate-y |
|    0       0         1      |

or:

|    0     rotate-x translate-x |
| rotate-y    0     translate-y |
|    0        0          1      |
for non-zero values of scale-x, scale-y, rotate-x, and rotate-y.

Also called preservesAxisAlignment(); use the one that provides better inline documentation.

Returns:

true if Matrix maps one Rect into another

Matrix.reset(self: skia.Matrix) skia.Matrix

Sets Matrix to identity; which has no effect on mapped Point.

Sets Matrix to:

| 1 0 0 |
| 0 1 0 |
| 0 0 1 |

Also called setIdentity(); use the one that provides better inline documentation.

Matrix.set(self: skia.Matrix, index: int, value: float) None

Returns writable Matrix value.

Asserts if index is out of range and SK_DEBUG is defined. Clears internal cache anticipating that caller will change Matrix value.

Next call to read Matrix state may recompute cache; subsequent writes to Matrix value must be followed by dirtyMatrixTypeCache().

Parameters:
  • index (int) – one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2

  • value – value to set

Matrix.set9(self: skia.Matrix, buffer: List[float]) skia.Matrix

Sets Matrix to nine scalar values in values, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.

Sets matrix to:

| values[0] values[1] values[2] |
| values[3] values[4] values[5] |
| values[6] values[7] values[8] |

In the future, set9 followed by get9 may not return the same values. Since Matrix maps non-homogeneous coordinates, scaling all nine values produces an equivalent transformation, possibly improving precision.

Parameters:

values – nine scalar values

Matrix.setAffine(self: skia.Matrix, affine: List[float]) skia.Matrix

Sets Matrix to affine values, passed in column major order.

Given affine, column, then row, as:

| scale-x  skew-x translate-x |
|  skew-y scale-y translate-y |

Matrix is set, row, then column, to:

| scale-x  skew-x translate-x |
|  skew-y scale-y translate-y |
|       0       0           1 |
Parameters:

affine – 3 by 2 affine matrix

Matrix.setAll(self: skia.Matrix, scaleX: float, skewX: float, transX: float, skewY: float, scaleY: float, transY: float, persp0: float, persp1: float, persp2: float) skia.Matrix

Sets all values from parameters.

Sets matrix to:

| scaleX skewX transX |
| skewY scaleY transY |
| persp0 persp1 persp2 |
Parameters:
  • scaleX (float) – horizontal scale factor to store

  • skewX (float) – horizontal skew factor to store

  • transX (float) – horizontal translation to store

  • skewY (float) – vertical skew factor to store

  • scaleY (float) – vertical scale factor to store

  • transY (float) – vertical translation to store

  • persp0 (float) – input x-axis values perspective factor to store

  • persp1 (float) – input y-axis values perspective factor to store

  • persp2 (float) – perspective scale factor to store

Matrix.setConcat(self: skia.Matrix, a: skia.Matrix, b: skia.Matrix) skia.Matrix

Sets Matrix to Matrix a multiplied by Matrix b.

Either a or b may be this.

Given:

    | A B C |      | J K L |
a = | D E F |, b = | M N O |
    | G H I |      | P Q R |

sets Matrix to:

        | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
        | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
Parameters:
Matrix.setIdentity(self: skia.Matrix) skia.Matrix

Sets Matrix to identity; which has no effect on mapped Point.

Sets Matrix to:

| 1 0 0 |
| 0 1 0 |
| 0 0 1 |

Also called reset(); use the one that provides better inline documentation.

Matrix.setPerspX(self: skia.Matrix, v: float) skia.Matrix

Sets input x-axis perspective factor, which causes mapXY() to vary input x-axis values inversely proportional to input y-axis values.

Parameters:

v (float) – perspective factor

Matrix.setPerspY(self: skia.Matrix, v: float) skia.Matrix

Sets input y-axis perspective factor, which causes mapXY() to vary input y-axis values inversely proportional to input x-axis values.

Parameters:

v (float) – perspective factor

Matrix.setPolyToPoly(self: skia.Matrix, src: List[skia.Point], dst: List[skia.Point]) bool

Sets Matrix to map src to dst.

count must be zero or greater, and four or less.

If count is zero, sets Matrix to identity and returns true. If count is one, sets Matrix to translate and returns true. If count is two or more, sets Matrix to map Point if possible; returns false if Matrix cannot be constructed. If count is four, Matrix may include perspective.

Parameters:
Returns:

true if Matrix was constructed successfully

Matrix.setRSXform(self: skia.Matrix, rsxForm: SkRSXform) skia.Matrix

Sets Matrix to rotate, scale, and translate using a compressed matrix form.

Vector (rsxForm.fSSin, rsxForm.fSCos) describes the angle of rotation relative to (0, 1). Vector length specifies scale. Mapped point is rotated and scaled by vector, then translated by (rsxForm.fTx, rsxForm.fTy).

Parameters:

rsxForm (skia.RSXform) – compressed RSXform matrix

Returns:

reference to Matrix

Matrix.setRectToRect(self: skia.Matrix, src: skia.Rect, dst: skia.Rect, stf: skia.Matrix.ScaleToFit) bool

Sets Matrix to scale and translate src Rect to dst Rect.

stf selects whether mapping completely fills dst or preserves the aspect ratio, and how to align src within dst. Returns false if src is empty, and sets Matrix to identity. Returns true if dst is empty, and sets Matrix to:

0 0 0 |
0 0 0 |
0 0 1 |
Parameters:
Returns:

true if Matrix can represent Rect mapping

Matrix.setRotate(*args, **kwargs)

Overloaded function.

  1. setRotate(self: skia.Matrix, degrees: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to rotate by degrees about a pivot point at (px, py).

    The pivot point is unchanged when mapped with Matrix.

    Positive degrees rotates clockwise.

    degrees:

    angle of axes relative to upright axes

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. setRotate(self: skia.Matrix, degrees: float) -> skia.Matrix

    Sets Matrix to rotate by degrees about a pivot point at (0, 0).

    Positive degrees rotates clockwise.

    degrees:

    angle of axes relative to upright axes

Matrix.setScale(*args, **kwargs)

Overloaded function.

  1. setScale(self: skia.Matrix, sx: float, sy: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to scale by sx and sy, about a pivot point at (px, py).

    The pivot point is unchanged when mapped with Matrix.

    sx:

    horizontal scale factor

    sy:

    vertical scale factor

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. setScale(self: skia.Matrix, sx: float, sy: float) -> skia.Matrix

    Sets Matrix to scale by sx and sy about at pivot point at (0, 0).

    sx:

    horizontal scale factor

    sy:

    vertical scale factor

Matrix.setScaleTranslate(self: skia.Matrix, sx: float, sy: float, tx: float, ty: float) None

Initializes Matrix with scale and translate elements.

sx 0 tx |
0 sy ty |
0 0 1 |
Parameters:
  • sx (float) – horizontal scale factor to store

  • sy (float) – vertical scale factor to store

  • tx (float) – horizontal translation to store

  • ty (float) – vertical translation to store

Matrix.setScaleX(self: skia.Matrix, v: float) skia.Matrix

Sets horizontal scale factor.

Parameters:

v (float) – horizontal scale factor to store

Matrix.setScaleY(self: skia.Matrix, v: float) skia.Matrix

Sets vertical scale factor.

Parameters:

v (float) – vertical scale factor to store

Matrix.setSinCos(*args, **kwargs)

Overloaded function.

  1. setSinCos(self: skia.Matrix, sinValue: float, cosValue: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py).

    The pivot point is unchanged when mapped with Matrix.

    Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). Vector length specifies scale.

    sinValue:

    rotation vector x-axis component

    cosValue:

    rotation vector y-axis component

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. setSinCos(self: skia.Matrix, sinValue: float, cosValue: float) -> skia.Matrix

    Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (0, 0).

    Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). Vector length specifies scale.

    sinValue:

    rotation vector x-axis component

    cosValue:

    rotation vector y-axis component

Matrix.setSkew(*args, **kwargs)

Overloaded function.

  1. setSkew(self: skia.Matrix, kx: float, ky: float, px: float, py: float) -> skia.Matrix

    Sets Matrix to skew by kx and ky, about a pivot point at (px, py).

    The pivot point is unchanged when mapped with Matrix.

    kx:

    horizontal skew factor

    ky:

    vertical skew factor

    px:

    pivot on x-axis

    py:

    pivot on y-axis

  2. setSkew(self: skia.Matrix, kx: float, ky: float) -> skia.Matrix

    Sets Matrix to skew by kx and ky, about a pivot point at (0, 0).

    kx:

    horizontal skew factor

    ky:

    vertical skew factor

Matrix.setSkewX(self: skia.Matrix, v: float) skia.Matrix

Sets horizontal skew factor.

Parameters:

v (float) – horizontal skew factor to store

Matrix.setSkewY(self: skia.Matrix, v: float) skia.Matrix

Sets vertical skew factor.

Parameters:

v – vertical skew factor to store

Matrix.setTranslate(*args, **kwargs)

Overloaded function.

  1. setTranslate(self: skia.Matrix, dx: float, dy: float) -> skia.Matrix

    Sets Matrix to translate by (dx, dy).

    dx:

    horizontal translation

    dy:

    vertical translation

  2. setTranslate(self: skia.Matrix, v: skia.Point) -> skia.Matrix

    Sets Matrix to translate by (v.fX, v.fY).

    v:

    vector containing horizontal and vertical translation

Matrix.setTranslateX(self: skia.Matrix, v: float) skia.Matrix

Sets horizontal translation.

Parameters:

v (float) – horizontal translation to store

Matrix.setTranslateY(self: skia.Matrix, v: float) skia.Matrix

Sets vertical translation.

Parameters:

v (float) – vertical translation to store

Attributes

Matrix.kAScaleX = 0
Matrix.kAScaleY = 3
Matrix.kASkewX = 2
Matrix.kASkewY = 1
Matrix.kATransX = 4
Matrix.kATransY = 5
Matrix.kAffine_Mask = <TypeMask.kAffine_Mask: 4>
Matrix.kCenter_ScaleToFit = <ScaleToFit.kCenter_ScaleToFit: 2>
Matrix.kEnd_ScaleToFit = <ScaleToFit.kEnd_ScaleToFit: 3>
Matrix.kFill_ScaleToFit = <ScaleToFit.kFill_ScaleToFit: 0>
Matrix.kIdentity_Mask = <TypeMask.kIdentity_Mask: 0>
Matrix.kMPersp0 = 6
Matrix.kMPersp1 = 7
Matrix.kMPersp2 = 8
Matrix.kMScaleX = 0
Matrix.kMScaleY = 4
Matrix.kMSkewX = 1
Matrix.kMSkewY = 3
Matrix.kMTransX = 2
Matrix.kMTransY = 5
Matrix.kPerspective_Mask = <TypeMask.kPerspective_Mask: 8>
Matrix.kScale_Mask = <TypeMask.kScale_Mask: 2>
Matrix.kStart_ScaleToFit = <ScaleToFit.kStart_ScaleToFit: 1>
Matrix.kTranslate_Mask = <TypeMask.kTranslate_Mask: 1>