OH_NativeImage_AcquireNativeWindowBuffer

Function OH_NativeImage_AcquireNativeWindowBuffer 

Source
pub unsafe extern "C" fn OH_NativeImage_AcquireNativeWindowBuffer(
    image: *mut OH_NativeImage,
    nativeWindowBuffer: *mut *mut NativeWindowBuffer,
    fenceFd: *mut i32,
) -> i32
Available on crate features native_image and api-12 only.
Expand description

Acquire an OHNativeWindowBuffer through an OH_NativeImage instance for content consumer.

This method can not be used at the same time with OH_NativeImage_UpdateSurfaceImage.

This method will create an OHNativeWindowBuffer.

When using OHNativeWindowBuffer, need to increase its reference count by OH_NativeWindow_NativeObjectReference.

When the OHNativeWindowBuffer is used up, its reference count needs to be decremented by OH_NativeWindow_NativeObjectUnreference.

This interface needs to be used in conjunction with OH_NativeImage_ReleaseNativeWindowBuffer, otherwise memory leaks will occur.

When the fenceFd is used up, you need to close it.

This interface is a non-thread-safe type interface.

Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeImage

§Arguments

  • image - Indicates the pointer to a OH_NativeImage instance.

  • nativeWindowBuffer - Indicates the pointer to an OHNativeWindowBuffer point.

  • fenceFd - Indicates the pointer to a file descriptor handle.

§Returns

  • [NATIVE_ERROR_OK] 0 - Success. [NATIVE_ERROR_INVALID_ARGUMENTS] 40001000 - image, nativeWindowBuffer, fenceFd is NULL. [NATIVE_ERROR_NO_BUFFER] 40601000 - No buffer for consume.

Available since API-level: 12

Version: 1.0