animator.skia.Matrix

class animator.skia.Matrix

Bases: pybind11_builtins.pybind11_object

__init__(*args, **kwargs)

Overloaded function.

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

Creates a Matrix from 3x3 float32 NumPy array.

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

Methods

Concat(a, b)

I()

InvalidMatrix()

MakeAll(scaleX, skewX, transX, skewY, ...)

MakeRectToRect(src, dst, stf)

RectToRect(src, dst, mode)

RotateDeg(*args, **kwargs)

Overloaded function.

RotateRad(rad)

Scale(sx, sy)

SetAffineIdentity()

Returns affine with identity values in column major order.

Skew(kx, ky)

Translate(*args, **kwargs)

Overloaded function.

__init__(*args, **kwargs)

Overloaded function.

asAffine(self)

Returns affine in column major order.

decomposeScale(self)

Decomposes Matrix into scale components and whatever remains.

dirtyMatrixTypeCache(self)

dump(self)

get(self, index)

get9(self)

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

getMaxScale(self)

getMinMaxScales(self)

Returns a tuple of (minimum scaling factor, maximum scaling factor).

getMinScale(self)

getPerspX(self)

getPerspY(self)

getScaleX(self)

getScaleY(self)

getSkewX(self)

getSkewY(self)

getTranslateX(self)

getTranslateY(self)

getType(self)

hasPerspective(self)

invert(self, inverse)

isFinite(self)

isIdentity(self)

isScaleTranslate(self)

isSimilarity(self[, tol])

isTranslate(self)

makeInverse(self)

Returns the inverse of the matrix.

mapHomogeneousPoints(*args, **kwargs)

Overloaded function.

mapOrigin(self)

mapPoint(self, pt)

mapPoints(self, pts)

Maps src list of Point and returns a new list of Point.

mapRadius(self, radius)

mapRect(self, src, pc)

mapRectScaleTranslate(self, src)

Returns bounds of src corners mapped by Matrix.

mapRectToQuad(self, rect)

Maps four corners of rect to a list of 4 Point.

mapVector(self, dx, dy)

mapVectors(self, vecs)

Maps vecs list of Point and returns a new list of Point, multiplying each vector by Matrix, treating translation as zero.

mapXY(self, x, y)

normalizePerspective(self)

postConcat(self, other)

postRotate(*args, **kwargs)

Overloaded function.

postScale(*args, **kwargs)

Overloaded function.

postSkew(*args, **kwargs)

Overloaded function.

postTranslate(self, dx, dy)

preConcat(self, other)

preRotate(*args, **kwargs)

Overloaded function.

preScale(*args, **kwargs)

Overloaded function.

preSkew(*args, **kwargs)

Overloaded function.

preTranslate(self, dx, dy)

preservesAxisAlignment(self)

preservesRightAngles(self[, tol])

rc(self, r, c)

rectStaysRect(self)

reset(self)

set(self, index, value)

set9(self, buffer)

setAffine(self, affine)

setAll(self, scaleX, skewX, transX, skewY, ...)

setConcat(self, a, b)

setIdentity(self)

setPerspX(self, v)

setPerspY(self, v)

setPolyToPoly(self, src, dst)

setRSXform(self, rsxForm)

setRectToRect(self, src, dst, stf)

setRotate(*args, **kwargs)

Overloaded function.

setScale(*args, **kwargs)

Overloaded function.

setScaleTranslate(self, sx, sy, tx, ty)

setScaleX(self, v)

setScaleY(self, v)

setSinCos(*args, **kwargs)

Overloaded function.

setSkew(*args, **kwargs)

Overloaded function.

setSkewX(self, v)

setSkewY(self, v)

setTranslate(*args, **kwargs)

Overloaded function.

setTranslateX(self, v)

setTranslateY(self, v)

Attributes

kAScaleX

kAScaleY

kASkewX

kASkewY

kATransX

kATransY

kMPersp0

kMPersp1

kMPersp2

kMScaleX

kMScaleY

kMSkewX

kMSkewY

kMTransX

kMTransY

static Concat(a: animator.skia.Matrix, b: animator.skia.Matrix) animator.skia.Matrix
static I() animator.skia.Matrix
static InvalidMatrix() animator.skia.Matrix
static MakeAll(scaleX: float, skewX: float, transX: float, skewY: float, scaleY: float, transY: float, pers0: float, pers1: float, pers2: float) animator.skia.Matrix
static MakeRectToRect(src: animator.skia.Rect, dst: animator.skia.Rect, stf: animator.skia.Matrix.ScaleToFit) animator.skia.Matrix
static RectToRect(src: animator.skia.Rect, dst: animator.skia.Rect, mode: animator.skia.Matrix.ScaleToFit = <ScaleToFit.kFill_ScaleToFit: 0>) animator.skia.Matrix
static RotateDeg(*args, **kwargs)

Overloaded function.

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

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

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

Bases: pybind11_builtins.pybind11_object

Members:

kFill_ScaleToFit

kStart_ScaleToFit

kCenter_ScaleToFit

kEnd_ScaleToFit

property name
static SetAffineIdentity() List[float]

Returns affine with identity values in column major order. Sets affine to:

1 0 0 |
0 1 0 |
Returns

list of 6 floats

static Skew(kx: float, ky: float) animator.skia.Matrix
static Translate(*args, **kwargs)

Overloaded function.

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

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

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

class TypeMask

Bases: pybind11_builtins.pybind11_object

Members:

kIdentity_Mask

kTranslate_Mask

kScale_Mask

kAffine_Mask

kPerspective_Mask

property name
asAffine(self: animator.skia.Matrix) Optional[List[float]]

Returns 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 6 floats or None

Return type

list | None

decomposeScale(self: animator.skia.Matrix) Optional[tuple]

Decomposes Matrix into scale components and whatever remains. Returns None if Matrix could not be decomposed.

Returns

tuple of (axes scaling factors, Matrix without scaling) or None

Return type

(Size, Matrix) | None

dirtyMatrixTypeCache(self: animator.skia.Matrix) None
dump(self: animator.skia.Matrix) None
get(self: animator.skia.Matrix, index: int) float
get9(self: animator.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.

getMaxScale(self: animator.skia.Matrix) float
getMinMaxScales(self: animator.skia.Matrix) Optional[tuple]

Returns a tuple of (minimum scaling factor, maximum scaling factor). Return None if scale factors are not found.

Returns

minimum and maximum scale factors

Return type

(float, float) | None

getMinScale(self: animator.skia.Matrix) float
getPerspX(self: animator.skia.Matrix) float
getPerspY(self: animator.skia.Matrix) float
getScaleX(self: animator.skia.Matrix) float
getScaleY(self: animator.skia.Matrix) float
getSkewX(self: animator.skia.Matrix) float
getSkewY(self: animator.skia.Matrix) float
getTranslateX(self: animator.skia.Matrix) float
getTranslateY(self: animator.skia.Matrix) float
getType(self: animator.skia.Matrix) animator.skia.Matrix.TypeMask
hasPerspective(self: animator.skia.Matrix) bool
invert(self: animator.skia.Matrix, inverse: animator.skia.Matrix) bool
isFinite(self: animator.skia.Matrix) bool
isIdentity(self: animator.skia.Matrix) bool
isScaleTranslate(self: animator.skia.Matrix) bool
isSimilarity(self: animator.skia.Matrix, tol: float = 0.000244140625) bool
isTranslate(self: animator.skia.Matrix) bool
makeInverse(self: animator.skia.Matrix) animator.skia.Matrix

Returns the inverse of the matrix. If the matrix is singular, throws a ValueError.

Returns

The inverse of the matrix.

mapHomogeneousPoints(*args, **kwargs)

Overloaded function.

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

    Maps src list of Point3 and returns a new list of Point3.

    param src

    list of Point3 to transform

    return

    list of mapped Point3

  2. mapHomogeneousPoints(self: animator.skia.Matrix, src: List[animator.skia.Point]) -> List[animator.skia.Point3]

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

mapOrigin(self: animator.skia.Matrix) animator.skia.Point
mapPoint(self: animator.skia.Matrix, pt: animator.skia.Point) animator.skia.Point
mapPoints(self: animator.skia.Matrix, pts: List[animator.skia.Point]) List[animator.skia.Point]

Maps src list of Point and returns a new list of Point.

Parameters

src – list of Point to transform

Returns

list of mapped Point

mapRadius(self: animator.skia.Matrix, radius: float) float
mapRect(self: animator.skia.Matrix, src: animator.skia.Rect, pc: animator.skia.ApplyPerspectiveClip = <ApplyPerspectiveClip.kYes: 1>) animator.skia.Rect
mapRectScaleTranslate(self: animator.skia.Matrix, src: animator.skia.Rect) animator.skia.Rect

Returns bounds of src corners mapped by Matrix.

Parameters

srcRect to map

Returns

bounds of mapped Point

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

Maps four corners of rect to a list of 4 Point.

Parameters

rectRect to map

Returns

mapped corner Point

mapVector(self: animator.skia.Matrix, dx: float, dy: float) animator.skia.Point
mapVectors(self: animator.skia.Matrix, vecs: List[animator.skia.Point]) List[animator.skia.Point]

Maps vecs list of Point and returns a new list of Point, multiplying each vector by Matrix, treating translation as zero.

Parameters

vecs – list of Point to transform

Returns

list of transformed Point

mapXY(self: animator.skia.Matrix, x: float, y: float) animator.skia.Point
normalizePerspective(self: animator.skia.Matrix) None
postConcat(self: animator.skia.Matrix, other: animator.skia.Matrix) animator.skia.Matrix
postRotate(*args, **kwargs)

Overloaded function.

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

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

postScale(*args, **kwargs)

Overloaded function.

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

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

postSkew(*args, **kwargs)

Overloaded function.

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

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

postTranslate(self: animator.skia.Matrix, dx: float, dy: float) animator.skia.Matrix
preConcat(self: animator.skia.Matrix, other: animator.skia.Matrix) animator.skia.Matrix
preRotate(*args, **kwargs)

Overloaded function.

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

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

preScale(*args, **kwargs)

Overloaded function.

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

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

preSkew(*args, **kwargs)

Overloaded function.

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

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

preTranslate(self: animator.skia.Matrix, dx: float, dy: float) animator.skia.Matrix
preservesAxisAlignment(self: animator.skia.Matrix) bool
preservesRightAngles(self: animator.skia.Matrix, tol: float = 0.000244140625) bool
rc(self: animator.skia.Matrix, r: int, c: int) float
rectStaysRect(self: animator.skia.Matrix) bool
reset(self: animator.skia.Matrix) animator.skia.Matrix
set(self: animator.skia.Matrix, index: int, value: float) animator.skia.Matrix
set9(self: animator.skia.Matrix, buffer: List[float]) animator.skia.Matrix
setAffine(self: animator.skia.Matrix, affine: List[float]) animator.skia.Matrix
setAll(self: animator.skia.Matrix, scaleX: float, skewX: float, transX: float, skewY: float, scaleY: float, transY: float, persp0: float, persp1: float, persp2: float) animator.skia.Matrix
setConcat(self: animator.skia.Matrix, a: animator.skia.Matrix, b: animator.skia.Matrix) animator.skia.Matrix
setIdentity(self: animator.skia.Matrix) animator.skia.Matrix
setPerspX(self: animator.skia.Matrix, v: float) animator.skia.Matrix
setPerspY(self: animator.skia.Matrix, v: float) animator.skia.Matrix
setPolyToPoly(self: animator.skia.Matrix, src: List[animator.skia.Point], dst: List[animator.skia.Point]) bool
setRSXform(self: animator.skia.Matrix, rsxForm: animator.skia.RSXform) animator.skia.Matrix
setRectToRect(self: animator.skia.Matrix, src: animator.skia.Rect, dst: animator.skia.Rect, stf: animator.skia.Matrix.ScaleToFit) bool
setRotate(*args, **kwargs)

Overloaded function.

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

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

setScale(*args, **kwargs)

Overloaded function.

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

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

setScaleTranslate(self: animator.skia.Matrix, sx: float, sy: float, tx: float, ty: float) None
setScaleX(self: animator.skia.Matrix, v: float) animator.skia.Matrix
setScaleY(self: animator.skia.Matrix, v: float) animator.skia.Matrix
setSinCos(*args, **kwargs)

Overloaded function.

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

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

setSkew(*args, **kwargs)

Overloaded function.

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

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

setSkewX(self: animator.skia.Matrix, v: float) animator.skia.Matrix
setSkewY(self: animator.skia.Matrix, v: float) animator.skia.Matrix
setTranslate(*args, **kwargs)

Overloaded function.

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

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

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