Skip to main content

ohos_native_window_sys/
lib.rs

1/* automatically generated by rust-bindgen 0.65.1 */
2
3#![allow(non_snake_case)]
4#![allow(non_upper_case_globals)]
5#![allow(non_camel_case_types)]
6#![allow(clippy::missing_safety_doc)]
7
8use ohos_native_buffer_sys::*;
9
10#[link(name = "native_window")]
11unsafe extern "C" {}
12
13#[repr(C)]
14#[derive(Default)]
15pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
16impl<T> __IncompleteArrayField<T> {
17    #[inline]
18    pub const fn new() -> Self {
19        __IncompleteArrayField(::std::marker::PhantomData, [])
20    }
21    #[inline]
22    pub fn as_ptr(&self) -> *const T {
23        self as *const _ as *const T
24    }
25    #[inline]
26    pub fn as_mut_ptr(&mut self) -> *mut T {
27        self as *mut _ as *mut T
28    }
29    #[inline]
30    pub unsafe fn as_slice(&self, len: usize) -> &[T] {
31        ::std::slice::from_raw_parts(self.as_ptr(), len)
32    }
33    #[inline]
34    pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
35        ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
36    }
37}
38impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
39    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
40        fmt.write_str("__IncompleteArrayField")
41    }
42}
43#[repr(C)]
44#[derive(Debug, Copy, Clone)]
45pub struct OHIPCParcel {
46    _unused: [u8; 0],
47}
48#[doc = " @brief native window.\n @since 8"]
49#[repr(C)]
50#[derive(Debug, Copy, Clone)]
51pub struct NativeWindow {
52    _unused: [u8; 0],
53}
54#[doc = " @brief define the new type name OHNativeWindow for struct NativeWindow.\n @since 8"]
55pub type OHNativeWindow = NativeWindow;
56#[doc = " @brief define the new type name OHNativeWindowBuffer for struct NativeWindowBuffer.\n @since 8"]
57pub type OHNativeWindowBuffer = NativeWindowBuffer;
58#[doc = " @brief indicates a dirty region where content is updated.\n @since 8"]
59#[repr(C)]
60#[derive(Debug, Copy, Clone)]
61pub struct Region {
62    pub rects: *mut Region_Rect,
63    #[doc = " if rectNumber is 0, fill the Buffer dirty size by default"]
64    pub rectNumber: i32,
65}
66#[doc = " if rects is nullptr, fill the Buffer dirty size by default"]
67#[repr(C)]
68#[derive(Debug, Copy, Clone)]
69pub struct Region_Rect {
70    pub x: i32,
71    pub y: i32,
72    pub w: u32,
73    pub h: u32,
74}
75#[doc = " set native window buffer geometry,\n variable parameter in function is\n [in] int32_t width, [in] int32_t height"]
76pub const NativeWindowOperation_SET_BUFFER_GEOMETRY: NativeWindowOperation = 0;
77#[doc = " get native window buffer geometry,\n variable parameter in function is\n [out] int32_t *height, [out] int32_t *width"]
78pub const NativeWindowOperation_GET_BUFFER_GEOMETRY: NativeWindowOperation = 1;
79#[doc = " get native window buffer format,\n variable parameter in function is\n [out] int32_t *format, the enumeration value refers to {@link OH_NativeBuffer_Format}."]
80pub const NativeWindowOperation_GET_FORMAT: NativeWindowOperation = 2;
81#[doc = " set native window buffer format,\n variable parameter in function is\n [in] int32_t format, the enumeration value refers to {@link OH_NativeBuffer_Format}."]
82pub const NativeWindowOperation_SET_FORMAT: NativeWindowOperation = 3;
83#[doc = " get native window buffer usage,\n variable parameter in function is\n [out] uint64_t *usage, the enumeration value refers to {@link OH_NativeBuffer_Usage}."]
84pub const NativeWindowOperation_GET_USAGE: NativeWindowOperation = 4;
85#[doc = " set native window buffer usage,\n variable parameter in function is\n [in] uint64_t usage, the enumeration value refers to {@link OH_NativeBuffer_Usage}."]
86pub const NativeWindowOperation_SET_USAGE: NativeWindowOperation = 5;
87#[doc = " set native window buffer stride,\n variable parameter in function is\n [in] int32_t stride.\n @deprecated since 16"]
88pub const NativeWindowOperation_SET_STRIDE: NativeWindowOperation = 6;
89#[doc = " get native window buffer stride,\n variable parameter in function is\n [out] int32_t *stride.\n @deprecated since 16\n @useinstead Use {@link OH_NativeWindow_GetBufferHandleFromNative} to get a {@link BufferHandleand} from a buffer\n and then retrieve the stride from the {@link BufferHandle}."]
90pub const NativeWindowOperation_GET_STRIDE: NativeWindowOperation = 7;
91#[doc = " set native window buffer swap interval,\n variable parameter in function is\n [in] int32_t interval."]
92pub const NativeWindowOperation_SET_SWAP_INTERVAL: NativeWindowOperation = 8;
93#[doc = " get native window buffer swap interval,\n variable parameter in function is\n [out] int32_t *interval."]
94pub const NativeWindowOperation_GET_SWAP_INTERVAL: NativeWindowOperation = 9;
95#[doc = " set the timeout in milliseconds when the native window requests a buffer,\n the default value is 3000 milliseconds when not set,\n variable parameter in function is\n [in] int32_t timeout, in milliseconds."]
96pub const NativeWindowOperation_SET_TIMEOUT: NativeWindowOperation = 10;
97#[doc = " get the timeout in milliseconds when the native window requests a buffer,\n the default value is 3000 milliseconds when not set,\n variable parameter in function is\n [out] int32_t *timeout, in milliseconds."]
98pub const NativeWindowOperation_GET_TIMEOUT: NativeWindowOperation = 11;
99#[doc = " set native window buffer colorGamut,\n variable parameter in function is\n [in] int32_t colorGamut, the enumeration value refers to {@link OH_NativeBuffer_ColorGamut}."]
100pub const NativeWindowOperation_SET_COLOR_GAMUT: NativeWindowOperation = 12;
101#[doc = " get native window buffer colorGamut,\n variable parameter in function is\n [out] int32_t *colorGamut, the enumeration value refers to {@link OH_NativeBuffer_ColorGamut}."]
102pub const NativeWindowOperation_GET_COLOR_GAMUT: NativeWindowOperation = 13;
103#[doc = " set native window buffer transform,\n variable parameter in function is\n [in] int32_t transform, the enumeration value refers to {@link OH_NativeBuffer_TransformType}."]
104pub const NativeWindowOperation_SET_TRANSFORM: NativeWindowOperation = 14;
105#[doc = " get native window buffer transform,\n variable parameter in function is\n [out] int32_t *transform, the enumeration value refers to {@link OH_NativeBuffer_TransformType}."]
106pub const NativeWindowOperation_GET_TRANSFORM: NativeWindowOperation = 15;
107#[doc = " set native window buffer uiTimestamp,\n variable parameter in function is\n [in] uint64_t uiTimestamp."]
108pub const NativeWindowOperation_SET_UI_TIMESTAMP: NativeWindowOperation = 16;
109#[doc = " get native window bufferqueue size,\n variable parameter in function is\n [out] int32_t *size.\n @since 12"]
110pub const NativeWindowOperation_GET_BUFFERQUEUE_SIZE: NativeWindowOperation = 17;
111#[doc = " set surface source type,\n variable parameter in function is\n [in] int32_t sourceType, the enumeration value refers to {@link OHSurfaceSource}.\n @since 12"]
112pub const NativeWindowOperation_SET_SOURCE_TYPE: NativeWindowOperation = 18;
113#[doc = " get surface source type,\n variable parameter in function is\n [out] int32_t *sourceType, the enumeration value refers to {@link OHSurfaceSource}.\n @since 12"]
114pub const NativeWindowOperation_GET_SOURCE_TYPE: NativeWindowOperation = 19;
115#[doc = " set app framework type,\n variable parameter in function is\n [in] char* frameworkType. maximum length is 64 bytes, otherwise the setting fails.\n @since 12"]
116pub const NativeWindowOperation_SET_APP_FRAMEWORK_TYPE: NativeWindowOperation = 20;
117#[doc = " get app framework type,\n variable parameter in function is\n [out] char** frameworkType.\n @since 12"]
118pub const NativeWindowOperation_GET_APP_FRAMEWORK_TYPE: NativeWindowOperation = 21;
119#[doc = " set hdr white point brightness,\n variable parameter in function is\n [in] float brightness. the value range is 0.0f to 1.0f.\n @since 12"]
120pub const NativeWindowOperation_SET_HDR_WHITE_POINT_BRIGHTNESS: NativeWindowOperation = 22;
121#[doc = " set sdr white point brightness,\n variable parameter in function is\n [in] float brightness. the value range is 0.0f to 1.0f.\n @since 12"]
122pub const NativeWindowOperation_SET_SDR_WHITE_POINT_BRIGHTNESS: NativeWindowOperation = 23;
123#[doc = " Set native window buffer desiredPresentTimestamp, indicates the desired time to present the buffer.\\n\n Which should be generated by std::chrono::steady_clock in nanoseconds.\\n\n It is only effective when RenderService is the consumer.\\n\n The buffer will wait until desiredPresentTimestamp is reached before being consumed and displayed.\\n\n If multiple buffers reach desiredPresentTimestamp, the earlier buffer will be dropped.\\n\n This Operation should be called before calling <b>OH_NativeWindow_NativeWindowFlushBuffer</b>.\\n\n If desiredPresentTimestamp is greater than 1 second of the consumer-provided timestamp,\n the desiredPresentTimestamp will be ignored.\\n\n Variable parameter in function is\n [in] int64_t desiredPresentTimestamp.\n @since 13"]
124#[cfg(feature = "api-13")]
125pub const NativeWindowOperation_SET_DESIRED_PRESENT_TIMESTAMP: NativeWindowOperation = 24;
126#[doc = " @brief Indicates the operation code in the function OH_NativeWindow_NativeWindowHandleOpt.\n @since 8"]
127pub type NativeWindowOperation = u32;
128#[doc = " the window content is not updated until a buffer of\n the window size is received"]
129pub const OHScalingMode_OH_SCALING_MODE_FREEZE: OHScalingMode = 0;
130#[doc = " the buffer is scaled in two dimensions to match the window size"]
131pub const OHScalingMode_OH_SCALING_MODE_SCALE_TO_WINDOW: OHScalingMode = 1;
132#[doc = " the buffer is uniformly scaled so that the smaller size of\n the buffer matches the window size"]
133pub const OHScalingMode_OH_SCALING_MODE_SCALE_CROP: OHScalingMode = 2;
134#[doc = " the window is clipped to the size of the buffer's clipping rectangle\n pixels outside the clipping rectangle are considered fully transparent."]
135pub const OHScalingMode_OH_SCALING_MODE_NO_SCALE_CROP: OHScalingMode = 3;
136#[doc = " @brief Indicates Scaling Mode.\n @since 9\n @deprecated since 10\n @useinstead OHScalingModeV2"]
137pub type OHScalingMode = u32;
138#[doc = " the window content is not updated until a buffer of\n the window size is received"]
139pub const OHScalingModeV2_OH_SCALING_MODE_FREEZE_V2: OHScalingModeV2 = 0;
140#[doc = " the buffer is scaled in two dimensions to match the window size"]
141pub const OHScalingModeV2_OH_SCALING_MODE_SCALE_TO_WINDOW_V2: OHScalingModeV2 = 1;
142#[doc = " the buffer is uniformly scaled so that the smaller size of\n the buffer matches the window size"]
143pub const OHScalingModeV2_OH_SCALING_MODE_SCALE_CROP_V2: OHScalingModeV2 = 2;
144#[doc = " the window is clipped to the size of the buffer's clipping rectangle\n pixels outside the clipping rectangle are considered fully transparent."]
145pub const OHScalingModeV2_OH_SCALING_MODE_NO_SCALE_CROP_V2: OHScalingModeV2 = 3;
146#[doc = " Adapt to the buffer and scale proportionally to the buffer size. Prioritize displaying all buffer content.\n If the size is not the same as the window size, fill the unfilled area of the window with a background color."]
147pub const OHScalingModeV2_OH_SCALING_MODE_SCALE_FIT_V2: OHScalingModeV2 = 4;
148#[doc = " @brief Indicates Scaling Mode.\n @since 12"]
149pub type OHScalingModeV2 = u32;
150pub const OHHDRMetadataKey_OH_METAKEY_RED_PRIMARY_X: OHHDRMetadataKey = 0;
151pub const OHHDRMetadataKey_OH_METAKEY_RED_PRIMARY_Y: OHHDRMetadataKey = 1;
152pub const OHHDRMetadataKey_OH_METAKEY_GREEN_PRIMARY_X: OHHDRMetadataKey = 2;
153pub const OHHDRMetadataKey_OH_METAKEY_GREEN_PRIMARY_Y: OHHDRMetadataKey = 3;
154pub const OHHDRMetadataKey_OH_METAKEY_BLUE_PRIMARY_X: OHHDRMetadataKey = 4;
155pub const OHHDRMetadataKey_OH_METAKEY_BLUE_PRIMARY_Y: OHHDRMetadataKey = 5;
156pub const OHHDRMetadataKey_OH_METAKEY_WHITE_PRIMARY_X: OHHDRMetadataKey = 6;
157pub const OHHDRMetadataKey_OH_METAKEY_WHITE_PRIMARY_Y: OHHDRMetadataKey = 7;
158pub const OHHDRMetadataKey_OH_METAKEY_MAX_LUMINANCE: OHHDRMetadataKey = 8;
159pub const OHHDRMetadataKey_OH_METAKEY_MIN_LUMINANCE: OHHDRMetadataKey = 9;
160pub const OHHDRMetadataKey_OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL: OHHDRMetadataKey = 10;
161pub const OHHDRMetadataKey_OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL: OHHDRMetadataKey = 11;
162pub const OHHDRMetadataKey_OH_METAKEY_HDR10_PLUS: OHHDRMetadataKey = 12;
163pub const OHHDRMetadataKey_OH_METAKEY_HDR_VIVID: OHHDRMetadataKey = 13;
164#[doc = " @brief Enumerates the HDR metadata keys.\n @since 9\n @deprecated since 10"]
165pub type OHHDRMetadataKey = u32;
166#[doc = " @brief Defines the HDR metadata.\n @since 9\n @deprecated since 10"]
167#[repr(C)]
168#[derive(Debug, Copy, Clone)]
169pub struct OHHDRMetaData {
170    pub key: OHHDRMetadataKey,
171    pub value: f32,
172}
173#[doc = " @brief Defines the ExtData Handle\n @since 9\n @deprecated since 10"]
174#[repr(C)]
175#[derive(Debug)]
176pub struct OHExtDataHandle {
177    pub fd: i32,
178    pub reserveInts: u32,
179    pub reserve: __IncompleteArrayField<i32>,
180}
181extern "C" {
182    #[doc = " @brief Creates a <b>OHNativeWindow</b> instance. A new <b>OHNativeWindow</b> instance is created each time this function is called.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param pSurface Indicates the pointer to a <b>ProduceSurface</b>. The type is a pointer to <b>sptr<OHOS::Surface></b>.\n @return Returns the pointer to the <b>OHNativeWindow</b> instance created.\n @since 8\n @version 1.0\n @deprecated since 12"]
183    pub fn OH_NativeWindow_CreateNativeWindow(
184        pSurface: *mut ::std::os::raw::c_void,
185    ) -> *mut OHNativeWindow;
186}
187extern "C" {
188    #[doc = " @brief Decreases the reference count of a <b>OHNativeWindow</b> instance by 1,\n and when the reference count reaches 0, destroys the instance.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @since 8\n @version 1.0"]
189    pub fn OH_NativeWindow_DestroyNativeWindow(window: *mut OHNativeWindow);
190}
191extern "C" {
192    #[doc = " @brief Creates a <b>OHNativeWindowBuffer</b> instance. A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param pSurfaceBuffer Indicates the pointer to a produce buffer. The type is <b>sptr<OHOS::SurfaceBuffer></b>.\n @return Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.\n @since 8\n @version 1.0\n @deprecated since 12\n @useinstead OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer"]
193    pub fn OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(
194        pSurfaceBuffer: *mut ::std::os::raw::c_void,
195    ) -> *mut OHNativeWindowBuffer;
196}
197extern "C" {
198    #[doc = " @brief Creates a <b>OHNativeWindowBuffer</b> instance.\\n\n A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.\\n\n This interface needs to be used in conjunction with <b>OH_NativeWindow_DestroyNativeWindowBuffer</b>,\n otherwise memory leaks will occur.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param nativeBuffer Indicates the pointer to a native buffer. The type is <b>OH_NativeBuffer*</b>.\n @return Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.\n @since 11\n @version 1.0"]
199    pub fn OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(
200        nativeBuffer: *mut OH_NativeBuffer,
201    ) -> *mut OHNativeWindowBuffer;
202}
203extern "C" {
204    #[doc = " @brief Decreases the reference count of a <b>OHNativeWindowBuffer</b> instance by 1 and,\n when the reference count reaches 0, destroys the instance.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.\n @since 8\n @version 1.0"]
205    pub fn OH_NativeWindow_DestroyNativeWindowBuffer(buffer: *mut OHNativeWindowBuffer);
206}
207extern "C" {
208    #[doc = " @brief Requests a <b>OHNativeWindowBuffer</b> through a <b>OHNativeWindow</b> instance for content production.\\n\n Before calling this interface, you need to set the width and height of\n <b>OHNativeWindow</b> through <b>SET_BUFFER_GEOMETRY</b>.\\n\n This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeWindowFlushBuffer</b>,\n otherwise buffer will be exhausted.\\n\n When the fenceFd is used up, you need to close it.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param buffer Indicates the double pointer to a <b>OHNativeWindowBuffer</b> instance.\n @param fenceFd Indicates the pointer to a file descriptor handle.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 8\n @version 1.0"]
209    pub fn OH_NativeWindow_NativeWindowRequestBuffer(
210        window: *mut OHNativeWindow,
211        buffer: *mut *mut OHNativeWindowBuffer,
212        fenceFd: *mut ::std::os::raw::c_int,
213    ) -> i32;
214}
215extern "C" {
216    #[doc = " @brief Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue\n through a <b>OHNativeWindow</b> instance for content consumption.\\n\n The fenceFd will be close by system.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.\n @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization.\n @param region Indicates a dirty region where content is updated.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 8\n @version 1.0"]
217    pub fn OH_NativeWindow_NativeWindowFlushBuffer(
218        window: *mut OHNativeWindow,
219        buffer: *mut OHNativeWindowBuffer,
220        fenceFd: ::std::os::raw::c_int,
221        region: Region,
222    ) -> i32;
223}
224extern "C" {
225    #[doc = " @brief Get the last flushed <b>OHNativeWindowBuffer</b> from a <b>OHNativeWindow</b> instance.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> pointer.\n @param fenceFd Indicates the pointer to a file descriptor handle.\n @param matrix Indicates the retrieved 4*4 transform matrix.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 11\n @version 1.0\n @deprecated since 12\n @useinstead OH_NativeWindow_GetLastFlushedBufferV2"]
226    pub fn OH_NativeWindow_GetLastFlushedBuffer(
227        window: *mut OHNativeWindow,
228        buffer: *mut *mut OHNativeWindowBuffer,
229        fenceFd: *mut ::std::os::raw::c_int,
230        matrix: *mut f32,
231    ) -> i32;
232}
233extern "C" {
234    #[doc = " @brief Returns the <b>OHNativeWindowBuffer</b> to the buffer queue through a <b>OHNativeWindow</b> instance,\n without filling in any content. The <b>OHNativeWindowBuffer</b> can be used for another request.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 8\n @version 1.0"]
235    pub fn OH_NativeWindow_NativeWindowAbortBuffer(
236        window: *mut OHNativeWindow,
237        buffer: *mut OHNativeWindowBuffer,
238    ) -> i32;
239}
240extern "C" {
241    #[doc = " @brief Sets or obtains the attributes of a native window, including the width, height, and content format.\\n\n This interface is a non-thread-safe type interface.\\n\n\n <p><strong>API Note</strong>\n\n <strong>Performance Note</strong>\n <p>By default, the window buffer in the current operating system is accessed via the CPU. If an application\n does not need to access the window buffer data using the CPU, it can proactively disable CPU access to\n enhance energy efficiency and reduce power consumption.\n </p>\n <p>For details about how to optimize power consumption for data read/write operations in data buffers,\n see [How do I proactively disable CPU access to window buffers to reduce power consumption?]{@link https://developer.huawei.com/consumer/en/doc/harmonyos-faqs/faqs-arkgraphics-2d-14}.</p>\n </p>\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param code Indicates the operation code, pointer to <b>NativeWindowOperation</b>.\n @param ... variable parameter, must correspond to code one-to-one.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 8\n @version 1.0"]
242    pub fn OH_NativeWindow_NativeWindowHandleOpt(
243        window: *mut OHNativeWindow,
244        code: ::std::os::raw::c_int,
245        ...
246    ) -> i32;
247}
248extern "C" {
249    #[doc = " @brief Obtains the pointer to a <b>BufferHandle</b> of a <b>OHNativeWindowBuffer</b> instance.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.\n @return Returns the pointer to the <b>BufferHandle</b> instance obtained.\n @since 8\n @version 1.0"]
250    pub fn OH_NativeWindow_GetBufferHandleFromNative(
251        buffer: *mut OHNativeWindowBuffer,
252    ) -> *mut BufferHandle;
253}
254extern "C" {
255    #[doc = " @brief Adds the reference count of a native object.\\n\n This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeObjectUnreference</b>,\n otherwise memory leaks will occur.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param obj Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 8\n @version 1.0"]
256    pub fn OH_NativeWindow_NativeObjectReference(obj: *mut ::std::os::raw::c_void) -> i32;
257}
258extern "C" {
259    #[doc = " @brief Decreases the reference count of a native object and,\n when the reference count reaches 0, destroys this object.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param obj Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 8\n @version 1.0"]
260    pub fn OH_NativeWindow_NativeObjectUnreference(obj: *mut ::std::os::raw::c_void) -> i32;
261}
262extern "C" {
263    #[doc = " @brief Obtains the magic ID of a native object.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param obj Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.\n @return Returns the magic ID, which is unique for each native object.\n @since 8\n @version 1.0"]
264    pub fn OH_NativeWindow_GetNativeObjectMagic(obj: *mut ::std::os::raw::c_void) -> i32;
265}
266extern "C" {
267    #[doc = " @brief Sets scalingMode of a native window.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param sequence Indicates the sequence to a produce buffer.\n @param scalingMode Indicates the enum value to <b>OHScalingMode</b>\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 9\n @version 1.0\n @deprecated since 10\n @useinstead OH_NativeWindow_NativeWindowSetScalingModeV2"]
268    pub fn OH_NativeWindow_NativeWindowSetScalingMode(
269        window: *mut OHNativeWindow,
270        sequence: u32,
271        scalingMode: OHScalingMode,
272    ) -> i32;
273}
274extern "C" {
275    #[doc = " @brief Sets metaData of a native window.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param sequence Indicates the sequence to a produce buffer.\n @param size Indicates the size of a <b>OHHDRMetaData</b> vector.\n @param metaDate Indicates the pointer to a <b>OHHDRMetaData</b> vector.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 9\n @version 1.0\n @deprecated since 10"]
276    pub fn OH_NativeWindow_NativeWindowSetMetaData(
277        window: *mut OHNativeWindow,
278        sequence: u32,
279        size: i32,
280        metaData: *const OHHDRMetaData,
281    ) -> i32;
282}
283extern "C" {
284    #[doc = " @brief Sets metaDataSet of a native window.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param sequence Indicates the sequence to a produce buffer.\n @param key Indicates the enum value to <b>OHHDRMetadataKey</b>\n @param size Indicates the size of a uint8_t vector.\n @param metaDate Indicates the pointer to a uint8_t vector.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 9\n @version 1.0\n @deprecated since 10"]
285    pub fn OH_NativeWindow_NativeWindowSetMetaDataSet(
286        window: *mut OHNativeWindow,
287        sequence: u32,
288        key: OHHDRMetadataKey,
289        size: i32,
290        metaData: *const u8,
291    ) -> i32;
292}
293extern "C" {
294    #[doc = " @brief Sets tunnel handle of a native window.\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param handle Indicates the pointer to a <b>OHExtDataHandle</b>.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 9\n @version 1.0\n @deprecated since 10"]
295    pub fn OH_NativeWindow_NativeWindowSetTunnelHandle(
296        window: *mut OHNativeWindow,
297        handle: *const OHExtDataHandle,
298    ) -> i32;
299}
300extern "C" {
301    #[doc = " @brief Attach a buffer to an <b>OHNativeWindow</b> instance.\\n\n This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeWindowDetachBuffer</b>,\n otherwise buffer management will be chaotic.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 12\n @version 1.0"]
302    pub fn OH_NativeWindow_NativeWindowAttachBuffer(
303        window: *mut OHNativeWindow,
304        buffer: *mut OHNativeWindowBuffer,
305    ) -> i32;
306}
307extern "C" {
308    #[doc = " @brief Detach a buffer from an <b>OHNativeWindow</b> instance.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 12\n @version 1.0"]
309    pub fn OH_NativeWindow_NativeWindowDetachBuffer(
310        window: *mut OHNativeWindow,
311        buffer: *mut OHNativeWindowBuffer,
312    ) -> i32;
313}
314extern "C" {
315    #[doc = " @brief Get surfaceId from native window.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @param surfaceId Indicates the pointer to a surfaceId.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 12\n @version 1.0"]
316    pub fn OH_NativeWindow_GetSurfaceId(window: *mut OHNativeWindow, surfaceId: *mut u64) -> i32;
317}
318extern "C" {
319    #[doc = " @brief Creates an <b>OHNativeWindow</b> instance.\\n\n This interface needs to be used in conjunction with <b>OH_NativeWindow_DestroyNativeWindow</b>,\n otherwise memory leaks will occur.\\n\n If there is a concurrent destroy OHNativeWindow, you need to add once and decrement once to the\n OHNativeWindow reference count through <b>OH_NativeWindow_NativeObjectReference</b> and\n <b>OH_NativeWindow_NativeObjectUnreference</b>.\\n\n If the surface obtained through surfaceId is created in this process, the surface cannot be obtained\n across processes.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param surfaceId Indicates the surfaceId to a surface.\n @param window indicates the pointer to an <b>OHNativeWindow</b> instance.\n @return Returns an error code, 0 is Success, otherwise, failed.\n @since 12\n @version 1.0"]
320    pub fn OH_NativeWindow_CreateNativeWindowFromSurfaceId(
321        surfaceId: u64,
322        window: *mut *mut OHNativeWindow,
323    ) -> i32;
324}
325extern "C" {
326    #[doc = " @brief Sets scalingMode of a native window.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window indicates the pointer to an <b>OHNativeWindow</b> instance.\n @param scalingMode Indicates the enum value to <b>OHScalingModeV2</b>\n @return Returns an error code, 0 is Success, otherwise, failed.\n @since 12\n @version 1.0"]
327    pub fn OH_NativeWindow_NativeWindowSetScalingModeV2(
328        window: *mut OHNativeWindow,
329        scalingMode: OHScalingModeV2,
330    ) -> i32;
331}
332extern "C" {
333    #[doc = " @brief Set native window buffer hold.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @since 12\n @version 1.0"]
334    pub fn OH_NativeWindow_SetBufferHold(window: *mut OHNativeWindow);
335}
336extern "C" {
337    #[doc = " @brief Write an OHNativeWindow to an OHIPCParcel.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @param parcel Indicates the pointer to an <b>OHIPCParcel</b> instance.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - parcel is NULL or window is NULL.\n @since 12\n @version 1.0"]
338    pub fn OH_NativeWindow_WriteToParcel(
339        window: *mut OHNativeWindow,
340        parcel: *mut OHIPCParcel,
341    ) -> i32;
342}
343extern "C" {
344    #[doc = " @brief Read an OHNativeWindow from an OHIPCParcel.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param parcel Indicates the pointer to an <b>OHIPCParcel</b> instance.\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - parcel is NULL or parcel does not contain the window.\n @since 12\n @version 1.0"]
345    pub fn OH_NativeWindow_ReadFromParcel(
346        parcel: *mut OHIPCParcel,
347        window: *mut *mut OHNativeWindow,
348    ) -> i32;
349}
350extern "C" {
351    #[doc = " @brief Get the last flushed <b>OHNativeWindowBuffer</b> from an <b>OHNativeWindow</b> instance.\\n\n When the fenceFd is used up, you need to close it.\\n\n This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeObjectUnreference</b>,\n otherwise memory leaks will occur.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.\n @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.\n @param fenceFd Indicates the pointer to a file descriptor handle.\n @param matrix Indicates the retrieved 4*4 transform matrix.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL or buffer is NULL or fenceFd is NULL.\n     {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - buffer state is wrong.\n @since 12\n @version 1.0"]
352    pub fn OH_NativeWindow_GetLastFlushedBufferV2(
353        window: *mut OHNativeWindow,
354        buffer: *mut *mut OHNativeWindowBuffer,
355        fenceFd: *mut ::std::os::raw::c_int,
356        matrix: *mut f32,
357    ) -> i32;
358}
359extern "C" {
360    #[doc = " @brief Set the color space of the native window.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param colorSpace Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL.\n     {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect colorSpace state.\n @since 12\n @version 1.0"]
361    pub fn OH_NativeWindow_SetColorSpace(
362        window: *mut OHNativeWindow,
363        colorSpace: OH_NativeBuffer_ColorSpace,
364    ) -> i32;
365}
366extern "C" {
367    #[doc = " @brief Get the color space of the native window.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param colorSpace Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL.\n     {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect colorSpace state.\n @since 12\n @version 1.0"]
368    pub fn OH_NativeWindow_GetColorSpace(
369        window: *mut OHNativeWindow,
370        colorSpace: *mut OH_NativeBuffer_ColorSpace,
371    ) -> i32;
372}
373extern "C" {
374    #[doc = " @brief Set the metadata type of the native window.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param metadataKey Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.\n @param size Indicates the size of a uint8_t vector.\n @param metadata Indicates the pointer to a uint8_t vector.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window or metadata is NULL.\n     {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state.\n     {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key.\n @since 12\n @version 1.0"]
375    pub fn OH_NativeWindow_SetMetadataValue(
376        window: *mut OHNativeWindow,
377        metadataKey: OH_NativeBuffer_MetadataKey,
378        size: i32,
379        metadata: *mut u8,
380    ) -> i32;
381}
382extern "C" {
383    #[doc = " @brief Set the metadata type of the native window.\\n\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param metadataKey Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.\n @param size Indicates the size of a uint8_t vector.\n @param metadata Indicates the pointer to a uint8_t vector.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window, metadata, or size is NULL.\n     {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state.\n     {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key.\n @since 12\n @version 1.0"]
384    pub fn OH_NativeWindow_GetMetadataValue(
385        window: *mut OHNativeWindow,
386        metadataKey: OH_NativeBuffer_MetadataKey,
387        size: *mut i32,
388        metadata: *mut *mut u8,
389    ) -> i32;
390}
391extern "C" {
392    #[doc = " @brief Clean all <b>OHNativeWindowBuffer</b> caches of this <b>OHNativeWindow</b>\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL.\n     {@link NATIVE_ERROR_CONSUMER_DISCONNECTED} 41211000 - the consumer is disconnected.\n     {@link NATIVE_ERROR_BINDER_ERROR} 50401000 - ipc send failed.\n @since 19\n @version 1.0"]
393    #[cfg(feature = "api-19")]
394    pub fn OH_NativeWindow_CleanCache(window: *mut OHNativeWindow) -> i32;
395}
396extern "C" {
397    #[doc = " @brief PreAlloc <b>OHNativeWindowBuffer</b> of this <b>OHNativeWindow</b>\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param allocBufferCnt Indicates the count of <b>OHNativeWindowBuffers</b>.\n @return Returns an error code, 0 is success, otherwise, failed.\n @since 22\n @version 1.0"]
398    #[cfg(feature = "api-22")]
399    pub fn OH_NativeWindow_PreAllocBuffers(window: *mut OHNativeWindow, allocBufferCnt: u32)
400        -> i32;
401}
402extern "C" {
403    #[doc = " @brief Requests an <b>OHNativeWindowBuffer</b> through an <b>OHNativeWindow</b> instance for content production,\\n\n and lock the <b>OHNativeWindowBuffer</b>, the interface needs to be paired with\\n\n <b>OH_NativeWindow_UnlockAndFlushBuffer</b> for use, after lock, it must be unlocked in order to relock,\\n\n repeatedly lock or unlock will return an illegal operation error code, the interface supports rendering images\\n\n directly through memory read and write on the CPU.\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @param region Indicates the info of the dirty region.\n @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window or buffer is NULL.\n     {@link NATIVE_ERROR_UNKNOWN} 50002000 - surface of window is NULL.\n @since 23\n @version 1.0"]
404    #[cfg(feature = "api-23")]
405    pub fn OH_NativeWindow_LockBuffer(
406        window: *mut OHNativeWindow,
407        region: Region,
408        buffer: *mut *mut OHNativeWindowBuffer,
409    ) -> i32;
410}
411extern "C" {
412    #[doc = " @brief Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue through an \\n\n <b>OHNativeWindow</b> instance for content consumption, and unlock the <b>OHNativeWindowBuffer</b>.\n This interface is a non-thread-safe type interface.\\n\n\n @syscap SystemCapability.Graphic.Graphic2D.NativeWindow\n @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.\n @return {@link NATIVE_ERROR_OK} 0 - Success.\n     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL.\n     {@link NATIVE_ERROR_UNKNOWN} 50002000 - surface of window is NULL.\n @since 23\n @version 1.0"]
413    #[cfg(feature = "api-23")]
414    pub fn OH_NativeWindow_UnlockAndFlushBuffer(window: *mut OHNativeWindow) -> i32;
415}