# TransformationInfo

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

*** ** * ** ***


```
class TransformationInfo
```

<br />

*** ** * ** ***

Transformation information associated with the preview output.

This information can be used to transform the Surface of a Viewfinder to be suitable to be displayed.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()` A crop value specifying no crop should be applied. |

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#DEFAULT()` A `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo` with default values. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#TransformationInfo(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)( sourceRotation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, isSourceMirroredHorizontally: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isSourceMirroredVertically: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, cropRectLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, cropRectTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, cropRectRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, cropRectBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, transformationMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectBottom()` Bottom offset of the cropRect in pixels |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectLeft()` Left offset of the cropRect in pixels. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectRight()` Right offset of the cropRect in pixels |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectTop()` Top offset of the cropRect in pixels |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#isSourceMirroredHorizontally()` Indicates whether the source has been mirrored horizontally. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#isSourceMirroredVertically()` Indicates whether the source has been mirrored vertically. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#sourceRotation()` Rotation of the source, relative to the device's natural rotation, in degrees. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#transformationMode()` The transformation mode of the source. |

## Constants

### CROP_NONE

```
const val CROP_NONE: Float
```

A crop value specifying no crop should be applied.

When used as a value for `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectLeft()`, `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectTop()`, `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectRight()`, or `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#cropRectBottom()`, the crop rect dimension will be equivalent to the resolution of the untransformed surface.

## Public companion properties

### DEFAULT

```
val DEFAULT: TransformationInfo
```

A `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo` with default values.

This transformation info instance has no source rotation, no mirroring, and no crop rectangle.

## Public constructors

### TransformationInfo

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.7.0-rc02)

```
TransformationInfo(
    sourceRotation: Int = 0,
    isSourceMirroredHorizontally: Boolean = false,
    isSourceMirroredVertically: Boolean = false,
    cropRectLeft: Float = CROP_NONE,
    cropRectTop: Float = CROP_NONE,
    cropRectRight: Float = CROP_NONE,
    cropRectBottom: Float = CROP_NONE,
    transformationMode: Int = TransformationMode.DEFERRED
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### cropRectBottom

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val cropRectBottom: Float
```

Bottom offset of the cropRect in pixels

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of the height of the surface.

### cropRectLeft

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val cropRectLeft: Float
```

Left offset of the cropRect in pixels.

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of 0.

### cropRectRight

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val cropRectRight: Float
```

Right offset of the cropRect in pixels

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of the width of the surface.

### cropRectTop

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val cropRectTop: Float
```

Top offset of the cropRect in pixels

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of 0.

### isSourceMirroredHorizontally

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val isSourceMirroredHorizontally: Boolean
```

Indicates whether the source has been mirrored horizontally.

This is common if the source comes from a camera that is front-facing.

It is not common for both `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` to be set to `true`. This is equivalent to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` being rotated by an additional 180 degrees.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#MIRROR_MODE_AUTO` |   |
| `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#MIRROR_MODE_H` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest.TransformationInfo#isMirroring()` |   |

### isSourceMirroredVertically

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val isSourceMirroredVertically: Boolean
```

Indicates whether the source has been mirrored vertically.

It is not common for a camera source to be mirror vertically, and typically `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` will be the appropriate property.

It is not common for both `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` to be set to `true`. This is equivalent to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationInfo#(kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int)` being rotated by an additional 180 degrees.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#MIRROR_MODE_V` |   |

### sourceRotation

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

```
val sourceRotation: Int
```

Rotation of the source, relative to the device's natural rotation, in degrees.

### transformationMode

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.7.0-rc02)

```
val transformationMode: Int
```

The transformation mode of the source.

This indicates how the source has been transformed before reaching the viewfinder.

If not set, this value will default to `https://developer.android.com/reference/kotlin/androidx/camera/viewfinder/core/TransformationMode#DEFERRED()`.

Value is one of the following:

- `0`
- `1`

<br />