# AffineTransform

Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/AffineTransform.kt+class:androidx.ink.geometry.AffineTransform) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  abstract class AffineTransform
  ```
Known direct subclasses [ImmutableAffineTransform](https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform), [MutableAffineTransform](https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform` | An immutable affine transformation in the plane. |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform` | A mutable affine transformation in the plane. |

*** ** * ** ***

An affine transformation in the plane. The transformation can be thought of as a 3x3 matrix:

```kotlin
⎡m00  m10  m20⎤
⎢m01  m11  m21⎥
⎣ 0    0    1 ⎦
```

Applying the transformation can be thought of as a matrix multiplication, with the to-be-transformed point represented as a column vector with an extra 1:

```kotlin
⎡m00  m10  m20⎤   ⎡x⎤   ⎡m00*x + m10*y + m20⎤
⎢m01  m11  m21⎥ * ⎢y⎥ = ⎢m01*x + m11*y + m21⎥
⎣ 0    0    1 ⎦   ⎣1⎦   ⎣         1         ⎦
```

Transformations are composed via multiplication. Multiplication is not commutative (i.e. A*B != B*A), and the left-hand transformation is composed "after" the right hand transformation. E.g., if you have:

```kotlin
val rotate = ImmutableAffineTransform.rotateDegrees(45f)
val translate = ImmutableAffineTransform.translate(Vec(10, 0))
```

then `rotate * translate` first translates 10 units in the positive x-direction, then rotates 45° about the origin.

`https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform` and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform` are the two concrete implementations of this.

## Summary

| ### Public companion functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)( lhs: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform, rhs: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform, output: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform )` Multiplies the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` transform by the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` transform as matrices, and stores the result in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)`, which may be the same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform` instance as `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` or `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` to avoid additional allocations. | Cmn |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()` Constant representing an identity transformation, which maps a point to itself, i.e. it leaves it unchanged. | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableParallelogram` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Box)(box: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box)` Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableParallelogram` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Box)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableParallelogram` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Parallelogram)(parallelogram: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram)` Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableParallelogram` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Parallelogram)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec)(point: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)` Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Segment)(segment: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment)` Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Segment)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableTriangle` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Triangle)(triangle: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle)` Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableTriangle` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Triangle)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Box,androidx.ink.geometry.MutableParallelogram)(box: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box, outParallelogram: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram)` Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.MutableParallelogram)( parallelogram: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram, outParallelogram: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram )` Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec,androidx.ink.geometry.MutableVec)(point: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec, outVec: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec)` Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Segment,androidx.ink.geometry.MutableSegment)(segment: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment, outSegment: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment)` Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Triangle,androidx.ink.geometry.MutableTriangle)(triangle: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle, outTriangle: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle)` Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#computeInverse()()` Returns the inverse of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#computeInverse(androidx.ink.geometry.MutableAffineTransform)(outAffineTransform: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform)` Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#computeInverse(androidx.ink.geometry.MutableAffineTransform)` with the inverse of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#getValues(kotlin.FloatArray)(outArray: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Populates the first 6 elements of `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#getValues(kotlin.FloatArray)` with the values of this transform, starting with the top left corner of the matrix and proceeding in row-major order. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)( other: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform, tolerance: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Compares this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)`, and returns true if each component of the transform matrix is within `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)` of the corresponding component of `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)`. | Cmn |
| `abstract https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#toImmutable()()` Returns an immutable equivalent of this object. | Cmn |

| ### Public properties |
|---|---|---|
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#m00()` Value in the first row, first column of the transform matrix. | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#m01()` Value in the second row, first column of the transform matrix. | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#m10()` Value in the first row, second column of the transform matrix. | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#m11()` Value in the second row, second column of the transform matrix. | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#m20()` Value in the first row, third column of the transform matrix. | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#m21()` Value in the second row, third column of the transform matrix. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlinx.cinterop/-c-value/index.html<platform.CoreGraphics.CGAffineTransform>` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#(androidx.ink.geometry.AffineTransform).toCgAffineTransform()()` Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlinx.cinterop/-c-value/index.html` holding a with the values from this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`. | N |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#(androidx.ink.geometry.AffineTransform).populateMatrix(android.graphics.Matrix)(out: https://developer.android.com/reference/android/graphics/Matrix.html)` Writes the values from this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(android.graphics.Matrix)`. | android |
| `https://developer.android.com/reference/android/graphics/Matrix.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#(androidx.ink.geometry.AffineTransform).toMatrix()()` Constructs a `https://developer.android.com/reference/android/graphics/Matrix.html` with the values from the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`. | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#(androidx.ink.geometry.AffineTransform).populateMatrix(androidx.compose.ui.graphics.Matrix)(out: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix)` Writes the values from this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/compose/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(androidx.compose.ui.graphics.Matrix)`. | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#(androidx.ink.geometry.AffineTransform).toMatrix()()` Constructs a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` with the values from the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`. | android |

## Public companion functions

### multiply

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun multiply(
    lhs: AffineTransform,
    rhs: AffineTransform,
    output: MutableAffineTransform
): Unit
```

Multiplies the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` transform by the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` transform as matrices, and stores the result in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)`, which may be the same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform` instance as `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` or `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` to avoid additional allocations.

Note that, when performing matrix multiplication, the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` transform is applied after the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` transform; i.e., after calling this method, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)` contains a transform equivalent to applying `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)`, then `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform.Companion#multiply(androidx.ink.geometry.AffineTransform,androidx.ink.geometry.AffineTransform,androidx.ink.geometry.MutableAffineTransform)`.

## Public companion properties

### IDENTITY

Cmn

```
val IDENTITY: ImmutableAffineTransform
```

Constant representing an identity transformation, which maps a point to itself, i.e. it leaves it unchanged.

## Public functions

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(box: Box): ImmutableParallelogram
```

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableParallelogram` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Box)`.

Note that applying an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box` results in a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram`. If you need a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box`, use `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram#computeBoundingBox()` to get the minimum bounding box of the result.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Box)` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram`, so that instance can be reused across multiple calls.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(parallelogram: Parallelogram): ImmutableParallelogram
```

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableParallelogram` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Parallelogram)`.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Parallelogram)` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram`, so that instance can be reused across multiple calls.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(point: Vec): ImmutableVec
```

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec)`.

Note that this treats `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec)` as a location, not an offset. If you want to transform an offset, you must also transform the origin and subtract that from the result, e.g.:

```kotlin
val result = MutableVec()
Vec.subtract(
  transform.applyTransform(vec),
  transform.applyTransform(Vec.ORIGIN),
  result
)
```

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec)` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec`, so that instance can be reused across multiple calls.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(segment: Segment): ImmutableSegment
```

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Segment)`.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Segment)` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment`, so that instance can be reused across multiple calls.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(triangle: Triangle): ImmutableTriangle
```

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableTriangle` containing the result of applying the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Triangle)`.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Triangle)` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle`, so that instance can be reused across multiple calls.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(box: Box, outParallelogram: MutableParallelogram): MutableParallelogram
```

Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram`. This is the only Apply function where the input cannot also be the output, as applying an Affine Transform to a Box makes a Parallelogram.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(
    parallelogram: Parallelogram,
    outParallelogram: MutableParallelogram
): MutableParallelogram
```

Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram`. The same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableParallelogram` can be used as both the input and output to avoid additional allocations.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(point: Vec, outVec: MutableVec): MutableVec
```

Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec`. The same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` can be used as both the input and output to avoid additional allocations. Returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec,androidx.ink.geometry.MutableVec)`.

Note that this treats `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec,androidx.ink.geometry.MutableVec)` as a location, not an offset. If you want to transform an offset, you must also transform the origin and subtract that from the result, e.g.:

```kotlin
Vec.subtract(
  transform.applyTransform(vec, scratchPoint1),
  transform.applyTransform(Vec.ORIGIN, scratchPoint2),
  result
)
```

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(segment: Segment, outSegment: MutableSegment): MutableSegment
```

Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment`. The same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment` can be used as both the input and output to avoid additional allocations. Returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Segment,androidx.ink.geometry.MutableSegment)`.

### applyTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun applyTransform(triangle: Triangle, outTriangle: MutableTriangle): MutableTriangle
```

Apply the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle` and store the result in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle`. The same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` can be used as both the input and output to avoid additional allocations. Returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Triangle,androidx.ink.geometry.MutableTriangle)`.

### computeInverse

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun computeInverse(): ImmutableAffineTransform
```

Returns the inverse of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#computeInverse()` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform`, so that instance can be reused across multiple calls.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` cannot be inverted. |

### computeInverse

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun computeInverse(outAffineTransform: MutableAffineTransform): MutableAffineTransform
```

Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#computeInverse(androidx.ink.geometry.MutableAffineTransform)` with the inverse of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`. The same `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform` instance can be used as the output to avoid additional allocations. Returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#computeInverse(androidx.ink.geometry.MutableAffineTransform)`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` cannot be inverted. . |

### getValues

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun getValues(outArray: @Size(min = 6) FloatArray = FloatArray(6)): @Size(min = 6) FloatArray
```

Populates the first 6 elements of `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#getValues(kotlin.FloatArray)` with the values of this transform, starting with the top left corner of the matrix and proceeding in row-major order.

In performance-sensitive code, prefer to pass in an array that has already been allocated and is being reused, rather than relying on the default behavior of allocating a new instance for each call.

Prefer to apply this transform to an object, such as with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#applyTransform(androidx.ink.geometry.Vec)`, rather than accessing the actual numeric values of this transform. This function is useful for when the values are needed in bulk but not to apply a transform, for example for serialization.

To set these values on a transform in the same order that they are retrieved here, use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableAffineTransform` constructor or use `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableAffineTransform#setValues(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`.

### isAlmostEqual

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun isAlmostEqual(
    other: AffineTransform,
    tolerance: @FloatRange(from = 0.0) Float
): Boolean
```

Compares this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)`, and returns true if each component of the transform matrix is within `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)` of the corresponding component of `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#isAlmostEqual(androidx.ink.geometry.AffineTransform,kotlin.Float)`.

### toImmutable

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract fun toImmutable(): ImmutableAffineTransform
```

Returns an immutable equivalent of this object. This will return itself if called on an immutable instance.

## Public properties

### m00

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract val m00: Float
```

Value in the first row, first column of the transform matrix.

### m01

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract val m01: Float
```

Value in the second row, first column of the transform matrix.

### m10

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract val m10: Float
```

Value in the first row, second column of the transform matrix.

### m11

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract val m11: Float
```

Value in the second row, second column of the transform matrix.

### m20

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract val m20: Float
```

Value in the first row, third column of the transform matrix.

### m21

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
abstract val m21: Float
```

Value in the second row, third column of the transform matrix.

## Extension functions

### AffineTransform.toCgAffineTransform

N Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/AffineTransformExtensions.ios.kt+function:toCgAffineTransform)

```
fun AffineTransform.toCgAffineTransform(): CValue<platform.CoreGraphics.CGAffineTransform>
```

Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlinx.cinterop/-c-value/index.html` holding a with the values from this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`.

### AffineTransform.populateMatrix

android Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/AndroidGraphicsConversionExtensions.android.kt+function:populateMatrix)

```
fun AffineTransform.populateMatrix(out: Matrix): Unit
```

Writes the values from this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(android.graphics.Matrix)`.

Returns the modified `https://developer.android.com/reference/android/graphics/Matrix.html` to allow chaining calls.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(android.graphics.Matrix)` |

### AffineTransform.toMatrix

android Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/AndroidGraphicsConversionExtensions.android.kt+function:toMatrix)

```
fun AffineTransform.toMatrix(): Matrix
```

Constructs a `https://developer.android.com/reference/android/graphics/Matrix.html` with the values from the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(android.graphics.Matrix)` overload that takes a pre-allocated `https://developer.android.com/reference/android/graphics/Matrix.html`, so that the instance can be reused across multiple calls.

### AffineTransform.populateMatrix

android Artifact: [androidx.ink:ink-geometry-compose](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/compose/ComposeConversionExtensions.kt+function:populateMatrix)

```
fun AffineTransform.populateMatrix(out: Matrix): Matrix
```

Writes the values from this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/compose/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(androidx.compose.ui.graphics.Matrix)`. Note the conversion from a 3x3 `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform` to a 4x4 column-major `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix`.

Returns the modified `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` instance to allow chaining calls.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/compose/package-summary#(androidx.ink.geometry.AffineTransform).populateMatrix(androidx.compose.ui.graphics.Matrix)` |

### AffineTransform.toMatrix

android Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/AndroidGraphicsConversionExtensions.android.kt+function:toMatrix)

```
fun AffineTransform.toMatrix(): Matrix
```

Constructs a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` with the values from the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform`.

Performance-sensitive code should still use this because `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` is an inline value class.