Matrix
-
Cmn
value class Matrix
Summary
Constants |
||
|---|---|---|
const Int |
Perspective0 = 3Index of the flattened array that represents the perspective factor along the X axis |
Cmn
|
const Int |
Perspective1 = 7Index of the flattened array that represents the perspective factor along the Y axis |
Cmn
|
const Int |
Perspective2 = 15Index of the flattened array that represents the perspective factor along the Z axis |
Cmn
|
const Int |
ScaleX = 0Index of the flattened array that represents the scale factor along the X axis |
Cmn
|
const Int |
ScaleY = 5Index of the flattened array that represents the scale factor along the Y axis |
Cmn
|
const Int |
ScaleZ = 10Index of the flattened array that represents the scale factor along the Z axis |
Cmn
|
const Int |
SkewX = 4Index of the flattened array that represents the skew factor along the X axis |
Cmn
|
const Int |
SkewY = 1Index of the flattened array that represents the skew factor along the Y axis |
Cmn
|
const Int |
TranslateX = 12Index of the flattened array that represents the translation along the X axis |
Cmn
|
const Int |
TranslateY = 13Index of the flattened array that represents the translation along the Y axis |
Cmn
|
const Int |
TranslateZ = 14Index of the flattened array that represents the translation along the Z axis |
Cmn
|
Public constructors |
|
|---|---|
Matrix(values: FloatArray) |
Cmn
|
Public functions |
||
|---|---|---|
inline operator Float |
Cmn
|
|
Unit |
invert()Invert |
Cmn
|
Offset |
Does the 3D transform on |
Cmn
|
Unit |
map(rect: MutableRect)Does a 3D transform on |
Cmn
|
Rect |
Does a 3D transform on |
Cmn
|
Unit |
reset()Resets the |
Cmn
|
Unit |
resetToPivotedTransform(Resets this matrix to a "TRS" (translation, rotation, scale) transform around a pivot point. |
Cmn
|
Unit |
Applies a |
Cmn
|
Unit |
Applies a |
Cmn
|
Unit |
Applies a |
Cmn
|
Unit |
Cmn
|
|
inline operator Unit |
Cmn
|
|
Unit |
Sets the entire matrix to the matrix in |
Cmn
|
operator Unit |
timesAssign(m: Matrix)Multiply this matrix by |
Cmn
|
open String |
toString() |
Cmn
|
Unit |
Cmn
|
Public properties |
||
|---|---|---|
FloatArray |
Cmn
|
Extension functions |
||
|---|---|---|
Unit |
Set the matrix values the native |
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
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.
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:
-
A translation by
translationX,translationY, andtranslationZ -
An X rotation by
rotationX -
A Y rotation by
rotationY -
A Z rotation by
rotationZ
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) }
timesAssign
operator fun timesAssign(m: Matrix): Unit
Multiply this matrix by m and assign the result to this matrix.
Public properties
Extension functions
setFrom
fun Matrix.setFrom(matrix: Matrix): Unit
Set the matrix values the native android.graphics.Matrix.