AndroidImage


public final class AndroidImage implements MutableImageWrapper


ImageWrapper implementation that wraps an android.media.Image object.

Summary

Nested types

public final class AndroidImage.Plane implements ImagePlane

A Plane backed by an ImagePlane.

Public constructors

Public methods

void
@NonNull Rect
int
int
HardwareBuffer

Returns a handle to the underlying image's hardware buffer, or null if this image does not support hardware buffer.

int
@NonNull List<@NonNull ImagePlane>
SyncFence
long
int
void
setCropRect(@NonNull Rect newRectValue)
void
setDataSpace(int value)
void
void
setTimestamp(long value)
@NonNull String
T
<T extends Object> unwrapAs(@NonNull Class<@NonNull T> type)

Attempt to unwrap this object into an underlying type.

Public constructors

AndroidImage

Added in 1.7.0-alpha02
public AndroidImage(@NonNull Image image)

Public methods

close

Added in 1.7.0-alpha02
public void close()

getCropRect

public @NonNull Rect getCropRect()
See also
setCropRect

getDataSpace

public int getDataSpace()
See also
setDataSpace

getFormat

public int getFormat()
See also
getFormat

getHardwareBuffer

public HardwareBuffer getHardwareBuffer()

Returns a handle to the underlying image's hardware buffer, or null if this image does not support hardware buffer.

The android.hardware.HardwareBuffer follows the lifecycle of its associated image. It is not required to be closed explicitly; however, the image needs to be closed after finishing processing the hardware buffer. In other words, if the hardware buffer is being used, the image cannot be closed.

getHeight

public int getHeight()
See also
getHeight

getImagePlanes

public @NonNull List<@NonNull ImagePlanegetImagePlanes()
See also
getPlanes

getSyncFence

public SyncFence getSyncFence()
See also
setFence

getTimestamp

public long getTimestamp()
See also
setTimestamp

getWidth

public int getWidth()
See also
getWidth

setCropRect

public void setCropRect(@NonNull Rect newRectValue)
See also
setCropRect

setDataSpace

public void setDataSpace(int value)
See also
setDataSpace

setSyncFence

public void setSyncFence(SyncFence value)
See also
setFence

setTimestamp

public void setTimestamp(long value)
See also
setTimestamp

toString

public @NonNull String toString()

unwrapAs

public T <T extends Object> unwrapAs(@NonNull Class<@NonNull T> type)

Attempt to unwrap this object into an underlying type.

This operation is not safe and should be used with caution as it makes no guarantees about the state of the underlying objects. In particular, implementations should assume that fakes, test wrappers will always return null. Finally this method should return null when unwrapping into the provided type is not supported.

Returns
T

unwrapped object matching T or null