{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

Matrix

value public final class Matrix


Summary

Constants

static final int

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

static final int

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

static final int

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

static final int
ScaleX = 0

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

static final int
ScaleY = 5

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

static final int
ScaleZ = 10

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

static final int
SkewX = 4

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

static final int
SkewY = 1

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

static final int

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

static final int

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

static final int

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

Public constructors

Matrix(@NonNull float[] values)

Public methods

final float
get(int row, int column)
final @NonNull float[]
final void

Invert this Matrix.

final @NonNull Offset
map(@NonNull Offset point)

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

final void

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

final @NonNull Rect
map(@NonNull Rect rect)

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

final void

Resets the this to the identity matrix.

final void
rotateX(float degrees)

Applies a degrees rotation around X to this.

final void
rotateY(float degrees)

Applies a degrees rotation around Y to this.

final void
rotateZ(float degrees)

Applies a degrees rotation around Z to this.

final void
scale(float x, float y, float z)

Scale this matrix by x, y, z

final void
set(int row, int column, float v)
final void

Sets the entire matrix to the matrix in matrix.

final void

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

@NonNull String
final void
translate(float x, float y, float z)

Translate this matrix by x, y, z

Extension functions

final void
AndroidMatrixConversionsKt.setFrom(
    @NonNull Matrix receiver,
    @NonNull Matrix matrix
)

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

final boolean

Whether the given matrix is the identity matrix.

Constants

Perspective0

public static final int Perspective0 = 3

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

Perspective1

public static final int Perspective1 = 7

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

Perspective2

public static final int Perspective2 = 15

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

ScaleX

public static final int ScaleX = 0

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

ScaleY

public static final int ScaleY = 5

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

ScaleZ

public static final int ScaleZ = 10

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

SkewX

public static final int SkewX = 4

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

SkewY

public static final int SkewY = 1

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

TranslateX

public static final int TranslateX = 12

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

TranslateY

public static final int TranslateY = 13

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

TranslateZ

public static final int TranslateZ = 14

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

Public constructors

Matrix

public Matrix(@NonNull float[] values)

Public methods

get

public final float get(int row, int column)

getValues

public final @NonNull float[] getValues()

invert

public final void invert()

Invert this Matrix.

map

public final @NonNull Offset map(@NonNull Offset point)

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

map

public final void map(@NonNull MutableRect rect)

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

map

public final @NonNull Rect map(@NonNull Rect rect)

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

reset

public final void reset()

Resets the this to the identity matrix.

rotateX

public final void rotateX(float degrees)

Applies a degrees rotation around X to this.

rotateY

public final void rotateY(float degrees)

Applies a degrees rotation around Y to this.

rotateZ

public final void rotateZ(float degrees)

Applies a degrees rotation around Z to this.

scale

public final void scale(float x, float y, float z)

Scale this matrix by x, y, z

set

public final void set(int row, int column, float v)

setFrom

public final void setFrom(@NonNull Matrix matrix)

Sets the entire matrix to the matrix in matrix.

timesAssign

public final void timesAssign(@NonNull Matrix m)

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

toString

public @NonNull String toString()

translate

public final void translate(float x, float y, float z)

Translate this matrix by x, y, z

Extension functions

AndroidMatrixConversionsKt.setFrom

public final void AndroidMatrixConversionsKt.setFrom(
    @NonNull Matrix receiver,
    @NonNull Matrix matrix
)

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

MatrixKt.isIdentity

public final boolean MatrixKt.isIdentity(@NonNull Matrix receiver)

Whether the given matrix is the identity matrix.