# CoordinateTransformer

Artifact: [androidx.camera.viewfinder:viewfinder-compose](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder) [View Source](https://cs.android.com/search?q=file:androidx/camera/viewfinder/compose/CoordinateTransformer.kt+class:androidx.camera.viewfinder.compose.CoordinateTransformer) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)


```
interface CoordinateTransformer
```

<br />

Known direct subclasses [IdentityCoordinateTransformer](https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/IdentityCoordinateTransformer), [MutableCoordinateTransformer](https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/MutableCoordinateTransformer)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/IdentityCoordinateTransformer` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/CoordinateTransformer` where the transformMatrix is the identity matrix. |
| `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/MutableCoordinateTransformer` | CoordinateTransformer where the transformMatrix is mutable. |

*** ** * ** ***

Coordinate transformer that's used to convert coordinates from one space to another.

`https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/CoordinateTransformer#transformMatrix()` must be set by whoever manipulates the coordinate space, otherwise an identity will be used for the coordinate transformations. When used in a `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/Viewfinder.composable#Viewfinder(androidx.camera.viewfinder.core.ViewfinderSurfaceRequest,androidx.compose.ui.Modifier,androidx.camera.viewfinder.core.TransformationInfo,androidx.camera.viewfinder.compose.MutableCoordinateTransformer,androidx.compose.ui.Alignment,androidx.compose.ui.layout.ContentScale,kotlin.Function1)`, the viewfinder will set this transform matrix.

## Summary

| ### Public functions |
|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset.https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/CoordinateTransformer#(androidx.compose.ui.geometry.Offset).transform()()` Returns the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` in the transformed space. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/compose/CoordinateTransformer#transformMatrix()` Matrix that's used for coordinate transformations. |

## Public functions

### Offset.transform

Artifact: [androidx.camera.viewfinder:viewfinder-compose](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder) [View Source](https://cs.android.com/search?q=file:androidx/camera/viewfinder/compose/CoordinateTransformer.kt+function:transform) Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.6.0)

```
open fun Offset.transform(): Offset
```

Returns the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` in the transformed space.

## Public properties

### transformMatrix

```
val transformMatrix: Matrix
```

Matrix that's used for coordinate transformations.