# MutableImageWrapper

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

*** ** * ** ***


```
public interface MutableImageWrapper extends ImageWrapper
```

<br />

Known direct subclasses [FakeImage](https://developer.android.com/reference/androidx/camera/common/testing/FakeImage)

|---|---|
| `https://developer.android.com/reference/androidx/camera/common/testing/FakeImage` | Fake implementation of `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper` for testing. |

*** ** * ** ***

A mutable extension of `https://developer.android.com/reference/androidx/camera/common/ImageWrapper` that allows modifying properties of the image.

This interface is useful when modifying the metadata of an image, such as its crop rectangle, timestamp, or synchronization fence.

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#getCropRect()()` The crop rectangle of the image. |
| `abstract int` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#getDataSpace()()` The dataspace associated with this image. |
| `abstract https://developer.android.com/reference/android/hardware/SyncFence.html` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#getSyncFence()()` The sync fence associated with this image, or `null` if there is no fence. |
| `abstract long` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#getTimestamp()()` The timestamp associated with this image, in nanoseconds. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#setCropRect(android.graphics.Rect)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html value)` The crop rectangle of the image. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#setDataSpace(kotlin.Int)(int value)` The dataspace associated with this image. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#setSyncFence(android.hardware.SyncFence)(https://developer.android.com/reference/android/hardware/SyncFence.html value)` The sync fence associated with this image, or `null` if there is no fence. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/common/MutableImageWrapper#setTimestamp(kotlin.Long)(long value)` The timestamp associated with this image, in nanoseconds. |

### Inherited methods

From [androidx.camera.common.ImageWrapper](https://developer.android.com/reference/androidx/camera/common/ImageWrapper) `abstract void` `https://developer.android.com/reference/androidx/camera/common/ImageWrapper#close()()`

Closes the underlying image and releases any associated resources.
`abstract int` `https://developer.android.com/reference/androidx/camera/common/ImageWrapper#getFormat()()`

The format of the image.
`default https://developer.android.com/reference/android/hardware/HardwareBuffer.html` `https://developer.android.com/reference/androidx/camera/common/ImageWrapper#getHardwareBuffer()()`

The handle to the underlying image's hardware buffer, or `null` if this image does not support hardware buffers.
`abstract int` `https://developer.android.com/reference/androidx/camera/common/ImageWrapper#getHeight()()`

The height of the image in pixels.
`abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/ImagePlane>` `https://developer.android.com/reference/androidx/camera/common/ImageWrapper#getImagePlanes()()`

The list of pixel planes for this image.
`abstract int` `https://developer.android.com/reference/androidx/camera/common/ImageWrapper#getWidth()()`

The width of the image in pixels.
From [androidx.camera.common.UnsafeWrapper](https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper) `abstract T` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> type)`

Attempts to unwrap this object into the specified underlying `https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`.

## Public methods

### getCropRect

```
abstract @NonNull Rect getCropRect()
```

The crop rectangle of the image.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setCropRect(android.graphics.Rect)` |   |

### getDataSpace

```
abstract int getDataSpace()
```

The dataspace associated with this image.

The value set must be one of the constants defined in `https://developer.android.com/reference/androidx/camera/common/ImageDataSpace`.

Value is one of the following:

- `4096`
- `4098`
- `4100`
- `4101`
- `0`
- `406913024`
- `142671872`
- `411107328`
- `143261696`
- `168165376`
- `163971072`
- `151715840`
- `146931712`
- `281149440`
- `281280512`
- `147193856`
- `281083904`
- `155844608`
- `138477568`

<br />

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setDataSpace(int)` |   |
| `https://developer.android.com/reference/androidx/camera/common/ImageDataSpace` |   |

### getSyncFence

```
abstract SyncFence getSyncFence()
```

The sync fence associated with this image, or `null` if there is no fence.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setFence(android.hardware.SyncFence)` |   |

### getTimestamp

```
abstract long getTimestamp()
```

The timestamp associated with this image, in nanoseconds.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setTimestamp(long)` |   |

### setCropRect

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

```
abstract void setCropRect(@NonNull Rect value)
```

The crop rectangle of the image.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setCropRect(android.graphics.Rect)` |   |

### setDataSpace

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

```
abstract void setDataSpace(int value)
```

The dataspace associated with this image.

The value set must be one of the constants defined in `https://developer.android.com/reference/androidx/camera/common/ImageDataSpace`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setDataSpace(int)` |   |
| `https://developer.android.com/reference/androidx/camera/common/ImageDataSpace` |   |

### setSyncFence

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

```
abstract void setSyncFence(SyncFence value)
```

The sync fence associated with this image, or `null` if there is no fence.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setFence(android.hardware.SyncFence)` |   |

### setTimestamp

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

```
abstract void setTimestamp(long value)
```

The timestamp associated with this image, in nanoseconds.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/Image.html#setTimestamp(long)` |   |