# CaptureResultWrappers

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/CaptureResultWrapper.kt+class:androidx.camera.common.CaptureResultWrappers) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
object CaptureResultWrappers
```

<br />

*** ** * ** ***

Helper utilities for constructing and wrapping `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrapper` instances.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrapper` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrappers#wrap(android.hardware.camera2.CaptureResult,androidx.camera.common.CameraId,androidx.camera.common.CaptureRequestWrapper,kotlin.collections.Map)( captureResult: https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html, cameraId: https://developer.android.com/reference/kotlin/androidx/camera/common/CameraId, captureRequest: https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper, metadata: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/camera/common/Metadata.Key<*>, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> )` Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` into a `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrapper`. |

## Public functions

### wrap

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

```
fun wrap(
    captureResult: CaptureResult,
    cameraId: CameraId,
    captureRequest: CaptureRequestWrapper,
    metadata: Map<Metadata.Key<*>, Any?> = emptyMap()
): CaptureResultWrapper
```

Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` into a `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrapper`.

```kotlin
import androidx.camera.common.CameraId
import androidx.camera.common.CaptureRequestWrappers
import androidx.camera.common.CaptureResultWrapper
import androidx.camera.common.CaptureResultWrappers

val cameraId = CameraId("0")
val captureRequest = CaptureRequestWrappers.wrap(captureResult.request)

// Wrap a native CaptureResult into a CaptureResultWrapper.
val resultWrapper: CaptureResultWrapper =
    CaptureResultWrappers.wrap(
        captureResult = captureResult,
        cameraId = cameraId,
        captureRequest = captureRequest,
    )

// Query standard Camera2 result keys:
val lensState = resultWrapper[CaptureResult.LENS_STATE]
val frameNumber = resultWrapper.frameNumber
val originatingRequest = resultWrapper.captureRequest
```

| Parameters |
|---|---|
| `captureResult: https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` | the native `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` to wrap. |
| `cameraId: https://developer.android.com/reference/kotlin/androidx/camera/common/CameraId` | the `https://developer.android.com/reference/kotlin/androidx/camera/common/CameraId` of the camera device that produced the result. |
| `captureRequest: https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper` | the `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper` representing the request that produced this result. |
| `metadata: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/camera/common/Metadata.Key<*>, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> = emptyMap()` | optional map of custom `https://developer.android.com/reference/kotlin/androidx/camera/common/Metadata.Key` values to attach to the wrapper. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrapper` | a `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrapper` wrapping the given `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureResultWrappers#wrap(android.hardware.camera2.CaptureResult,androidx.camera.common.CameraId,androidx.camera.common.CaptureRequestWrapper,kotlin.collections.Map)` and metadata. |