风流的棒棒糖 · 于欢- 君泽君律师事务所· 5 月前 · |
聪明伶俐的沙发 · 上市公司收购管理办法_中国证券监督管理委员会· 1 年前 · |
豪情万千的眼镜 · How I install ...· 1 年前 · |
个性的鸡蛋面 · 【破壁机的做法大全_破壁机怎么做好吃_家常做 ...· 1 年前 · |
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
Members:
Members:
Methods
Returns
Matrix
a multiplied by
Matrix
b.
Returns reference to const identity
Matrix
.
Returns reference to a const
Matrix
with invalid values.
Sets
Matrix
to.
Returns
Matrix
set to scale and translate src
Rect
to dst
Rect
.
Overloaded function.
Sets
Matrix
to scale by (sx, sy).
Fills affine with identity values in column major order.
Overloaded function.
Overloaded function.
Fills affine in column major order.
Decomposes
Matrix
into scale components and whatever remains.
Sets internal cache to unknown state.
Writes text representation of
Matrix
to standard output.
Returns one matrix value.
Returns nine scalar values contained by
Matrix
into list, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.
Returns the maximum scaling factor of
Matrix
by decomposing the scaling and skewing elements.
Returns the minimum scaling factor and the maximum scaling factor.
Returns the minimum scaling factor of
Matrix
by decomposing the scaling and skewing elements.
Returns factor scaling input x-axis relative to input y-axis.
Returns factor scaling input y-axis relative to input x-axis.
Returns scale factor multiplied by x-axis input, contributing to x-axis output.
Returns scale factor multiplied by y-axis input, contributing to y-axis output.
Returns scale factor multiplied by y-axis input, contributing to x-axis output.
Returns scale factor multiplied by x-axis input, contributing to y-axis output.
Returns translation contributing to x-axis output.
Returns translation contributing to y-axis output.
Returns a bit field describing the transformations the matrix may perform.
Returns true if the matrix contains perspective elements.
Sets inverse to reciprocal matrix, returning true if
Matrix
can be inverted.
Returns true if all elements of the matrix are finite.
Returns true if
Matrix
is identity.
Returns true if
Matrix
at most scales and translates.
Returns true if
Matrix
contains only translation, rotation, reflection, and uniform scale.
Returns true if
Matrix
is identity, or translates.
Overloaded function.
Takes src
Point
array and returns mapped
Point
array.
Returns geometric mean radius of ellipse formed by constructing circle of size radius, and mapping constructed circle with
Matrix
.
Returns bounds of src corners mapped by
Matrix
.
Returns bounds of src corners mapped by
Matrix
.
Maps four corners of rect to dst.
Returns vector (dx, dy) multiplied by
Matrix
, treating
Matrix
translation as zero.
Maps src vector array to vector
Point
array.
Returns
Point
(x, y) multiplied by
Matrix
.
A matrix is categorized as 'perspective' if the bottom row is not [0, 0, 1].
Sets
Matrix
to
Matrix
other multiplied by
Matrix
.
Overloaded function.
Overloaded function.
Overloaded function.
Sets
Matrix
to
Matrix
constructed from translation (dx, dy) multiplied by
Matrix
.
Sets
Matrix
to
Matrix
multiplied by
Matrix
other.
Overloaded function.
Overloaded function.
Overloaded function.
Sets
Matrix
to
Matrix
multiplied by
Matrix
constructed from translation (dx, dy).
Returns true
Matrix
maps
Rect
to another
Rect
.
Returns true if
Matrix
contains only translation, rotation, reflection, and scale.
Returns one matrix value from a particular row/column.
Returns true SkMatrix maps SkRect to another SkRect.
Sets
Matrix
to identity; which has no effect on mapped
Point
.
Returns writable
Matrix
value.
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 affine values, passed in column major order.
Sets all values from parameters.
Sets
Matrix
to
Matrix
a multiplied by
Matrix
b.
Sets
Matrix
to identity; which has no effect on mapped
Point
.
Sets input x-axis perspective factor, which causes mapXY() to vary input x-axis values inversely proportional to input y-axis values.
Sets input y-axis perspective factor, which causes mapXY() to vary input y-axis values inversely proportional to input x-axis values.
Sets
Matrix
to map src to dst.
Sets
Matrix
to rotate, scale, and translate using a compressed matrix form.
Sets
Matrix
to scale and translate src
Rect
to dst
Rect
.
Overloaded function.
Overloaded function.
Initializes
Matrix
with scale and translate elements.
Sets horizontal scale factor.
Sets vertical scale factor.
Overloaded function.
Overloaded function.
Sets horizontal skew factor.
Sets vertical skew factor.
Overloaded function.
Sets horizontal translation.
Sets vertical translation.
Attributes
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:
a (skia.Matrix) – Matrix
on left side of multiply
expression
b (skia.Matrix) – Matrix
on right side of multiply
expression
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:
stf (skia.Matrix.ScaleToFit) – fill option
Returns:
Matrix
mapping src to dst
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
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:
scale (skia.Size) – axes scaling factors; may be nullptr
remaining (skia.Matrix) – Matrix
without scaling; may be
nullptr
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
Overloaded function.
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
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:
src (skia.Rect) – rectangle to map
pc (skia.ApplyPerspectiveClip) – whether to apply perspective
clipping
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:
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
Overloaded function.
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
pivot on x-axis
pivot on y-axis
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
Overloaded function.
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 |
horizontal scale factor
vertical scale factor
pivot on x-axis
pivot on y-axis
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 |
horizontal scale factor
vertical scale factor
Overloaded function.
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|
horizontal skew factor
vertical skew factor
pivot on x-axis
pivot on y-axis
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 |
horizontal skew factor
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
Overloaded function.
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
pivot on x-axis
pivot on y-axis
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: