# 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)

*** ** * ** ***


```
public final 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 |
|---|---|
| `static final float` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()` A crop value specifying no crop should be applied. |

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#DEFAULT()` A `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` with default values. |

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

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final float` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#getCropRectBottom()()` Bottom offset of the cropRect in pixels |
| `final float` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#getCropRectLeft()()` Left offset of the cropRect in pixels. |
| `final float` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#getCropRectRight()()` Right offset of the cropRect in pixels |
| `final float` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#getCropRectTop()()` Top offset of the cropRect in pixels |
| `final int` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#getSourceRotation()()` Rotation of the source, relative to the device's natural rotation, in degrees. |
| `final int` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#getTransformationMode()()` The transformation mode of the source. |
| `int` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#isSourceMirroredHorizontally()()` Indicates whether the source has been mirrored horizontally. |
| `final boolean` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#isSourceMirroredVertically()()` Indicates whether the source has been mirrored vertically. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo#toString()()` |

## Constants

### CROP_NONE

```
public static final float CROP_NONE
```

A crop value specifying no crop should be applied.

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

## Public fields

### DEFAULT

```
public static final @NonNull TransformationInfo DEFAULT
```

A `https://developer.android.com/reference/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)

```
public TransformationInfo(
    int sourceRotation,
    boolean isSourceMirroredHorizontally,
    boolean isSourceMirroredVertically,
    float cropRectLeft,
    float cropRectTop,
    float cropRectRight,
    float cropRectBottom,
    int transformationMode
)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getCropRectBottom

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

```
public final float getCropRectBottom()
```

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/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of the height of the surface.

### getCropRectLeft

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

```
public final float getCropRectLeft()
```

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/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of 0.

### getCropRectRight

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

```
public final float getCropRectRight()
```

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/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of the width of the surface.

### getCropRectTop

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

```
public final float getCropRectTop()
```

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/androidx/camera/viewfinder/core/TransformationInfo#CROP_NONE()`, which is equivalent to an offset of 0.

### getSourceRotation

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

```
public final int getSourceRotation()
```

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

### getTransformationMode

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

```
public final int getTransformationMode()
```

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/androidx/camera/viewfinder/core/TransformationMode#DEFERRED()`.

### hashCode

```
public int hashCode()
```

### isSourceMirroredHorizontally

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

```
public final boolean isSourceMirroredHorizontally()
```

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/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/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/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/androidx/camera/core/SurfaceRequest.TransformationInfo#isMirroring()` |   |

### isSourceMirroredVertically

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

```
public final boolean isSourceMirroredVertically()
```

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/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/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/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/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` |   |

### toString

```
public @NonNull String toString()
```