Summary

Constants

const Int

Index of the flattened array that represents the perspective factor along the X axis

Cmn
const Int

Index of the flattened array that represents the perspective factor along the Y axis

Cmn
const Int

Index of the flattened array that represents the perspective factor along the Z axis

Cmn
const Int
ScaleX = 0

Index of the flattened array that represents the scale factor along the X axis

Cmn
const Int
ScaleY = 5

Index of the flattened array that represents the scale factor along the Y axis

Cmn
const Int
ScaleZ = 10

Index of the flattened array that represents the scale factor along the Z axis

Cmn
const Int
SkewX = 4

Index of the flattened array that represents the skew factor along the X axis

Cmn
const Int
SkewY = 1

Index of the flattened array that represents the skew factor along the Y axis

Cmn
const Int

Index of the flattened array that represents the translation along the X axis

Cmn
const Int

Index of the flattened array that represents the translation along the Y axis

Cmn
const Int

Index of the flattened array that represents the translation along the Z axis

Cmn

Public constructors

Matrix(values: FloatArray)
Cmn

Public functions

inline operator Float
get(row: Int, column: Int)
Cmn
Unit

Invert this Matrix.

Cmn
Offset
map(point: Offset)

Does the 3D transform on point and returns the x and y values in an Offset.

Cmn
Unit

Does a 3D transform on rect, transforming rect with the results.

Cmn
Rect
map(rect: Rect)

Does a 3D transform on rect and returns its bounds after the transform.

Cmn
Unit

Resets the this to the identity matrix.

Cmn
Unit
resetToPivotedTransform(
    pivotX: Float,
    pivotY: Float,
    translationX: Float,
    translationY: Float,
    translationZ: Float,
    rotationX: Float,
    rotationY: Float,
    rotationZ: Float,
    scaleX: Float,
    scaleY: Float,
    scaleZ: Float
)

Resets this matrix to a "TRS" (translation, rotation, scale) transform around a pivot point.

Cmn
Unit
rotateX(degrees: Float)

Applies a degrees rotation around X to this.

Cmn
Unit
rotateY(degrees: Float)

Applies a degrees rotation around Y to this.

Cmn
Unit
rotateZ(degrees: Float)

Applies a degrees rotation around Z to this.

Cmn
Unit
scale(x: Float, y: Float, z: Float)

Scale this matrix by x, y, z

Cmn
inline operator Unit
set(row: Int, column: Int, v: Float)
Cmn
Unit
setFrom(matrix: Matrix)

Sets the entire matrix to the matrix in matrix.

Cmn
operator Unit

Multiply this matrix by m and assign the result to this matrix.

Cmn
open String
Cmn
Unit
translate(x: Float, y: Float, z: Float)

Translate this matrix by x, y, z

Cmn

Public properties

FloatArray
Cmn

Extension functions

Unit

Set the matrix values the native android.graphics.Matrix.

android
Boolean

Whether the given matrix is the identity matrix.

Cmn

Constants

Perspective0

const val Perspective0 = 3: Int

Index of the flattened array that represents the perspective factor along the X axis

Perspective1

const val Perspective1 = 7: Int

Index of the flattened array that represents the perspective factor along the Y axis

Perspective2

const val Perspective2 = 15: Int

Index of the flattened array that represents the perspective factor along the Z axis

ScaleX

const val ScaleX = 0: Int

Index of the flattened array that represents the scale factor along the X axis

ScaleY

const val ScaleY = 5: Int

Index of the flattened array that represents the scale factor along the Y axis

ScaleZ

const val ScaleZ = 10: Int

Index of the flattened array that represents the scale factor along the Z axis

SkewX

const val SkewX = 4: Int

Index of the flattened array that represents the skew factor along the X axis

SkewY

const val SkewY = 1: Int

Index of the flattened array that represents the skew factor along the Y axis

TranslateX

const val TranslateX = 12: Int

Index of the flattened array that represents the translation along the X axis

TranslateY

const val TranslateY = 13: Int

Index of the flattened array that represents the translation along the Y axis

TranslateZ

const val TranslateZ = 14: Int

Index of the flattened array that represents the translation along the Z axis

Public constructors

Matrix

Matrix(
    values: FloatArray = floatArrayOf(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f)
)

Public functions

get

inline operator fun get(row: Int, column: Int): Float

invert

fun invert(): Unit

Invert this Matrix.

map

fun map(point: Offset): Offset

Does the 3D transform on point and returns the x and y values in an Offset.

map

fun map(rect: MutableRect): Unit

Does a 3D transform on rect, transforming rect with the results.

map

fun map(rect: Rect): Rect

Does a 3D transform on rect and returns its bounds after the transform.

reset

fun reset(): Unit

Resets the this to the identity matrix.

resetToPivotedTransform

fun resetToPivotedTransform(
    pivotX: Float = 0.0f,
    pivotY: Float = 0.0f,
    translationX: Float = 0.0f,
    translationY: Float = 0.0f,
    translationZ: Float = 0.0f,
    rotationX: Float = 0.0f,
    rotationY: Float = 0.0f,
    rotationZ: Float = 0.0f,
    scaleX: Float = 1.0f,
    scaleY: Float = 1.0f,
    scaleZ: Float = 1.0f
): Unit

Resets this matrix to a "TRS" (translation, rotation, scale) transform around a pivot point. The transform operations encoded in the matrix are the following, in this specific order:

Calling this method is equivalent to the following code:

val m: Matrix ...
m.reset()
m.translate(-pivotX, -pivotY)
m *= Matrix().apply {
translate(translationX, translationY)
rotateX(rotationX)
rotateY(rotationY)
rotateZ(rotationZ)
scale(scaleX, scaleY)
}
m *= Matrix().apply { translate(pivotX, pivotY) }

rotateX

fun rotateX(degrees: Float): Unit

Applies a degrees rotation around X to this.

rotateY

fun rotateY(degrees: Float): Unit

Applies a degrees rotation around Y to this.

rotateZ

fun rotateZ(degrees: Float): Unit

Applies a degrees rotation around Z to this.

scale

fun scale(x: Float = 1.0f, y: Float = 1.0f, z: Float = 1.0f): Unit

Scale this matrix by x, y, z

set

inline operator fun set(row: Int, column: Int, v: Float): Unit

setFrom

fun setFrom(matrix: Matrix): Unit

Sets the entire matrix to the matrix in matrix.

timesAssign

operator fun timesAssign(m: Matrix): Unit

Multiply this matrix by m and assign the result to this matrix.

toString

open fun toString(): String

translate

fun translate(x: Float = 0.0f, y: Float = 0.0f, z: Float = 0.0f): Unit

Translate this matrix by x, y, z

Public properties

values

val valuesFloatArray

Extension functions

setFrom

fun Matrix.setFrom(matrix: Matrix): Unit

Set the matrix values the native android.graphics.Matrix.

isIdentity

fun Matrix.isIdentity(): Boolean

Whether the given matrix is the identity matrix.