跳到主要内容

Matrix

declare class Matrix {}

Matrix math utilities

Instance Method

constructor

declare class Matrix {
constructor();
}
  • Description

    Create a new matrix instance.

reset

declare class Matrix {
reset(): void
}
  • Description

    Resets the this to the identity matrix.

setTranslate

declare class Matrix {
setTranslate(dx: number, dy: number): void
}
  • Description

    Set the matrix to translate by (dx, dy).

setScale

declare class Matrix {
setScale(sx: number, sy: number): void
}
  • Description

    Set the matrix to scale by sx and sy.

setScale

declare class Matrix {
setScale(sx: number, sy: number, px: number, py: number): void
}
  • Description

    Set the matrix to scale by sx and sy, with a pivot point at (px, py).

setRotate

declare class Matrix {
setRotate(degrees: number): void
}
  • Description

    Set the matrix to rotate about (0,0) by the specified number of degrees.

setRotate

declare class Matrix {
setRotate(degrees: number, px: number, py: number): void
}
  • Description

    Set the matrix to rotate by the specified number of degrees, with a pivot point at (px, py).

setSinCos

declare class Matrix {
setSinCos(sinValue: number, cosValue: number): void
}
  • Description

    Set the matrix to rotate by the specified sine and cosine values.

setSinCos

declare class Matrix {
setSinCos(sinValue: number, cosValue: number, px: number, py: number): void
}
  • Description

    Set the matrix to rotate by the specified sine and cosine values, with a pivot point at (px, py).

setSkew

declare class Matrix {
setSkew(kx: number, ky: number): void
}
  • Description

    Set the matrix to skew by sx and sy.

setSkew

declare class Matrix {
setSkew(kx: number, ky: number, px: number, py: number): void
}
  • Description

    Set the matrix to skew by sx and sy, with a pivot point at (px, py).

setConcat

declare class Matrix {
setConcat(a: Matrix, b: Matrix): void
}
  • Description

    Set the matrix to the concatenation of the two specified matrices and return true.

preTranslate

declare class Matrix {
preTranslate(dx: number, dy: number): void
}
  • Description

    Preconcats the matrix with the specified translation.

preScale

declare class Matrix {
preScale(sx: number, sy: number): void;
preScale(sx: number, sy: number, px: number, py: number): void
}
  • Description

    Preconcats the matrix with the specified scale.

preRotate

declare class Matrix {
preRotate(degrees: number): void;
preRotate(degrees: number, px: number, py: number): void;
}
  • Description

    Preconcats the matrix with the specified rotation.

preSkew

declare class Matrix {
preSkew(kx: number, ky: number): void
preSkew(kx: number, ky: number, px: number, py: number): void
}
  • Description

    Preconcats the matrix with the specified skew.

preConcat

declare class Matrix {
preConcat(other: Matrix): number
}
  • Description

    Preconcats the matrix with the specified matrix.

postTranslate

declare class Matrix {
postTranslate(dx: number, dy: number): void
}
  • Description

    Postconcats the matrix with the specified translation.

postScale

declare class Matrix {
postScale(sx: number, sy: number): void;
postScale(sx: number, sy: number, px: number, py: number): void;
}
  • Description

    Postconcats the matrix with the specified scale.

postRotate

declare class Matrix {
postRotate(degrees: number): void
postRotate(degrees: number, px: number, py: number): void
}
  • Description

    Postconcats the matrix with the specified rotation.

postSkew

declare class Matrix {
postSkew(kx: number, ky: number): void
postSkew(kx: number, ky: number, px: number, py: number): void
}
  • Description

    Postconcats the matrix with the specified skew.

postConcat

declare class Matrix {
postConcat(other: Matrix): number
}
  • Description

    Postconcats the matrix with the specified matrix.

invert

declare class Matrix {
invert(inverse: Matrix): void
}
  • Description

    If this matrix can be inverted, return true and if inverse is not null, set inverse to be the inverse of this matrix.

mapPoints

declare class Matrix {
mapPoints(pts: number[][]): void
}
  • Description

    Apply this matrix to the array of 2D points, and write the transformed points back into the array.

mapPoints

declare class Matrix {
mapPoints(dst: number[][], src: number[][]): void
mapPoints(dst: number[][], dstIndex: number, src: number[][], srcIndex: number, pointCount: number): void
}
  • Description

    Apply this matrix to the array of 2D points specified by src, and write the transformed points into the array of points specified by dst.

mapVectors

declare class Matrix {
mapVectors(vecs: number[][]): void
}
  • Description

    Apply this matrix to the array of 2D vectors, and write the transformed vectors back into the array.

mapVectors

declare class Matrix {
mapVectors(dst: number[][], src: number[][]): void;
mapVectors(dst: number[][], dstIndex: number, src: number[][], srcIndex: number, vectorCount: number): void;
}
  • Description

    Apply this matrix to the array of 2D vectors specified by src, and write the transformed vectors into the array of vectors specified by dst.

mapRect

declare class Matrix {
mapRect(rect: Rect): void
}
  • Description

    Apply this matrix to the rectangle, and write the transformed rectangle back into it.

mapRect

declare class Matrix {
mapRect(dst: Rect, src: Rect): void
}
  • Description

    Apply this matrix to the src rectangle, and write the transformed rectangle into dst.

mapRadius

declare class Matrix {
mapRadius(radius: number): number
}
  • Description

    Return the mean radius of a circle after it has been mapped by this matrix.

getValues

declare class Matrix {
getValues(accept: number[]): number[]
}
  • Description

    Copy 9 values from the matrix into the array.

setValues

declare class Matrix {
setValues(values: number[]): void
}
  • Description

    Copy 9 values from the array into the matrix.

setRectToRect

declare class Matrix {
setRectToRect(src: Rect, dst: Rect, stf: Matrix.ScaleToFit): boolean
}
  • Description

    Set the matrix to the scale and translate values that map the source rectangle to the destination rectangle, returning true if the the result can be represented.

setPolyToPoly

declare class Matrix {
setPolyToPoly(src: number[][], srcIndex: number, dst: number[][], dstIndex: number, pointCount: number): boolean
}
  • Description

    Set the matrix such that the specified src points would map to the specified dst points.

equals

declare class Matrix {
equals(target: Matrix): boolean
}
  • Description

    Returns true iff obj is a Matrix and its values equal our values.