HardwareBufferNativeHelpers


@ExperimentalApi
public interface HardwareBufferNativeHelpers

Known direct subclasses
FakeHardwareBufferNativeHelpers

Fake class to simulate HardwareBufferNativeHelpers.

HardwareBufferJniWrapper

Wrapper for HardwareBuffer interaction and native ByteBuffer query JNI methods.

Known indirect subclasses
HardwareBufferJni

JNI methods for HardwareBuffer interaction and native ByteBuffer queries in libmedia3EffectJNI.


Wrapper for HardwareBuffer JNI methods.

Summary

Public methods

abstract boolean

Copies a Bitmap to a HardwareBuffer.

abstract boolean

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer.

Public methods

nativeCopyBitmapToHardwareBuffer

@RequiresApi(value = 26)
abstract boolean nativeCopyBitmapToHardwareBuffer(Bitmap bitmap, HardwareBuffer hb)

Copies a Bitmap to a HardwareBuffer.

The destination HardwareBuffer must have USAGE_CPU_WRITE_OFTEN usage.

The source Bitmap.Config must match the destination getFormat, and be either ARGB_8888 and RGBA_8888 or RGBA_1010102 and RGBA_1010102.

Parameters
Bitmap bitmap

The source bitmap.

HardwareBuffer hb

The destination hardware buffer.

Returns
boolean

Whether the copy is successful.

nativeCopyHardwareBufferToHardwareBuffer

@RequiresApi(value = 26)
abstract boolean nativeCopyHardwareBufferToHardwareBuffer(
    HardwareBuffer srcHb,
    HardwareBuffer dstHb
)

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer.

The source HardwareBuffer must have USAGE_CPU_READ_OFTEN usage, and the destination HardwareBuffer must have USAGE_CPU_WRITE_OFTEN usage.

The formats of the source and destination buffers must match, and be either RGBA_8888 or RGBA_1010102.

Parameters
HardwareBuffer srcHb

The source hardware buffer.

HardwareBuffer dstHb

The destination hardware buffer.

Returns
boolean

Whether the copy is successful.