Added in API level 1

Matrix


open class Matrix
kotlin.Any
   ↳ android.graphics.Matrix

The Matrix class holds a 3x3 matrix for transforming coordinates.

Summary

Nested classes

Controls how the src rect should align into the dst rect for setRectToRect().

Constants
static Int

static Int

static Int

static Int

static Int

static Int

static Int

static Int

static Int

Public constructors

Create an identity matrix

Matrix(src: Matrix!)

Create a matrix that is a (deep) copy of src

Public methods
Unit

Dumps a human-readable shortened string of the matrix into the given stream

open Boolean
equals(other: Any?)

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

open Unit

Copy 9 values from the matrix into the array.

open Int

Returns a hash code value for the object.

open Boolean
invert(inverse: Matrix!)

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

open Boolean

Gets whether this matrix is affine.

open Boolean

Returns true if the matrix is identity.

open Unit

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

open Unit

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.

open Unit
mapPoints(dst: FloatArray!, dstIndex: Int, src: FloatArray!, srcIndex: Int, pointCount: Int)

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.

open Float
mapRadius(radius: Float)

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

open Boolean
mapRect(rect: RectF!)

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

open Boolean
mapRect(dst: RectF!, src: RectF!)

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

open Unit

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

open Unit

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.

open Unit
mapVectors(dst: FloatArray!, dstIndex: Int, src: FloatArray!, srcIndex: Int, vectorCount: Int)

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.

open Boolean
postConcat(other: Matrix!)

Postconcats the matrix with the specified matrix.

open Boolean
postRotate(degrees: Float)

Postconcats the matrix with the specified rotation.

open Boolean
postRotate(degrees: Float, px: Float, py: Float)

Postconcats the matrix with the specified rotation.

open Boolean
postScale(sx: Float, sy: Float)

Postconcats the matrix with the specified scale.

open Boolean
postScale(sx: Float, sy: Float, px: Float, py: Float)

Postconcats the matrix with the specified scale.

open Boolean
postSkew(kx: Float, ky: Float)

Postconcats the matrix with the specified skew.

open Boolean
postSkew(kx: Float, ky: Float, px: Float, py: Float)

Postconcats the matrix with the specified skew.

open Boolean

Postconcats the matrix with the specified translation.

open Boolean
preConcat(other: Matrix!)

Preconcats the matrix with the specified matrix.

open Boolean
preRotate(degrees: Float)

Preconcats the matrix with the specified rotation.

open Boolean
preRotate(degrees: Float, px: Float, py: Float)

Preconcats the matrix with the specified rotation.

open Boolean
preScale(sx: Float, sy: Float)

Preconcats the matrix with the specified scale.

open Boolean
preScale(sx: Float, sy: Float, px: Float, py: Float)

Preconcats the matrix with the specified scale.

open Boolean
preSkew(kx: Float, ky: Float)

Preconcats the matrix with the specified skew.

open Boolean
preSkew(kx: Float, ky: Float, px: Float, py: Float)

Preconcats the matrix with the specified skew.

open Boolean

Preconcats the matrix with the specified translation.

open Boolean

Returns true if will map a rectangle to another rectangle.

open Unit

Set the matrix to identity

open Unit
set(src: Matrix!)

(deep) copy the src matrix into this matrix.

open Boolean
setConcat(a: Matrix!, b: Matrix!)

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

open Boolean
setPolyToPoly(src: FloatArray!, srcIndex: Int, dst: FloatArray!, dstIndex: Int, pointCount: Int)

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

open Boolean
setRectToRect(src: RectF!, dst: RectF!, stf: Matrix.ScaleToFit!)

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

open Unit
setRotate(degrees: Float)

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

open Unit
setRotate(degrees: Float, px: Float, py: Float)

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

open Unit
setScale(sx: Float, sy: Float)

Set the matrix to scale by sx and sy.

open Unit
setScale(sx: Float, sy: Float, px: Float, py: Float)

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

open Unit
setSinCos(sinValue: Float, cosValue: Float)

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

open Unit
setSinCos(sinValue: Float, cosValue: Float, px: Float, py: Float)

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

open Unit
setSkew(kx: Float, ky: Float)

Set the matrix to skew by sx and sy.

open Unit
setSkew(kx: Float, ky: Float, px: Float, py: Float)

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

open Unit

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

open Unit

Copy 9 values from the array into the matrix.

open String!

open String

Returns a string representation of the object.

Properties
static Matrix

The identity matrix.

Constants

MPERSP_0

Added in API level 1
static val MPERSP_0: Int
Value: 6

MPERSP_1

Added in API level 1
static val MPERSP_1: Int
Value: 7

MPERSP_2

Added in API level 1
static val MPERSP_2: Int
Value: 8

MSCALE_X

Added in API level 1
static val MSCALE_X: Int
Value: 0

MSCALE_Y

Added in API level 1
static val MSCALE_Y: Int
Value: 4

MSKEW_X

Added in API level 1
static val MSKEW_X: Int
Value: 1

MSKEW_Y

Added in API level 1
static val MSKEW_Y: Int
Value: 3

MTRANS_X

Added in API level 1
static val MTRANS_X: Int
Value: 2

MTRANS_Y

Added in API level 1
static val MTRANS_Y: Int
Value: 5

Public constructors

Matrix

Added in API level 1
Matrix()

Create an identity matrix

Matrix

Added in API level 1
Matrix(src: Matrix!)

Create a matrix that is a (deep) copy of src

Parameters
src Matrix!: The matrix to copy into this matrix

Public methods

dump

Added in API level 31
fun dump(pw: PrintWriter): Unit

Dumps a human-readable shortened string of the matrix into the given stream

Parameters
pw PrintWriter: The PrintWriter into which the string representation of the matrix will be written.
This value cannot be null.

equals

Added in API level 1
open fun equals(other: Any?): Boolean

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

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getValues

Added in API level 1
open fun getValues(values: FloatArray!): Unit

Copy 9 values from the matrix into the array.

hashCode

Added in API level 1
open fun hashCode(): Int

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The gen