OH_NativeWindow_CreateNativeWindowFromSurfaceId

Function OH_NativeWindow_CreateNativeWindowFromSurfaceId 

Source
pub unsafe extern "C" fn OH_NativeWindow_CreateNativeWindowFromSurfaceId(
    surfaceId: u64,
    window: *mut *mut NativeWindow,
) -> i32
Available on crate features native_window and api-12 only.
Expand description

Creates an OHNativeWindow instance.

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

If there is a concurrent destroy OHNativeWindow, you need to add once and decrement once to the OHNativeWindow reference count through OH_NativeWindow_NativeObjectReference and OH_NativeWindow_NativeObjectUnreference.

If the surface obtained through surfaceId is created in this process, the surface cannot be obtained across processes.

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

Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow

§Arguments

  • surfaceId - Indicates the surfaceId to a surface.

  • window - indicates the pointer to an OHNativeWindow instance.

§Returns

  • Returns an error code, 0 is Success, otherwise, failed.

Available since API-level: 12

Version: 1.0