HardwareBufferJniWrapper


@RequiresApi(value = 26)
@ExperimentalApi
public interface HardwareBufferJniWrapper extends HardwareBufferNativeHelpers


Wrapper for HardwareBuffer JNI methods.

Summary

Public methods

abstract boolean
nativeBindEGLImage(int target, long eglImageHandle)

Binds an EGLImage to the specified texture target.

abstract boolean

Copies a Bitmap to a HardwareBuffer.

abstract boolean

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

abstract long
nativeCreateEglImageFromHardwareBuffer(
    long displayHandle,
    @NonNull HardwareBuffer hardwareBuffer
)

Creates an EGLImage from a HardwareBuffer.

abstract boolean
nativeDestroyEGLImage(long displayHandle, long imageHandle)

Destroys an EGLImage.

Public methods

nativeBindEGLImage

abstract boolean nativeBindEGLImage(int target, long eglImageHandle)

Binds an EGLImage to the specified texture target. Returns whether the binding is successful.

nativeCopyBitmapToHardwareBuffer

abstract boolean nativeCopyBitmapToHardwareBuffer(
    @NonNull Bitmap bitmap,
    @NonNull HardwareBuffer hb
)

Copies a Bitmap to a HardwareBuffer. Returns whether the copy is successful.

The destination HardwareBuffer must have HardwareBuffer.USAGE_CPU_WRITE_OFTEN usage.

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

nativeCopyHardwareBufferToHardwareBuffer

abstract boolean nativeCopyHardwareBufferToHardwareBuffer(
    @NonNull HardwareBuffer srcHb,
    @NonNull HardwareBuffer dstHb
)

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer. Returns whether the copy is successful.

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

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

nativeCreateEglImageFromHardwareBuffer

abstract long nativeCreateEglImageFromHardwareBuffer(
    long displayHandle,
    @NonNull HardwareBuffer hardwareBuffer
)

Creates an EGLImage from a HardwareBuffer.

nativeDestroyEGLImage

abstract boolean nativeDestroyEGLImage(long displayHandle, long imageHandle)

Destroys an EGLImage. Returns whether the deletion is successful.