Google is committed to advancing racial equity for Black communities. See how.

Matrix

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

Summary

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

Public constructors

<init>

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

Public methods

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: Rect): Rect

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

map

fun map(rect: MutableRect): Unit

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

reset

fun reset(): Unit

Resets the this to the identity matrix.

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 = 1f,
    y: Float = 1f,
    z: Float = 1f
): 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

fun toString(): String

translate

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

Translate this matrix by x, y, z

Properties

values

val values: FloatArray