Skip to main content

OH_NativeWindow_LockBuffer

Function OH_NativeWindow_LockBuffer 

Source
pub unsafe extern "C" fn OH_NativeWindow_LockBuffer(
    window: *mut NativeWindow,
    region: Region,
    buffer: *mut *mut NativeWindowBuffer,
) -> i32
Available on crate features native_window and api-23 only.
Expand description

Requests an OHNativeWindowBuffer through an OHNativeWindow instance for content production,

and lock the OHNativeWindowBuffer, the interface needs to be paired with

OH_NativeWindow_UnlockAndFlushBuffer for use, after lock, it must be unlocked in order to relock,

repeatedly lock or unlock will return an illegal operation error code, the interface supports rendering images

directly through memory read and write on the CPU. This interface is a non-thread-safe type interface.

Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow

§Arguments

  • window - Indicates the pointer to a OHNativeWindow instance.

  • region - Indicates the info of the dirty region.

  • buffer - Indicates the pointer to an OHNativeWindowBuffer pointer.

§Returns

  • [NATIVE_ERROR_OK] 0 - Success. [NATIVE_ERROR_INVALID_ARGUMENTS] 40001000 - window or buffer is NULL. [NATIVE_ERROR_UNKNOWN] 50002000 - surface of window is NULL.

Available since API-level: 23

Version: 1.0