# Camera2TransformationInfo

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/camera2/Camera2TransformationInfo.kt+class:androidx.camera.viewfinder.core.camera2.Camera2TransformationInfo) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera-viewfinder#1.5.0)

*** ** * ** ***


```
public static class Camera2TransformationInfo
```

<br />

*** ** * ** ***

Utilities for generating `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` for use with {@docRoot\]media/camera/camera2

## Summary

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/viewfinder/core/camera2/Camera2TransformationInfo` | `https://developer.android.com/reference/androidx/camera/viewfinder/core/camera2/Camera2TransformationInfo#INSTANCE()` |

| ### Public methods |
|---|---|
| `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/camera2/Camera2TransformationInfo#createFromCharacteristics(android.hardware.camera2.CameraCharacteristics,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html cameraCharacteristics, float cropRectLeft, float cropRectTop, float cropRectRight, float cropRectBottom )` Creates `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` from the provided `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html` and crop rect. |
| `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/annotation/RequiresApi(value = 33) https://developer.android.com/reference/androidx/camera/viewfinder/core/camera2/Camera2TransformationInfo#createFromCharacteristics(android.hardware.camera2.CameraCharacteristics,kotlin.Int,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html cameraCharacteristics, int mirrorMode, float cropRectLeft, float cropRectTop, float cropRectRight, float cropRectBottom )` Creates `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` from the provided `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html`, crop rect, and mirror mode. |

## Public fields

### INSTANCE

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

```
public static @NonNull Camera2TransformationInfo INSTANCE
```

## Public methods

### createFromCharacteristics

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

```
public static final @NonNull TransformationInfo createFromCharacteristics(
    @NonNull CameraCharacteristics cameraCharacteristics,
    float cropRectLeft,
    float cropRectTop,
    float cropRectRight,
    float cropRectBottom
)
```

Creates `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` from the provided `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html` and crop rect.

When using a viewfinder with {@docRoot\]media/camera/camera2, this will generate the appropriate `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` to display the camera frames upright.

The crop rect will specify a region of interest (ROI) within the original buffer to treat as the buffer dimensions. When displaying the ROI in a viewfinder, depending on the scale mode, the crop rect bounding box should line up with the edges of the viewfinder, but pixels outside the bounding box will not necessarily be hidden if they still land within the bounds of the viewfinder.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html cameraCharacteristics` | the camera characteristics of the camera being used to produce frames |
| `float cropRectLeft` | the optional left bound of a crop rect |
| `float cropRectTop` | the optional top bound of a crop rect |
| `float cropRectRight` | the optional right bound of a crop rect |
| `float cropRectBottom` | the optional bottom bound of a crop rect |

### createFromCharacteristics

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

```
@RequiresApi(value = 33)
public static final @NonNull TransformationInfo createFromCharacteristics(
    @NonNull CameraCharacteristics cameraCharacteristics,
    int mirrorMode,
    float cropRectLeft,
    float cropRectTop,
    float cropRectRight,
    float cropRectBottom
)
```

Creates `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` from the provided `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html`, crop rect, and mirror mode.

When using a viewfinder with {@docRoot\]media/camera/camera2, this will generate the appropriate `https://developer.android.com/reference/androidx/camera/viewfinder/core/TransformationInfo` to display the camera frames upright.

The crop rect will specify a region of interest (ROI) within the original buffer to treat as the buffer dimensions. When displaying the ROI in a viewfinder, depending on the scale mode, the crop rect bounding box should line up with the edges of the viewfinder, but pixels outside the bounding box will not necessarily be hidden if they still land within the bounds of the viewfinder.

The mirror mode is one of `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_NONE`, `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#MIRROR_MODE_H`, or `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#MIRROR_MODE_NONE`, and should match what was set on `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#setMirrorMode(android.view.Surface, int)`. Note that before API level 33, the default behavior was equivalent to `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#MIRROR_MODE_AUTO`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html cameraCharacteristics` | the camera characteristics of the camera being used to produce frames |
| `int mirrorMode` | the mirror mode set on `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#setMirrorMode(android.view.Surface, int)` Value is one of the following: - `0` - `1` - `2` - `3` <br /> |
| `float cropRectLeft` | the optional left bound of a crop rect |
| `float cropRectTop` | the optional top bound of a crop rect |
| `float cropRectRight` | the optional right bound of a crop rect |
| `float cropRectBottom` | the optional bottom bound of a crop rect |