Android 12 Developer Preview is here! Try it out, and give us your feedback!

Matrix

inline class Matrix
kotlin.Any
   ↳ androidx.compose.ui.graphics.Matrix

Summary

Constants
const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

Public constructors
<init>(values: FloatArray = floatArrayOf( 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f ))

Public methods
operator Float
get(row: Int, column: Int)

Unit

Invert this Matrix.

Offset
map(point: Offset)

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

Rect
map(rect: Rect)

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

Unit

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

Unit

Resets the this to the identity matrix.

Unit
rotateX(degrees: Float)

Applies a degrees rotation around X to this.

Unit
rotateY(degrees: Float)

Applies a degrees rotation around Y to this.

Unit
rotateZ(degrees: Float)

Applies a degrees rotation around Z to this.

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

Scale this matrix by x, y, z

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

Unit
setFrom(matrix: Matrix)

Sets the entire matrix to the matrix in matrix.

operator Unit

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

String

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

Translate this matrix by x, y, z

Extension functions
From androidx.compose.ui.graphics
Boolean

Whether the given matrix is the identity matrix.

Unit

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

Properties
FloatArray

Constants

Perspective0

const val Perspective0: Int

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

Value: 3

Perspective1

const val Perspective1: Int

Index of the flattened array that represents the pers