Matrix
value class Matrix(
    val values: FloatArray =
        floatArrayOf(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f)
)
Functions
inline operator fun get(row: Int, column: Int) = values[(row * 4) + column]
inline operator fun set(row: Int, column: Int, v: Float)
fun map(point: Offset): Offset
Does the 3D transform on point and returns the x and y values in an Offset.
fun map(rect: Rect): Rect
Does a 3D transform on rect and returns its bounds after the transform.
fun map(rect: MutableRect)
Does a 3D transform on rect, transforming rect with the results.
operator fun timesAssign(m: Matrix)
Multiply this matrix by m and assign the result to this matrix.
fun invert()
Invert this Matrix.
fun reset()
Resets the this to the identity matrix.
fun setFrom(matrix: Matrix)
Sets the entire matrix to the matrix in matrix.
fun rotateX(degrees: Float)
Applies a degrees rotation around X to this.
fun rotateY(degrees: Float)
Applies a degrees rotation around Y to this.
fun rotateZ(degrees: Float)
Applies a degrees rotation around Z to this.
fun scale(x: Float = 1f, y: Float = 1f, z: Float = 1f)
Scale this matrix by x, y, z
fun translate(x: Float = 0f, y: Float = 0f, z: Float = 0f)
Translate this matrix by x, y, z
fun resetToPivotedTransform(
        pivotX: Float = 0f,
        pivotY: Float = 0f,
        translationX: Float = 0f,
        translationY: Float = 0f,
        translationZ: Float = 0f,
        rotationX: Float = 0f,
        rotationY: Float = 0f,
        rotationZ: Float = 0f,
        scaleX: Float = 1f,
        scaleY: Float = 1f,
        scaleZ: Float = 1f,
    )
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:
- A translation by -pivotX, -pivotY
- A translation by translationX,translationY, andtranslationZ
- An X rotation by rotationX
- A Y rotation by rotationY
- A Z rotation by rotationZ
- A scale by scaleXandscaleY
- A translation by pivotX,pivotY
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) }
Companion Object
Properties
const val ScaleX = 0
Index of the flattened array that represents the scale factor along the X axis
const val SkewY = 1
Index of the flattened array that represents the skew factor along the Y axis
const val Perspective0 = 3
Index of the flattened array that represents the perspective factor along the X axis
const val SkewX = 4
Index of the flattened array that represents the skew factor along the X axis
const val ScaleY = 5
Index of the flattened array that represents the scale factor along the Y axis
const val Perspective1 = 7
Index of the flattened array that represents the perspective factor along the Y axis
const val ScaleZ = 10
Index of the flattened array that represents the scale factor along the Z axis
const val TranslateX = 12
Index of the flattened array that represents the translation along the X axis
const val TranslateY = 13
Index of the flattened array that represents the translation along the Y axis
const val TranslateZ = 14
Index of the flattened array that represents the translation along the Z axis
const val Perspective2 = 15
Index of the flattened array that represents the perspective factor along the Z axis
