# CameraMath

Artifact: [androidx.camera:camera-common](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/common/CameraMath.kt+class:androidx.camera.common.CameraMath) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
object CameraMath
```

<br />

*** ** * ** ***

Utility functions for doing common transformations of camera and sensor coordinate spaces.

When doing camera coordinate transformations, there are three main "coordinate spaces" that a developer may need to understand and work with:

- **Sensor-relative** coordinates: These are integer-pixel coordinates that correspond to the physical active pixel array of a camera device. Most operations in Camera2 (like 3A metering regions or crop regions) define coordinates relative to the physical sensor (with `(0,0)` being the top-left active pixel).

- **Stream-relative** coordinates: When configuring camera output streams, they are configured with a specific resolution. The stream coordinate space is axially aligned and centered within the crop region of the sensor, but may be further cropped either horizontally or vertically to maintain square pixels and its own aspect ratio (see Android's camera cropping specification at [Output streams, cropping, and zoom](https://source.android.com/docs/core/camera/camera3_crop_reprocess)). Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries.

- **UI-relative** coordinates: These represent the display area of a stream on a UI surface (like a viewfinder). UI coordinates are scaled, potentially mirrored, and rotated relative to the coordinate system of the screen or window the viewfinder is currently displayed on. *Note* : The `uiWidth` and `uiHeight` used in calculations represent the UI-relative size of the viewfinder, without accounting for any viewport clipping or padding. Callers must normalize UI coordinates to account for clipping or padding before calling these functions.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS() = 32` When converting to sensor coordinates, this is the minimum width/height for rectangles that will be sent to the sensor. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_POINT_TO_RECT_RATIO() = 0.18375f` It's common to need to convert a point into a sensor-relative rectangle for things like touch-to-focus, which often starts from a touch point that then needs to be converted into a sensor-relative rectangle. |

| ### Public functions |
|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(androidx.camera.common.DiscreteRotation,androidx.camera.common.DiscreteRotation,kotlin.Boolean)( displayRotation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Computes the rotation required to rotate coordinates from sensor space to the display coordinate system. |
| `https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)( displayRotation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Computes the rotation required to rotate coordinates from sensor space to the display coordinate system. |
| `inline https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToJpegOrientation(androidx.camera.common.DiscreteRotation,androidx.camera.common.DiscreteRotation,kotlin.Boolean)( deviceOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Computes the clockwise rotation required to be applied to the captured image to be viewed upright. |
| `https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToJpegOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)( deviceOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Computes the clockwise rotation required to be applied to the captured image to be viewed upright. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorPointToStreamPoint(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function2)( sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toStreamPoint: (streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a point relative to the camera sensor to an equivalent point relative to a specific camera stream. |
| `https://developer.android.com/reference/android/graphics/PointF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorPointToStreamPointF(android.graphics.Point,android.util.Size,android.graphics.Rect)( sensorPoint: https://developer.android.com/reference/android/graphics/Point.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html )` Converts a point relative to the camera sensor to an equivalent point relative to a specific camera stream. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorPointToUiPoint(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function2)( sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toUiPoint: (uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a point relative to the camera sensor to an equivalent point relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/PointF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorPointToUiPointF(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect)( sensorPoint: https://developer.android.com/reference/android/graphics/Point.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html )` Converts a point relative to the camera sensor to an equivalent point relative to a UI element. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorRectToStreamRect(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function4)( sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toStreamRect: (streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a specific camera stream. |
| `https://developer.android.com/reference/android/graphics/RectF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorRectToStreamRectF(android.graphics.Rect,android.util.Size,android.graphics.Rect)( sensorRect: https://developer.android.com/reference/android/graphics/Rect.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html )` Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a specific camera stream. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorRectToUiRect(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function4)( sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toUiRect: (uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/RectF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorRectToUiRectF(android.graphics.Rect,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect)( sensorRect: https://developer.android.com/reference/android/graphics/Rect.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html )` Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a UI element. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorSizeToStreamSize(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function2)( sensorSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toStreamSize: (streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a size relative to the camera sensor to an equivalent size relative to a specific camera stream. |
| `https://developer.android.com/reference/android/util/SizeF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorSizeToStreamSizeF(android.util.Size,android.util.Size,kotlin.Int,kotlin.Int)( size: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a size relative to the camera sensor to an equivalent size relative to a specific camera stream. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorSizeToUiSize(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Function2)( sensorSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toUiSize: (uiSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a size relative to the camera sensor to an equivalent size relative to a UI element. |
| `https://developer.android.com/reference/android/util/SizeF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorSizeToUiSizeF(android.util.Size,android.util.Size,android.util.Size,kotlin.Int,kotlin.Int,kotlin.Int)( size: https://developer.android.com/reference/android/util/Size.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a size relative to the camera sensor to an equivalent size relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/Point.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToSensorPoint(android.graphics.PointF,android.util.Size,android.graphics.Rect,kotlin.Boolean)( streamPoint: https://developer.android.com/reference/android/graphics/PointF.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Converts a point relative to a specific camera stream to an equivalent point relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToSensorPoint(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Function2)( streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, crossinline toSensorPoint: (sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a point relative to a specific camera stream to an equivalent point relative to the camera sensor. |
| `https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToSensorRect(android.graphics.PointF,android.util.Size,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)( streamPoint: https://developer.android.com/reference/android/graphics/PointF.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, touchToFocusRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Converts a point relative to a specific camera stream to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToSensorRect(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Float,kotlin.Function4)( streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a point relative to a specific camera stream to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToUiPoint(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Function2)( streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, crossinline toUiPoint: (uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a point relative to a specific camera stream to an equivalent point relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/PointF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToUiPointF(android.graphics.PointF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)( streamPoint: https://developer.android.com/reference/android/graphics/PointF.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a point relative to a specific camera stream to an equivalent point relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamRectToSensorRect(android.graphics.RectF,android.util.Size,android.graphics.Rect,kotlin.Int,kotlin.Boolean)( streamRect: https://developer.android.com/reference/android/graphics/RectF.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamRectToSensorRect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Function4)( streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamRectToUiRect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Function4)( streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, crossinline toUiRect: (uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/RectF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamRectToUiRectF(android.graphics.RectF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)( streamRect: https://developer.android.com/reference/android/graphics/RectF.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to a UI element. |
| `https://developer.android.com/reference/android/util/Size.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamSizeToSensorSize(android.util.Size,android.util.Size,kotlin.Int,kotlin.Int)( size: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a size relative to a specific camera stream to an equivalent size relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamSizeToSensorSize(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function2)( streamSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toSensorSize: (sensorWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a size relative to a specific camera stream to an equivalent size relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamSizeToUiSize(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,androidx.camera.common.DiscreteRotation,kotlin.Function2)( streamSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, crossinline toUiSize: (width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a size relative to a specific camera stream to an equivalent size relative to a UI element. |
| `https://developer.android.com/reference/android/util/SizeF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamSizeToUiSizeF(android.util.Size,android.util.Size,android.util.Size,kotlin.Int)( size: https://developer.android.com/reference/android/util/Size.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a size relative to a specific camera stream to an equivalent size relative to a UI element. |
| `https://developer.android.com/reference/android/graphics/Point.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorPoint(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Boolean)( uiPoint: https://developer.android.com/reference/android/graphics/Point.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Converts a point relative to a UI element to an equivalent point relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorPoint(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Function2)( uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, crossinline toSensorPoint: (sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a point relative to a UI element to an equivalent point relative to the camera sensor. |
| `https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorRect(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)( uiPoint: https://developer.android.com/reference/android/graphics/Point.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, touchToFocusRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Converts a point relative to a UI element to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorRect(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Float,kotlin.Function4)( uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a point relative to a UI element to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToStreamPoint(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Function2)( uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, crossinline toStreamPoint: (streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a point relative to a UI element to an equivalent point relative to a specific camera stream. |
| `https://developer.android.com/reference/android/graphics/PointF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToStreamPointF(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)( uiPoint: https://developer.android.com/reference/android/graphics/Point.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a point relative to a UI element to an equivalent point relative to a specific camera stream. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToStreamRect(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Float,kotlin.Function4)( uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, crossinline toStreamRect: (streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a point relative to a UI element to an equivalent rectangle relative to a specific camera stream. |
| `https://developer.android.com/reference/android/graphics/RectF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToStreamRectF(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,kotlin.Float)( uiPoint: https://developer.android.com/reference/android/graphics/Point.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, touchToFocusRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Converts a point relative to a UI element to an equivalent rectangle relative to a specific camera stream. |
| `https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiRectToSensorRect(android.graphics.RectF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Int,kotlin.Boolean)( uiRect: https://developer.android.com/reference/android/graphics/RectF.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Converts a rectangle relative to a UI element to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiRectToSensorRect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Function4)( uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a rectangle relative to a UI element to an equivalent rectangle relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiRectToStreamRect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.camera.common.DiscreteRotation,kotlin.Function4)( uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, crossinline toStreamRect: (streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a rectangle relative to a UI element to an equivalent rectangle relative to a specific camera stream. |
| `https://developer.android.com/reference/android/graphics/RectF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiRectToStreamRectF(android.graphics.RectF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)( uiRect: https://developer.android.com/reference/android/graphics/RectF.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a rectangle relative to a UI element to an equivalent rectangle relative to a specific camera stream. |
| `https://developer.android.com/reference/android/util/Size.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiSizeToSensorSize(android.util.Size,android.util.Size,android.util.Size,kotlin.Int,kotlin.Int,kotlin.Int)( size: https://developer.android.com/reference/android/util/Size.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a size relative to a UI element to an equivalent size relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiSizeToSensorSize(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,androidx.camera.common.DiscreteRotation,kotlin.Int,kotlin.Int,kotlin.Function2)( uiSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline toSensorSize: (sensorWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T )` Converts a size relative to a UI element to an equivalent size relative to the camera sensor. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiSizeToStreamSize(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,androidx.camera.common.DiscreteRotation,kotlin.Function2)( uiSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation, crossinline toStreamSize: (streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T )` Converts a size relative to a UI element to an equivalent size relative to a specific camera stream. |
| `https://developer.android.com/reference/android/util/SizeF.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiSizeToStreamSizeF(android.util.Size,android.util.Size,android.util.Size,kotlin.Int)( size: https://developer.android.com/reference/android/util/Size.html, uiSize: https://developer.android.com/reference/android/util/Size.html, streamSize: https://developer.android.com/reference/android/util/Size.html, sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Converts a size relative to a UI element to an equivalent size relative to a specific camera stream. |

## Constants

### DEFAULT_MIN_SENSOR_PIXELS

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

```
const val DEFAULT_MIN_SENSOR_PIXELS = 32: Int
```

When converting to sensor coordinates, this is the minimum width/height for rectangles that will be sent to the sensor. This helps prevent scenarios where rectangles need to be clamped to the sensor, but where setting a small, or zero, size can lead to unexpected or bad behavior.

### DEFAULT_POINT_TO_RECT_RATIO

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

```
const val DEFAULT_POINT_TO_RECT_RATIO = 0.18375f: Float
```

It's common to need to convert a point into a sensor-relative rectangle for things like touch-to-focus, which often starts from a touch point that then needs to be converted into a sensor-relative rectangle.

This ratio is used to compute a rectangle based on the short dimension of the current stream.

## Public functions

### computeSensorRotationToDisplayOrientation

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

```
inline fun computeSensorRotationToDisplayOrientation(
    displayRotation: DiscreteRotation,
    sensorOrientation: DiscreteRotation,
    sensorIsFacingScreen: Boolean
): DiscreteRotation
```

Computes the rotation required to rotate coordinates from sensor space to the display coordinate system.

| Parameters |
|---|---|
| `displayRotation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The rotation of the display. This can be obtained from `https://developer.android.com/reference/android/view/Display.html#getRotation()` and converted using `https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation#fromSurfaceRotation(kotlin.Int)`. |
| `sensorOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The physical orientation of the sensor. |
| `sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera sensor is facing the screen (front-facing). |

### computeSensorRotationToDisplayOrientation

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

```
fun computeSensorRotationToDisplayOrientation(
    displayRotation: Int,
    sensorOrientation: Int,
    sensorIsFacingScreen: Boolean
): DiscreteRotation
```

Computes the rotation required to rotate coordinates from sensor space to the display coordinate system.

| Parameters |
|---|---|
| `displayRotation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The rotation of the display in degrees. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be obtained from `https://developer.android.com/reference/android/view/Display.html#getRotation()` and converted using `https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation#fromSurfaceRotation(kotlin.Int)` (e.g., `DiscreteRotation.fromSurfaceRotation(display.rotation).degrees`). (Note: do not pass `https://developer.android.com/reference/android/view/Surface.html#ROTATION_0`, `https://developer.android.com/reference/android/view/Surface.html#ROTATION_90`, etc. constants directly as they represent index values rather than degrees). Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The physical orientation of the sensor in degrees (typically `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_ORIENTATION`). Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera sensor is facing the screen (front-facing). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)` or `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)` is not one of `0`, `90`, `180`, or `270`. |

### computeSensorRotationToJpegOrientation

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

```
inline fun computeSensorRotationToJpegOrientation(
    deviceOrientation: DiscreteRotation,
    sensorOrientation: DiscreteRotation,
    sensorIsFacingScreen: Boolean
): DiscreteRotation
```

Computes the clockwise rotation required to be applied to the captured image to be viewed upright.

See `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#JPEG_ORIENTATION` for more details.

| Parameters |
|---|---|
| `deviceOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The physical orientation of the device. This is typically obtained from an `https://developer.android.com/reference/android/view/OrientationEventListener.html` and rounded to the nearest 90 degrees using `https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation#round(kotlin.Int)`. See the [Camera Orientation Guide](https://chromeos.dev/en/android/camera-orientation#jpeg-orientation) for more details. |
| `sensorOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The physical orientation of the sensor. |
| `sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera sensor is facing the screen (front-facing). |

### computeSensorRotationToJpegOrientation

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

```
fun computeSensorRotationToJpegOrientation(
    deviceOrientation: Int,
    sensorOrientation: Int,
    sensorIsFacingScreen: Boolean
): DiscreteRotation
```

Computes the clockwise rotation required to be applied to the captured image to be viewed upright.

See `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#JPEG_ORIENTATION` for more details.

| Parameters |
|---|---|
| `deviceOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The physical orientation of the device in degrees. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This is typically obtained from an `https://developer.android.com/reference/android/view/OrientationEventListener.html` and rounded to the nearest 90 degrees using `https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation#round(kotlin.Int)`. See the [Camera Orientation Guide](https://chromeos.dev/en/android/camera-orientation#jpeg-orientation) for more details. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The physical orientation of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_ORIENTATION`). Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorIsFacingScreen: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera sensor is facing the screen (front-facing). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToJpegOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)` or `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToJpegOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)` is not one of `0`, `90`, `180`, or `270`. |

### mapSensorPointToStreamPoint

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

```
inline fun <T : Any?> mapSensorPointToStreamPoint(
    sensorX: Int,
    sensorY: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toStreamPoint: (streamX: Float, streamY: Float) -> T
): T
```

Converts a point relative to the camera sensor to an equivalent point relative to a specific camera stream.

| Parameters |
|---|---|
| `sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `crossinline toStreamPoint: (streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapSensorPointToStreamPointF

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

```
fun mapSensorPointToStreamPointF(
    sensorPoint: Point,
    streamSize: Size,
    sensorCrop: Rect
): PointF
```

Converts a point relative to the camera sensor to an equivalent point relative to a specific camera stream.

| Parameters |
|---|---|
| `sensorPoint: https://developer.android.com/reference/android/graphics/Point.html` | The point on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). |

### mapSensorPointToUiPoint

```
inline fun <T : Any?> mapSensorPointToUiPoint(
    sensorX: Int,
    sensorY: Int,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toUiPoint: (uiX: Float, uiY: Float) -> T
): T
```

Converts a point relative to the camera sensor to an equivalent point relative to a UI element.

| Parameters |
|---|---|
| `sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `crossinline toUiPoint: (uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed UI coordinates. |

### mapSensorPointToUiPointF

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

```
fun mapSensorPointToUiPointF(
    sensorPoint: Point,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int,
    sensorCrop: Rect
): PointF
```

Converts a point relative to the camera sensor to an equivalent point relative to a UI element.

| Parameters |
|---|---|
| `sensorPoint: https://developer.android.com/reference/android/graphics/Point.html` | The point on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorPointToUiPointF(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect)` is not one of `0`, `90`, `180`, or `270`. |

### mapSensorRectToStreamRect

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

```
inline fun <T : Any?> mapSensorRectToStreamRect(
    sensorLeft: Int,
    sensorTop: Int,
    sensorRight: Int,
    sensorBottom: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toStreamRect: (streamLeft: Float, streamTop: Float, streamRight: Float, streamBottom: Float) -> T
): T
```

Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a specific camera stream.

| Parameters |
|---|---|
| `sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The left coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The top coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The right coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The bottom coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `crossinline toStreamRect: (streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapSensorRectToStreamRectF

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

```
fun mapSensorRectToStreamRectF(
    sensorRect: Rect,
    streamSize: Size,
    sensorCrop: Rect
): RectF
```

Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a specific camera stream.

| Parameters |
|---|---|
| `sensorRect: https://developer.android.com/reference/android/graphics/Rect.html` | The rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). |

### mapSensorRectToUiRect

```
inline fun <T : Any?> mapSensorRectToUiRect(
    sensorLeft: Int,
    sensorTop: Int,
    sensorRight: Int,
    sensorBottom: Int,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toUiRect: (uiLeft: Float, uiTop: Float, uiRight: Float, uiBottom: Float) -> T
): T
```

Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a UI element.

| Parameters |
|---|---|
| `sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The left coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The top coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The right coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The bottom coordinate of the rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `crossinline toUiRect: (uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed UI coordinates. |

### mapSensorRectToUiRectF

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

```
fun mapSensorRectToUiRectF(
    sensorRect: Rect,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int,
    sensorCrop: Rect
): RectF
```

Converts a rectangle relative to the camera sensor to an equivalent rectangle relative to a UI element.

| Parameters |
|---|---|
| `sensorRect: https://developer.android.com/reference/android/graphics/Rect.html` | The rectangle on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorRectToUiRectF(android.graphics.Rect,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect)` is not one of `0`, `90`, `180`, or `270`. |

### mapSensorSizeToStreamSize

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

```
inline fun <T : Any?> mapSensorSizeToStreamSize(
    sensorSizeWidth: Int,
    sensorSizeHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toStreamSize: (streamWidth: Float, streamHeight: Float) -> T
): T
```

Converts a size relative to the camera sensor to an equivalent size relative to a specific camera stream.

| Parameters |
|---|---|
| `sensorSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the size on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the size on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |
| `crossinline toStreamSize: (streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapSensorSizeToStreamSizeF

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

```
fun mapSensorSizeToStreamSizeF(
    size: Size,
    streamSize: Size,
    sensorCropWidth: Int,
    sensorCropHeight: Int
): SizeF
```

Converts a size relative to the camera sensor to an equivalent size relative to a specific camera stream.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/android/util/Size.html` | The size on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |

### mapSensorSizeToUiSize

```
inline fun <T : Any?> mapSensorSizeToUiSize(
    sensorSizeWidth: Int,
    sensorSizeHeight: Int,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toUiSize: (uiSizeWidth: Float, uiSizeHeight: Float) -> T
): T
```

Converts a size relative to the camera sensor to an equivalent size relative to a UI element.

| Parameters |
|---|---|
| `sensorSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the size on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the size on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |
| `crossinline toUiSize: (uiSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed UI coordinates. |

### mapSensorSizeToUiSizeF

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

```
fun mapSensorSizeToUiSizeF(
    size: Size,
    uiSize: Size,
    streamSize: Size,
    sensorRotationToDisplayOrientation: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int
): SizeF
```

Converts a size relative to the camera sensor to an equivalent size relative to a UI element.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/android/util/Size.html` | The size on the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapSensorSizeToUiSizeF(android.util.Size,android.util.Size,android.util.Size,kotlin.Int,kotlin.Int,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapStreamPointToSensorPoint

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

```
fun mapStreamPointToSensorPoint(
    streamPoint: PointF,
    streamSize: Size,
    sensorCrop: Rect,
    coerceToCropRegion: Boolean = true
): Point
```

Converts a point relative to a specific camera stream to an equivalent point relative to the camera sensor.

| Parameters |
|---|---|
| `streamPoint: https://developer.android.com/reference/android/graphics/PointF.html` | The point in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output point into the crop region. |

### mapStreamPointToSensorPoint

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

```
inline fun <T : Any?> mapStreamPointToSensorPoint(
    streamX: Float,
    streamY: Float,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    coerceToCropRegion: Boolean = true,
    crossinline toSensorPoint: (sensorX: Int, sensorY: Int) -> T
): T
```

Converts a point relative to a specific camera stream to an equivalent point relative to the camera sensor.

| Parameters |
|---|---|
| `streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output point into the crop region. |
| `crossinline toSensorPoint: (sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapStreamPointToSensorRect

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

```
fun mapStreamPointToSensorRect(
    streamPoint: PointF,
    streamSize: Size,
    sensorCrop: Rect,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true,
    touchToFocusRatio: Float = DEFAULT_POINT_TO_RECT_RATIO
): Rect
```

Converts a point relative to a specific camera stream to an equivalent rectangle relative to the camera sensor.

The output rectangle will have a size determined by the `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToSensorRect(android.graphics.PointF,android.util.Size,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)` and will be centered on the mapped point. If the calculated rectangle is smaller than `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToSensorRect(android.graphics.PointF,android.util.Size,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)` in either dimension, it will be expanded symmetrically from its center to reach the minimum.

| Parameters |
|---|---|
| `streamPoint: https://developer.android.com/reference/android/graphics/PointF.html` | The point in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to `0` or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |
| `touchToFocusRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_POINT_TO_RECT_RATIO` | The ratio to use when computing a rectangle based on the short dimension of the stream. |

### mapStreamPointToSensorRect

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

```
inline fun <T : Any?> mapStreamPointToSensorRect(
    streamX: Float,
    streamY: Float,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true,
    ratio: Float = DEFAULT_POINT_TO_RECT_RATIO,
    crossinline toSensorRect: (sensorLeft: Int, sensorTop: Int, sensorRight: Int, sensorBottom: Int) -> T
): T
```

Converts a point relative to a specific camera stream to an equivalent rectangle relative to the camera sensor.

| Parameters |
|---|---|
| `streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to 0 or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |
| `ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_POINT_TO_RECT_RATIO` | The ratio to use when computing a rectangle based on the short dimension of the stream. |
| `crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapStreamPointToUiPoint

```
inline fun <T : Any?> mapStreamPointToUiPoint(
    streamX: Float,
    streamY: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    crossinline toUiPoint: (uiX: Float, uiY: Float) -> T
): T
```

Converts a point relative to a specific camera stream to an equivalent point relative to a UI element.

| Parameters |
|---|---|
| `streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `crossinline toUiPoint: (uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed UI coordinates. |

### mapStreamPointToUiPointF

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

```
fun mapStreamPointToUiPointF(
    streamPoint: PointF,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int
): PointF
```

Converts a point relative to a specific camera stream to an equivalent point relative to a UI element.

| Parameters |
|---|---|
| `streamPoint: https://developer.android.com/reference/android/graphics/PointF.html` | The point in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamPointToUiPointF(android.graphics.PointF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapStreamRectToSensorRect

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

```
fun mapStreamRectToSensorRect(
    streamRect: RectF,
    streamSize: Size,
    sensorCrop: Rect,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true
): Rect
```

Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to the camera sensor.

| Parameters |
|---|---|
| `streamRect: https://developer.android.com/reference/android/graphics/RectF.html` | The rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to `0` or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |

### mapStreamRectToSensorRect

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

```
inline fun <T : Any?> mapStreamRectToSensorRect(
    streamLeft: Float,
    streamTop: Float,
    streamRight: Float,
    streamBottom: Float,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true,
    crossinline toSensorRect: (sensorLeft: Int, sensorTop: Int, sensorRight: Int, sensorBottom: Int) -> T
): T
```

Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to the camera sensor.

| Parameters |
|---|---|
| `streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The left coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The top coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The right coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The bottom coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to `0` or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |
| `crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapStreamRectToUiRect

```
inline fun <T : Any?> mapStreamRectToUiRect(
    streamLeft: Float,
    streamTop: Float,
    streamRight: Float,
    streamBottom: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    crossinline toUiRect: (uiLeft: Float, uiTop: Float, uiRight: Float, uiBottom: Float) -> T
): T
```

Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to a UI element.

| Parameters |
|---|---|
| `streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The left coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The top coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The right coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The bottom coordinate of the rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `crossinline toUiRect: (uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed UI coordinates. |

### mapStreamRectToUiRectF

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

```
fun mapStreamRectToUiRectF(
    streamRect: RectF,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int
): RectF
```

Converts a rectangle relative to a specific camera stream to an equivalent rectangle relative to a UI element.

| Parameters |
|---|---|
| `streamRect: https://developer.android.com/reference/android/graphics/RectF.html` | The rectangle in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamRectToUiRectF(android.graphics.RectF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapStreamSizeToSensorSize

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

```
fun mapStreamSizeToSensorSize(
    size: Size,
    streamSize: Size,
    sensorCropWidth: Int,
    sensorCropHeight: Int
): Size
```

Converts a size relative to a specific camera stream to an equivalent size relative to the camera sensor.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/android/util/Size.html` | The size in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |

### mapStreamSizeToSensorSize

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

```
inline fun <T : Any?> mapStreamSizeToSensorSize(
    streamSizeWidth: Float,
    streamSizeHeight: Float,
    streamWidth: Int,
    streamHeight: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toSensorSize: (sensorWidth: Int, sensorHeight: Int) -> T
): T
```

Converts a size relative to a specific camera stream to an equivalent size relative to the camera sensor.

| Parameters |
|---|---|
| `streamSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The width of the size in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The height of the size in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |
| `crossinline toSensorSize: (sensorWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapStreamSizeToUiSize

```
inline fun <T : Any?> mapStreamSizeToUiSize(
    streamSizeWidth: Float,
    streamSizeHeight: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    crossinline toUiSize: (width: Float, height: Float) -> T
): T
```

Converts a size relative to a specific camera stream to an equivalent size relative to a UI element.

| Parameters |
|---|---|
| `streamSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The width of the size in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The height of the size in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `crossinline toUiSize: (width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed UI coordinates. |

### mapStreamSizeToUiSizeF

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

```
fun mapStreamSizeToUiSizeF(
    size: Size,
    uiSize: Size,
    streamSize: Size,
    sensorRotationToDisplayOrientation: Int
): SizeF
```

Converts a size relative to a specific camera stream to an equivalent size relative to a UI element.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/android/util/Size.html` | The size in the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapStreamSizeToUiSizeF(android.util.Size,android.util.Size,android.util.Size,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiPointToSensorPoint

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

```
fun mapUiPointToSensorPoint(
    uiPoint: Point,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int,
    sensorCrop: Rect,
    coerceToCropRegion: Boolean = true
): Point
```

Converts a point relative to a UI element to an equivalent point relative to the camera sensor.

| Parameters |
|---|---|
| `uiPoint: https://developer.android.com/reference/android/graphics/Point.html` | The point in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output point into the crop region. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorPoint(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Boolean)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiPointToSensorPoint

```
inline fun <T : Any?> mapUiPointToSensorPoint(
    uiX: Float,
    uiY: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    coerceToCropRegion: Boolean = true,
    crossinline toSensorPoint: (sensorX: Int, sensorY: Int) -> T
): T
```

Converts a point relative to a UI element to an equivalent point relative to the camera sensor.

| Parameters |
|---|---|
| `uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output point into the crop region. |
| `crossinline toSensorPoint: (sensorX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapUiPointToSensorRect

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

```
fun mapUiPointToSensorRect(
    uiPoint: Point,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int,
    sensorCrop: Rect,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true,
    touchToFocusRatio: Float = DEFAULT_POINT_TO_RECT_RATIO
): Rect
```

Converts a point relative to a UI element to an equivalent rectangle relative to the camera sensor.

The output rectangle will have a size determined by the `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorRect(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)` and will be centered on the mapped point. If the calculated rectangle is smaller than `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorRect(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)` in either dimension, it will be expanded symmetrically from its center to reach the minimum.

| Parameters |
|---|---|
| `uiPoint: https://developer.android.com/reference/android/graphics/Point.html` | The point in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to `0` or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |
| `touchToFocusRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_POINT_TO_RECT_RATIO` | The ratio to use when computing a rectangle based on the short dimension of the stream. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToSensorRect(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Int,kotlin.Boolean,kotlin.Float)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiPointToSensorRect

```
inline fun <T : Any?> mapUiPointToSensorRect(
    uiX: Float,
    uiY: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true,
    ratio: Float = DEFAULT_POINT_TO_RECT_RATIO,
    crossinline toSensorRect: (sensorLeft: Int, sensorTop: Int, sensorRight: Int, sensorBottom: Int) -> T
): T
```

Converts a point relative to a UI element to an equivalent rectangle relative to the camera sensor.

| Parameters |
|---|---|
| `uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the UI. UI coordinates are relative to the uiWidth, and does not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the UI. UI coordinates are relative to the uiHeight, and does not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the streamWidth/streamHeight. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the streamWidth/streamHeight. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor 0,0. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor 0,0. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to 0 or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |
| `ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_POINT_TO_RECT_RATIO` | The ratio to use when computing a rectangle based on the short dimension of the stream. |
| `crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapUiPointToStreamPoint

```
inline fun <T : Any?> mapUiPointToStreamPoint(
    uiX: Float,
    uiY: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    crossinline toStreamPoint: (streamX: Float, streamY: Float) -> T
): T
```

Converts a point relative to a UI element to an equivalent point relative to a specific camera stream.

| Parameters |
|---|---|
| `uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `crossinline toStreamPoint: (streamX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapUiPointToStreamPointF

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

```
fun mapUiPointToStreamPointF(
    uiPoint: Point,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int
): PointF
```

Converts a point relative to a UI element to an equivalent point relative to a specific camera stream.

| Parameters |
|---|---|
| `uiPoint: https://developer.android.com/reference/android/graphics/Point.html` | The point in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored (e.g., for front-facing camera). |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToStreamPointF(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiPointToStreamRect

```
inline fun <T : Any?> mapUiPointToStreamRect(
    uiX: Float,
    uiY: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    ratio: Float = DEFAULT_POINT_TO_RECT_RATIO,
    crossinline toStreamRect: (streamLeft: Float, streamTop: Float, streamRight: Float, streamBottom: Float) -> T
): T
```

Converts a point relative to a UI element to an equivalent rectangle relative to a specific camera stream.

| Parameters |
|---|---|
| `uiX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The x coordinate in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The y coordinate in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_POINT_TO_RECT_RATIO` | The ratio to use when computing a rectangle based on the short dimension of the stream. |
| `crossinline toStreamRect: (streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapUiPointToStreamRectF

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

```
fun mapUiPointToStreamRectF(
    uiPoint: Point,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int,
    touchToFocusRatio: Float = DEFAULT_POINT_TO_RECT_RATIO
): RectF
```

Converts a point relative to a UI element to an equivalent rectangle relative to a specific camera stream.

| Parameters |
|---|---|
| `uiPoint: https://developer.android.com/reference/android/graphics/Point.html` | The point in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `touchToFocusRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DEFAULT_POINT_TO_RECT_RATIO` | The ratio to use when computing a rectangle based on the short dimension of the stream. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiPointToStreamRectF(android.graphics.Point,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,kotlin.Float)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiRectToSensorRect

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

```
fun mapUiRectToSensorRect(
    uiRect: RectF,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int,
    sensorCrop: Rect,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true
): Rect
```

Converts a rectangle relative to a UI element to an equivalent rectangle relative to the camera sensor.

| Parameters |
|---|---|
| `uiRect: https://developer.android.com/reference/android/graphics/RectF.html` | The rectangle in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCrop: https://developer.android.com/reference/android/graphics/Rect.html` | The crop region of the sensor (typically `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_ACTIVE_ARRAY_SIZE` if no crop is applied). Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to `0` or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiRectToSensorRect(android.graphics.RectF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int,android.graphics.Rect,kotlin.Int,kotlin.Boolean)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiRectToSensorRect

```
inline fun <T : Any?> mapUiRectToSensorRect(
    uiLeft: Float,
    uiTop: Float,
    uiRight: Float,
    uiBottom: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropX: Int,
    sensorCropY: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    minimumSensorSize: Int = DEFAULT_MIN_SENSOR_PIXELS,
    coerceToCropRegion: Boolean = true,
    crossinline toSensorRect: (sensorLeft: Int, sensorTop: Int, sensorRight: Int, sensorBottom: Int) -> T
): T
```

Converts a rectangle relative to a UI element to an equivalent rectangle relative to the camera sensor.

| Parameters |
|---|---|
| `uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The left coordinate of the rectangle in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The top coordinate of the rectangle in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The right coordinate of the rectangle in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The bottom coordinate of the rectangle in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The x coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The y coordinate of the crop region of the sensor. Sensor coordinates are relative to the sensor's top-left active pixel `(0,0)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the crop region of the sensor. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the crop region of the sensor. |
| `minimumSensorSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_MIN_SENSOR_PIXELS` | The minimum allowed width and height for the output rectangle in sensor pixels. If the calculated rectangle is smaller than this value in either dimension, it will be expanded symmetrically from its center to reach the minimum. Defaults to `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#DEFAULT_MIN_SENSOR_PIXELS()`. Set to `0` or less to disable this behavior. |
| `coerceToCropRegion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to coerce the output rectangle into the crop region. |
| `crossinline toSensorRect: (sensorLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapUiRectToStreamRect

```
inline fun <T : Any?> mapUiRectToStreamRect(
    uiLeft: Float,
    uiTop: Float,
    uiRight: Float,
    uiBottom: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    crossinline toStreamRect: (streamLeft: Float, streamTop: Float, streamRight: Float, streamBottom: Float) -> T
): T
```

Converts a rectangle relative to a UI element to an equivalent rectangle relative to a specific camera stream.

| Parameters |
|---|---|
| `uiLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The left coordinate of the rectangle in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The top coordinate of the rectangle in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The right coordinate of the rectangle in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The bottom coordinate of the rectangle in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `crossinline toStreamRect: (streamLeft: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamTop: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamRight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamBottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapUiRectToStreamRectF

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

```
fun mapUiRectToStreamRectF(
    uiRect: RectF,
    uiSize: Size,
    streamSize: Size,
    streamMirroring: Boolean,
    sensorRotationToDisplayOrientation: Int
): RectF
```

Converts a rectangle relative to a UI element to an equivalent rectangle relative to a specific camera stream.

| Parameters |
|---|---|
| `uiRect: https://developer.android.com/reference/android/graphics/RectF.html` | The rectangle in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamMirroring: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the camera stream is mirrored. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiRectToStreamRectF(android.graphics.RectF,android.util.Size,android.util.Size,kotlin.Boolean,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiSizeToSensorSize

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

```
fun mapUiSizeToSensorSize(
    size: Size,
    uiSize: Size,
    streamSize: Size,
    sensorRotationToDisplayOrientation: Int,
    sensorCropWidth: Int,
    sensorCropHeight: Int
): Size
```

Converts a size relative to a UI element to an equivalent size relative to the camera sensor.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/android/util/Size.html` | The size in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiSizeToSensorSize(android.util.Size,android.util.Size,android.util.Size,kotlin.Int,kotlin.Int,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |

### mapUiSizeToSensorSize

```
inline fun <T : Any?> mapUiSizeToSensorSize(
    uiSizeWidth: Float,
    uiSizeHeight: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    sensorCropWidth: Int,
    sensorCropHeight: Int,
    crossinline toSensorSize: (sensorWidth: Int, sensorHeight: Int) -> T
): T
```

Converts a size relative to a UI element to an equivalent size relative to the camera sensor.

| Parameters |
|---|---|
| `uiSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The width of the size in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The height of the size in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `sensorCropWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the sensor crop region. |
| `sensorCropHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the sensor crop region. |
| `crossinline toSensorSize: (sensorWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sensorHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> T` | A callback to construct the final return object from the computed sensor coordinates. |

### mapUiSizeToStreamSize

```
inline fun <T : Any?> mapUiSizeToStreamSize(
    uiSizeWidth: Float,
    uiSizeHeight: Float,
    uiWidth: Int,
    uiHeight: Int,
    streamWidth: Int,
    streamHeight: Int,
    sensorRotationToDisplayOrientation: DiscreteRotation,
    crossinline toStreamSize: (streamWidth: Float, streamHeight: Float) -> T
): T
```

Converts a size relative to a UI element to an equivalent size relative to a specific camera stream.

| Parameters |
|---|---|
| `uiSizeWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The width of the size in the UI. UI coordinates are relative to `uiWidth` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSizeHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The height of the size in the UI. UI coordinates are relative to `uiHeight` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the UI (specifically the UI-relative width of the viewfinder, without accounting for clipping or padding). |
| `uiHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the UI (specifically the UI-relative height of the viewfinder, without accounting for clipping or padding). |
| `streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The width of the camera stream. |
| `streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The height of the camera stream. |
| `sensorRotationToDisplayOrientation: https://developer.android.com/reference/kotlin/androidx/camera/common/DiscreteRotation` | The orientation from sensor to display. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. |
| `crossinline toStreamSize: (streamWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, streamHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> T` | A callback to construct the final return object from the computed stream coordinates. |

### mapUiSizeToStreamSizeF

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

```
fun mapUiSizeToStreamSizeF(
    size: Size,
    uiSize: Size,
    streamSize: Size,
    sensorRotationToDisplayOrientation: Int
): SizeF
```

Converts a size relative to a UI element to an equivalent size relative to a specific camera stream.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/android/util/Size.html` | The size in the UI. UI coordinates are relative to `uiSize` and do not account for the positioning of the UI. Callers must normalize coordinates to account for clipping or padding before calling this function. |
| `uiSize: https://developer.android.com/reference/android/util/Size.html` | The size of the UI (specifically the UI-relative size of the viewfinder, without accounting for clipping or padding). |
| `streamSize: https://developer.android.com/reference/android/util/Size.html` | The size of the camera stream. Stream coordinates are relative to the `streamWidth` and `streamHeight` boundaries. |
| `sensorRotationToDisplayOrientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The orientation from sensor to display. Must be one of `0`, `90`, `180`, or `270`. Negative values are not supported. This can be computed using `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#computeSensorRotationToDisplayOrientation(kotlin.Int,kotlin.Int,kotlin.Boolean)`. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraMath#mapUiSizeToStreamSizeF(android.util.Size,android.util.Size,android.util.Size,kotlin.Int)` is not one of `0`, `90`, `180`, or `270`. |