HardwareBufferNativeHelpers


@ExperimentalApi
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 functions

Boolean

Copies a Bitmap to a HardwareBuffer.

Boolean

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

Public functions

nativeCopyBitmapToHardwareBuffer

@RequiresApi(value = 26)
fun nativeCopyBitmapToHardwareBuffer(bitmap: Bitmap!, hb: HardwareBuffer!): Boolean

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.

hb: HardwareBuffer!

The destination hardware buffer.

Returns
Boolean

Whether the copy is successful.

nativeCopyHardwareBufferToHardwareBuffer

@RequiresApi(value = 26)
fun nativeCopyHardwareBufferToHardwareBuffer(
    srcHb: HardwareBuffer!,
    dstHb: HardwareBuffer!
): Boolean

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
srcHb: HardwareBuffer!

The source hardware buffer.

dstHb: HardwareBuffer!

The destination hardware buffer.

Returns
Boolean

Whether the copy is successful.