# ImmutableAffineTransform.Companion

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/ImmutableAffineTransform.kt+class:androidx.ink.geometry.ImmutableAffineTransform.Companion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***


```
public static class ImmutableAffineTransform.Companion
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#rotateDegrees(kotlin.Float)(@https://developer.android.com/reference/androidx/ink/geometry/AngleDegreesFloat float degrees)` Returns a transformation that rotates `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#rotateDegrees(kotlin.Float)` in the direction from the positive x-axis towards the positive y-axis. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#scale(kotlin.Float)(float scaleFactor)` Returns a transformation that scales in both the x- and y-direction by the given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#scale(kotlin.Float)`, centered about the origin. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#scale(kotlin.Float,kotlin.Float)(float xScaleFactor, float yScaleFactor)` Returns a transformation that scales in both the x- and y-direction by the given pair of factors; `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#scale(kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#scale(kotlin.Float,kotlin.Float)` respectively, centered about the origin. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#scaleX(kotlin.Float)(float scaleFactor)` Returns a transformation that scales in the x-direction by the given factor, centered about the origin. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#scaleY(kotlin.Float)(float scaleFactor)` Returns a transformation that scales in the y-direction by the given factor, centered about the origin. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#skewX(kotlin.Float)(float sx)` Returns a transformation that skews in the x-direction by the given factor. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#skewY(kotlin.Float)(float sy)` Returns a transformation that skews in the y-direction by the given factor. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#translate(androidx.ink.geometry.Vec)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec offset)` Returns a transformation that translates by the given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#translate(androidx.ink.geometry.Vec)` vector. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform#translate(kotlin.Float,kotlin.Float)(float x, float y)` Returns a transformation that translates by the given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#translate(kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#translate(kotlin.Float,kotlin.Float)` components. |

| ### Extension functions |
|---|---|
| `static final https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` | `https://developer.android.com/reference/androidx/ink/geometry/AndroidGraphicsConverter.https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#(androidx.ink.geometry.ImmutableAffineTransform.Companion).from(android.graphics.Matrix)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Matrix.html matrix )` Constructs an `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` with the values from `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableAffineTransform.Companion).from(android.graphics.Matrix)`. |

## Public methods

### rotateDegrees

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

```
public static final @NonNull ImmutableAffineTransform rotateDegrees(@AngleDegreesFloat float degrees)
```

Returns a transformation that rotates `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#rotateDegrees(kotlin.Float)` in the direction from the positive x-axis towards the positive y-axis.

### scale

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

```
public static final @NonNull ImmutableAffineTransform scale(float scaleFactor)
```

Returns a transformation that scales in both the x- and y-direction by the given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#scale(kotlin.Float)`, centered about the origin.

### scale

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

```
public static final @NonNull ImmutableAffineTransform scale(float xScaleFactor, float yScaleFactor)
```

Returns a transformation that scales in both the x- and y-direction by the given pair of factors; `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#scale(kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#scale(kotlin.Float,kotlin.Float)` respectively, centered about the origin.

### scaleX

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

```
public static final @NonNull ImmutableAffineTransform scaleX(float scaleFactor)
```

Returns a transformation that scales in the x-direction by the given factor, centered about the origin.

### scaleY

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

```
public static final @NonNull ImmutableAffineTransform scaleY(float scaleFactor)
```

Returns a transformation that scales in the y-direction by the given factor, centered about the origin.

### skewX

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

```
public static final @NonNull ImmutableAffineTransform skewX(float sx)
```

Returns a transformation that skews in the x-direction by the given factor.

### skewY

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

```
public static final @NonNull ImmutableAffineTransform skewY(float sy)
```

Returns a transformation that skews in the y-direction by the given factor.

### translate

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

```
public static final @NonNull ImmutableAffineTransform translate(@NonNull Vec offset)
```

Returns a transformation that translates by the given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#translate(androidx.ink.geometry.Vec)` vector.

### translate

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

```
public static final @NonNull ImmutableAffineTransform translate(float x, float y)
```

Returns a transformation that translates by the given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#translate(kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform.Companion#translate(kotlin.Float,kotlin.Float)` components.

## Extension functions

### AndroidGraphicsConverter.from

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

```
public static final ImmutableAffineTransform AndroidGraphicsConverter.from(
    @NonNull ImmutableAffineTransform.Companion receiver,
    @NonNull Matrix matrix
)
```

Constructs an `https://developer.android.com/reference/androidx/ink/geometry/ImmutableAffineTransform` with the values from `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableAffineTransform.Companion).from(android.graphics.Matrix)`.

If `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableAffineTransform.Companion).from(android.graphics.Matrix)` is not an affine transform, returns null instead.

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

Java callers should prefer `AndroidGraphicsConverter.createAffineTransform(Matrix)` (`https://developer.android.com/reference/androidx/ink/geometry/package-summary#createAffineTransform(android.graphics.Matrix)`).