Matrix class

Inheritance

Constructors

Matrix.concat(Matrix a, Matrix b)
factory
Matrix.create()
factory
Matrix.fromPointer(mnn_cv_matrix_t ptr, {bool attach = true, int? externalSize})
Matrix.I()
factory
Matrix.makeAll(double scaleX, double skewX, double transX, double skewY, double scaleY, double transY, double persp0, double persp1, double persp2)
factory
Matrix.makeRectToRect(Rect src, Rect dst, ScaleToFit scaleToFit)
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:
factory
Matrix.makeScale(double scale)
Sets Matrix to scale by (scale, scale). Returned matrix is:
factory
Matrix.makeScaleXY({required double sx, double sy = 1})
Sets Matrix to scale by (sx, sy). Returned matrix is:
factory
Matrix.makeTrans(double dx, double dy)
Sets Matrix to translate by (dx, dy). Returned matrix is:
factory

Properties

attach bool
finalinherited
finalizer NativeFinalizer
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
no setterinherited
isIdentity bool
Returns true if Matrix is identity. Identity matrix is:
no setter
isScaleTranslate 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:
no setter
isTranslate bool
Returns true if Matrix is identity, or translates. Matrix form is:
no setter
perspX double
getter/setter pair
perspY double
getter/setter pair
props List<Object?>
no setteroverride
ptr Pointer<Void>
Gets the pointer to the underlying C++ object
no setterinherited
rectStaysRect 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:
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleX double
Returns scale factor multiplied by x-axis input, contributing to x-axis output. With mapPoints(), scales Point along the x-axis.
getter/setter pair
scaleY double
Returns scale factor multiplied by y-axis input, contributing to y-axis output. With mapPoints(), scales Point along the y-axis.
getter/setter pair
skewX double
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.
getter/setter pair
skewY double
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.
getter/setter pair
translateX double
Returns translation contributing to x-axis output. With mapPoints(), moves Point along the x-axis.
getter/setter pair
translateY double
getter/setter pair
type TypeMask
Returns a bit field describing the transformations the matrix may perform. The bit field is computed conservatively, so it may include false positives.
no setter

Methods

cheapEqualTo(Matrix other) bool
Returns true if Matrix equals m, using an efficient comparison.
dirtyMatrixTypeCache() → void
Sets internal cache to unknown state. Use to force update after repeated modifications to Matrix element reference returned by operator[](int index).
dispose() → void
inherited
get(int index) double
get9() List<double>
Copies nine scalar values contained by Matrix into buffer, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.
invert() → (bool, Matrix)
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.
mapPoints(List<Point> src, {bool inplace = false}) List<Point>
Maps src Point array of length count to dst Point array of equal or greater length. Point are mapped by multiplying each Point by Matrix. Given:
mapRect(Rect src) → (bool, Rect)
Sets dst to bounds of src corners mapped by Matrix. Returns true if mapped corners are dst corners.
mapRectScaleTranslate(Rect src) Rect
Sets dst to 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.
mapXY(double x, double y) Point
Returns Point (x, y) multiplied by Matrix. Given:
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postConcat(Matrix other) → void
Sets Matrix to Matrix other multiplied by Matrix. This can be thought of mapping by other after applying Matrix.
postIDiv(int divx, int divy) → void
Sets Matrix to Matrix constructed from scaling by (1/divx, 1/divy) about pivot point (px, py), multiplied by Matrix.
postRotate(double degrees, {double px = 0, double py = 0}) → void
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.
postScale(double sx, double sy, {double px = 0, double py = 0}) → void
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.
postSkew(double kx, double ky, {double px = 0, double py = 0}) → void
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.
postTranslate(double dx, double dy) → void
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.
preConcat(Matrix other) → void
Sets Matrix to Matrix multiplied by Matrix other. This can be thought of mapping by other before applying Matrix.
preRotate(double degrees, {double px = 0, double py = 0}) → void
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.
preScale(double sx, double sy, {double px = 0, double py = 0}) → void
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.
preSkew(double kx, double ky, {double px = 0, double py = 0}) → void
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.
preTranslate(double dx, double dy) → void
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.
reattach(Pointer<Void> ptr) → void
inherited
release() → void
Releases the underlying C++ object Subclasses must implement specific release logic
override
reset() → void
Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to:
set(int index, double value) → void
set9(List<double> values) → void
Sets Matrix to nine scalar values in buffer, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.
setAll({double scaleX = 1, double scaleY = 1, double skewX = 0, double skewY = 0, double translateX = 0, double translateY = 0, double persp0 = 0, double persp1 = 0, double persp2 = 0}) → void
Sets all values from parameters. Sets matrix to:
setConcat(Matrix a, Matrix b) → void
Sets Matrix to Matrix a multiplied by Matrix b. Either a or b may be this.
setIdentity() → void
Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to:
setPolyToPoly(List<Point> src, List<Point> dst, {int? count}) bool
Sets Matrix to map src to dst. count must be zero or greater, and four or less.
setRectToRect(Rect src, Rect dst, ScaleToFit 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:
setRotate(double degrees, {double px = 0, double py = 0}) → void
Sets Matrix to rotate by degrees about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.
setScale(double sx, double sy, {double px = 0, double py = 0}) → void
Sets Matrix to scale by sx and sy, about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.
setScaleTranslate(double sx, double sy, double dx, double dy) → void
Initializes Matrix with scale and translate elements.
setSinCos(double sin, double cos, {double px = 0, double py = 0}) → void
Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.
setSkew(double kx, double ky, {double px = 0, double py = 0}) → void
Sets Matrix to skew by kx and ky, about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.
setTranslate(double dx, double dy) → void
Sets Matrix to translate by (dx, dy).
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

kAScaleX → const int
horizontal scale factor
kAScaleY → const int
vertical scale factor
kASkewX → const int
horizontal skew factor
kASkewY → const int
vertical skew factor
kATransX → const int
horizontal translation
kATransY → const int
vertical translation
kMPersp0 → const int
input x perspective factor
kMPersp1 → const int
input y perspective factor
kMPersp2 → const int
perspective bias Affine arrays are in column major order to match the matrix used by PDF and XPS.
kMScaleX → const int
horizontal scale factor
kMScaleY → const int
vertical scale factor
kMSkewX → const int
horizontal skew factor
kMSkewY → const int
vertical skew factor
kMTransX → const int
horizontal translation
kMTransY → const int
vertical translation