Skip to main content

ohos_window_sys/native_window/external_window/
external_window_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6#[cfg(feature = "api-12")]
7use crate::native_buffer::buffer_common::{
8    OH_NativeBuffer_ColorSpace, OH_NativeBuffer_MetadataKey,
9};
10use crate::native_window::BufferHandle;
11#[cfg(feature = "api-12")]
12use ohos_sys_opaque_types::OHIPCParcel;
13#[cfg(feature = "api-11")]
14use ohos_sys_opaque_types::OH_NativeBuffer;
15use ohos_sys_opaque_types::{OHNativeWindow, OHNativeWindowBuffer};
16
17#[repr(C)]
18#[derive(Default)]
19pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
20impl<T> __IncompleteArrayField<T> {
21    #[inline]
22    pub const fn new() -> Self {
23        __IncompleteArrayField(::core::marker::PhantomData, [])
24    }
25    #[inline]
26    pub fn as_ptr(&self) -> *const T {
27        self as *const _ as *const T
28    }
29    #[inline]
30    pub fn as_mut_ptr(&mut self) -> *mut T {
31        self as *mut _ as *mut T
32    }
33    #[inline]
34    pub unsafe fn as_slice(&self, len: usize) -> &[T] {
35        ::core::slice::from_raw_parts(self.as_ptr(), len)
36    }
37    #[inline]
38    pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
39        ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
40    }
41}
42impl<T> ::core::fmt::Debug for __IncompleteArrayField<T> {
43    fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
44        fmt.write_str("__IncompleteArrayField")
45    }
46}
47/// indicates a dirty region where content is updated.
48///
49/// Available since API-level: 8
50#[repr(C)]
51#[derive(Debug, Copy, Clone)]
52pub struct Region {
53    pub rects: *mut Region_Rect,
54    /// if rectNumber is 0, fill the Buffer dirty size by default
55    pub rectNumber: i32,
56}
57/// if rects is nullptr, fill the Buffer dirty size by default
58#[repr(C)]
59#[derive(Debug, Copy, Clone)]
60pub struct Region_Rect {
61    pub x: i32,
62    pub y: i32,
63    pub w: u32,
64    pub h: u32,
65}
66pub mod NativeWindowOperation {
67    /// Indicates the operation code in the function OH_NativeWindow_NativeWindowHandleOpt.
68    ///
69    /// Available since API-level: 8
70    pub type Type = ::core::ffi::c_uint;
71    /// set native window buffer geometry,
72    /// variable parameter in function is
73    /// [in] int32_t width, [in] int32_t height
74    pub const SET_BUFFER_GEOMETRY: Type = 0;
75    /// get native window buffer geometry,
76    /// variable parameter in function is
77    /// [out] int32_t *height, [out] int32_t *width
78    pub const GET_BUFFER_GEOMETRY: Type = 1;
79    /// get native window buffer format,
80    /// variable parameter in function is
81    /// [out] int32_t *format, the enumeration value refers to [`OH_NativeBuffer_Format`].
82    pub const GET_FORMAT: Type = 2;
83    /// set native window buffer format,
84    /// variable parameter in function is
85    /// [in] int32_t format, the enumeration value refers to [`OH_NativeBuffer_Format`].
86    pub const SET_FORMAT: Type = 3;
87    /// get native window buffer usage,
88    /// variable parameter in function is
89    /// [out] uint64_t *usage, the enumeration value refers to [`OH_NativeBuffer_Usage`].
90    pub const GET_USAGE: Type = 4;
91    /// set native window buffer usage,
92    /// variable parameter in function is
93    /// [in] uint64_t usage, the enumeration value refers to [`OH_NativeBuffer_Usage`].
94    pub const SET_USAGE: Type = 5;
95    /// set native window buffer stride,
96    /// variable parameter in function is
97    /// [in] int32_t stride.
98    ///
99    /// **Deprecated** since 16
100    #[deprecated(since = "16")]
101    pub const SET_STRIDE: Type = 6;
102    /// get native window buffer stride,
103    /// variable parameter in function is
104    /// [out] int32_t *stride.
105    ///
106    /// **Deprecated** since 16
107    ///
108    /// **Use instead:** Use [`OH_NativeWindow_GetBufferHandleFromNative`] to get a [`BufferHandleand`] from a buffer
109    /// and then retrieve the stride from the [`BufferHandle`].
110    #[deprecated(
111        since = "16",
112        note = "Use instead: Use OH_NativeWindow_GetBufferHandleFromNative to get a BufferHandleand from a buffer and then retrieve the stride from the BufferHandle"
113    )]
114    pub const GET_STRIDE: Type = 7;
115    /// set native window buffer swap interval,
116    /// variable parameter in function is
117    /// [in] int32_t interval.
118    pub const SET_SWAP_INTERVAL: Type = 8;
119    /// get native window buffer swap interval,
120    /// variable parameter in function is
121    /// [out] int32_t *interval.
122    pub const GET_SWAP_INTERVAL: Type = 9;
123    /// set the timeout in milliseconds when the native window requests a buffer,
124    /// the default value is 3000 milliseconds when not set,
125    /// variable parameter in function is
126    /// [in] int32_t timeout, in milliseconds.
127    pub const SET_TIMEOUT: Type = 10;
128    /// get the timeout in milliseconds when the native window requests a buffer,
129    /// the default value is 3000 milliseconds when not set,
130    /// variable parameter in function is
131    /// [out] int32_t *timeout, in milliseconds.
132    pub const GET_TIMEOUT: Type = 11;
133    /// set native window buffer colorGamut,
134    /// variable parameter in function is
135    /// [in] int32_t colorGamut, the enumeration value refers to [`OH_NativeBuffer_ColorGamut`].
136    pub const SET_COLOR_GAMUT: Type = 12;
137    /// get native window buffer colorGamut,
138    /// variable parameter in function is
139    /// [out] int32_t *colorGamut, the enumeration value refers to [`OH_NativeBuffer_ColorGamut`].
140    pub const GET_COLOR_GAMUT: Type = 13;
141    /// set native window buffer transform,
142    /// variable parameter in function is
143    /// [in] int32_t transform, the enumeration value refers to [`OH_NativeBuffer_TransformType`].
144    pub const SET_TRANSFORM: Type = 14;
145    /// get native window buffer transform,
146    /// variable parameter in function is
147    /// [out] int32_t *transform, the enumeration value refers to [`OH_NativeBuffer_TransformType`].
148    pub const GET_TRANSFORM: Type = 15;
149    /// set native window buffer uiTimestamp,
150    /// variable parameter in function is
151    /// [in] uint64_t uiTimestamp.
152    pub const SET_UI_TIMESTAMP: Type = 16;
153    /// get native window bufferqueue size,
154    /// variable parameter in function is
155    /// [out] int32_t *size.
156    ///
157    /// Available since API-level: 12
158    #[cfg(feature = "api-12")]
159    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
160    pub const GET_BUFFERQUEUE_SIZE: Type = 17;
161    /// set surface source type,
162    /// variable parameter in function is
163    /// [in] int32_t sourceType, the enumeration value refers to [`OHSurfaceSource`].
164    ///
165    /// Available since API-level: 12
166    #[cfg(feature = "api-12")]
167    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
168    pub const SET_SOURCE_TYPE: Type = 18;
169    /// get surface source type,
170    /// variable parameter in function is
171    /// [out] int32_t *sourceType, the enumeration value refers to [`OHSurfaceSource`].
172    ///
173    /// Available since API-level: 12
174    #[cfg(feature = "api-12")]
175    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
176    pub const GET_SOURCE_TYPE: Type = 19;
177    /// set app framework type,
178    /// variable parameter in function is
179    /// [in] char* frameworkType. maximum length is 64 bytes, otherwise the setting fails.
180    ///
181    /// Available since API-level: 12
182    #[cfg(feature = "api-12")]
183    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
184    pub const SET_APP_FRAMEWORK_TYPE: Type = 20;
185    /// get app framework type,
186    /// variable parameter in function is
187    /// [out] char** frameworkType.
188    ///
189    /// Available since API-level: 12
190    #[cfg(feature = "api-12")]
191    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
192    pub const GET_APP_FRAMEWORK_TYPE: Type = 21;
193    /// set hdr white point brightness,
194    /// variable parameter in function is
195    /// [in] float brightness. the value range is 0.0f to 1.0f.
196    ///
197    /// Available since API-level: 12
198    #[cfg(feature = "api-12")]
199    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
200    pub const SET_HDR_WHITE_POINT_BRIGHTNESS: Type = 22;
201    /// set sdr white point brightness,
202    /// variable parameter in function is
203    /// [in] float brightness. the value range is 0.0f to 1.0f.
204    ///
205    /// Available since API-level: 12
206    #[cfg(feature = "api-12")]
207    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
208    pub const SET_SDR_WHITE_POINT_BRIGHTNESS: Type = 23;
209    /// Set native window buffer desiredPresentTimestamp, indicates the desired time to present the buffer.
210    ///
211    /// Which should be generated by std::chrono::steady_clock in nanoseconds.
212    ///
213    /// It is only effective when RenderService is the consumer.
214    ///
215    /// The buffer will wait until desiredPresentTimestamp is reached before being consumed and displayed.
216    ///
217    /// If multiple buffers reach desiredPresentTimestamp, the earlier buffer will be dropped.
218    ///
219    /// This Operation should be called before calling <b>OH_NativeWindow_NativeWindowFlushBuffer</b>.
220    ///
221    /// If desiredPresentTimestamp is greater than 1 second of the consumer-provided timestamp,
222    /// the desiredPresentTimestamp will be ignored.
223    ///
224    /// Variable parameter in function is
225    /// [in] int64_t desiredPresentTimestamp.
226    ///
227    /// Available since API-level: 13
228    #[cfg(feature = "api-13")]
229    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
230    pub const SET_DESIRED_PRESENT_TIMESTAMP: Type = 24;
231}
232impl OHScalingMode {
233    /// the window content is not updated until a buffer of
234    /// the window size is received
235    pub const OH_SCALING_MODE_FREEZE: OHScalingMode = OHScalingMode(0);
236    /// the buffer is scaled in two dimensions to match the window size
237    pub const OH_SCALING_MODE_SCALE_TO_WINDOW: OHScalingMode = OHScalingMode(1);
238    /// the buffer is uniformly scaled so that the smaller size of
239    /// the buffer matches the window size
240    pub const OH_SCALING_MODE_SCALE_CROP: OHScalingMode = OHScalingMode(2);
241    /// the window is clipped to the size of the buffer's clipping rectangle
242    /// pixels outside the clipping rectangle are considered fully transparent.
243    pub const OH_SCALING_MODE_NO_SCALE_CROP: OHScalingMode = OHScalingMode(3);
244}
245#[repr(transparent)]
246/// Indicates Scaling Mode.
247///
248/// Available since API-level: 9
249///
250/// **Deprecated** since 10
251///
252/// **Use instead:** OHScalingModeV2
253#[deprecated(since = "10", note = "Use instead: OHScalingModeV2")]
254#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
255pub struct OHScalingMode(pub ::core::ffi::c_uint);
256#[cfg(feature = "api-12")]
257#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
258impl OHScalingModeV2 {
259    /// the window content is not updated until a buffer of
260    /// the window size is received
261    pub const OH_SCALING_MODE_FREEZE_V2: OHScalingModeV2 = OHScalingModeV2(0);
262    /// the buffer is scaled in two dimensions to match the window size
263    pub const OH_SCALING_MODE_SCALE_TO_WINDOW_V2: OHScalingModeV2 = OHScalingModeV2(1);
264    /// the buffer is uniformly scaled so that the smaller size of
265    /// the buffer matches the window size
266    pub const OH_SCALING_MODE_SCALE_CROP_V2: OHScalingModeV2 = OHScalingModeV2(2);
267    /// the window is clipped to the size of the buffer's clipping rectangle
268    /// pixels outside the clipping rectangle are considered fully transparent.
269    pub const OH_SCALING_MODE_NO_SCALE_CROP_V2: OHScalingModeV2 = OHScalingModeV2(3);
270    /// Adapt to the buffer and scale proportionally to the buffer size. Prioritize displaying all buffer content.
271    /// If the size is not the same as the window size, fill the unfilled area of the window with a background color.
272    pub const OH_SCALING_MODE_SCALE_FIT_V2: OHScalingModeV2 = OHScalingModeV2(4);
273}
274#[repr(transparent)]
275/// Indicates Scaling Mode.
276///
277/// Available since API-level: 12
278#[cfg(feature = "api-12")]
279#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
280#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
281pub struct OHScalingModeV2(pub ::core::ffi::c_uint);
282impl OHHDRMetadataKey {
283    pub const OH_METAKEY_RED_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(0);
284    pub const OH_METAKEY_RED_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(1);
285    pub const OH_METAKEY_GREEN_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(2);
286    pub const OH_METAKEY_GREEN_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(3);
287    pub const OH_METAKEY_BLUE_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(4);
288    pub const OH_METAKEY_BLUE_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(5);
289    pub const OH_METAKEY_WHITE_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(6);
290    pub const OH_METAKEY_WHITE_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(7);
291    pub const OH_METAKEY_MAX_LUMINANCE: OHHDRMetadataKey = OHHDRMetadataKey(8);
292    pub const OH_METAKEY_MIN_LUMINANCE: OHHDRMetadataKey = OHHDRMetadataKey(9);
293    pub const OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL: OHHDRMetadataKey = OHHDRMetadataKey(10);
294    pub const OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL: OHHDRMetadataKey = OHHDRMetadataKey(11);
295    pub const OH_METAKEY_HDR10_PLUS: OHHDRMetadataKey = OHHDRMetadataKey(12);
296    pub const OH_METAKEY_HDR_VIVID: OHHDRMetadataKey = OHHDRMetadataKey(13);
297}
298#[repr(transparent)]
299/// Enumerates the HDR metadata keys.
300///
301/// Available since API-level: 9
302///
303/// **Deprecated** since 10
304#[deprecated(since = "10")]
305#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
306pub struct OHHDRMetadataKey(pub ::core::ffi::c_uint);
307/// Defines the HDR metadata.
308///
309/// Available since API-level: 9
310///
311/// **Deprecated** since 10
312#[deprecated(since = "10")]
313#[repr(C)]
314#[derive(Debug, Copy, Clone)]
315pub struct OHHDRMetaData {
316    pub key: OHHDRMetadataKey,
317    pub value: f32,
318}
319/// Defines the ExtData Handle
320///
321/// Available since API-level: 9
322///
323/// **Deprecated** since 10
324#[deprecated(since = "10")]
325#[repr(C)]
326#[derive(Debug)]
327pub struct OHExtDataHandle {
328    pub fd: i32,
329    pub reserveInts: u32,
330    pub reserve: __IncompleteArrayField<i32>,
331}
332#[cfg(feature = "api-12")]
333#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
334impl OHSurfaceSource {
335    pub const OH_SURFACE_SOURCE_DEFAULT: OHSurfaceSource = OHSurfaceSource(0);
336    pub const OH_SURFACE_SOURCE_UI: OHSurfaceSource = OHSurfaceSource(1);
337    pub const OH_SURFACE_SOURCE_GAME: OHSurfaceSource = OHSurfaceSource(2);
338    pub const OH_SURFACE_SOURCE_CAMERA: OHSurfaceSource = OHSurfaceSource(3);
339    pub const OH_SURFACE_SOURCE_VIDEO: OHSurfaceSource = OHSurfaceSource(4);
340}
341#[repr(transparent)]
342/// Indicates the source type of surface.
343///
344/// Available since API-level: 12
345#[cfg(feature = "api-12")]
346#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
347#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
348pub struct OHSurfaceSource(pub ::core::ffi::c_uint);
349extern "C" {
350    /// Creates a <b>OHNativeWindow</b> instance. A new <b>OHNativeWindow</b> instance is created each time this function is called.
351    ///
352    ///
353    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
354    /// # Arguments
355    ///
356    /// * `pSurface` - Indicates the pointer to a <b>ProduceSurface</b>. The type is a pointer to <b>sptr<OHOS::Surface></b>.
357    ///
358    /// # Returns
359    ///
360    /// * Returns the pointer to the <b>OHNativeWindow</b> instance created.
361    ///
362    /// Available since API-level: 8
363    ///
364    /// Version: 1.0
365    ///
366    /// **Deprecated** since 12
367    #[deprecated(since = "12")]
368    pub fn OH_NativeWindow_CreateNativeWindow(
369        pSurface: *mut ::core::ffi::c_void,
370    ) -> *mut OHNativeWindow;
371    /// Decreases the reference count of a <b>OHNativeWindow</b> instance by 1,
372    /// and when the reference count reaches 0, destroys the instance.
373    ///
374    /// This interface is a non-thread-safe type interface.
375    ///
376    ///
377    ///
378    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
379    /// # Arguments
380    ///
381    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
382    ///
383    /// Available since API-level: 8
384    ///
385    /// Version: 1.0
386    pub fn OH_NativeWindow_DestroyNativeWindow(window: *mut OHNativeWindow);
387    /// Creates a <b>OHNativeWindowBuffer</b> instance. A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.
388    ///
389    ///
390    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
391    /// # Arguments
392    ///
393    /// * `pSurfaceBuffer` - Indicates the pointer to a produce buffer. The type is <b>sptr<OHOS::SurfaceBuffer></b>.
394    ///
395    /// # Returns
396    ///
397    /// * Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
398    ///
399    /// Available since API-level: 8
400    ///
401    /// Version: 1.0
402    ///
403    /// **Deprecated** since 12
404    ///
405    /// **Use instead:** OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer
406    #[deprecated(
407        since = "12",
408        note = "Use instead: OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer"
409    )]
410    pub fn OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(
411        pSurfaceBuffer: *mut ::core::ffi::c_void,
412    ) -> *mut OHNativeWindowBuffer;
413    /// Creates a <b>OHNativeWindowBuffer</b> instance.
414    ///
415    /// A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.
416    ///
417    /// This interface needs to be used in conjunction with <b>OH_NativeWindow_DestroyNativeWindowBuffer</b>,
418    /// otherwise memory leaks will occur.
419    ///
420    /// This interface is a non-thread-safe type interface.
421    ///
422    ///
423    ///
424    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
425    /// # Arguments
426    ///
427    /// * `nativeBuffer` - Indicates the pointer to a native buffer. The type is <b>OH_NativeBuffer*</b>.
428    ///
429    /// # Returns
430    ///
431    /// * Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
432    ///
433    /// Available since API-level: 11
434    ///
435    /// Version: 1.0
436    #[cfg(feature = "api-11")]
437    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
438    pub fn OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(
439        nativeBuffer: *mut OH_NativeBuffer,
440    ) -> *mut OHNativeWindowBuffer;
441    /// Decreases the reference count of a <b>OHNativeWindowBuffer</b> instance by 1 and,
442    /// when the reference count reaches 0, destroys the instance.
443    ///
444    /// This interface is a non-thread-safe type interface.
445    ///
446    ///
447    ///
448    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
449    /// # Arguments
450    ///
451    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
452    ///
453    /// Available since API-level: 8
454    ///
455    /// Version: 1.0
456    pub fn OH_NativeWindow_DestroyNativeWindowBuffer(buffer: *mut OHNativeWindowBuffer);
457    /// Requests a <b>OHNativeWindowBuffer</b> through a <b>OHNativeWindow</b> instance for content production.
458    ///
459    /// Before calling this interface, you need to set the width and height of
460    /// <b>OHNativeWindow</b> through <b>SET_BUFFER_GEOMETRY</b>.
461    ///
462    /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeWindowFlushBuffer</b>,
463    /// otherwise buffer will be exhausted.
464    ///
465    /// When the fenceFd is used up, you need to close it.
466    ///
467    /// This interface is a non-thread-safe type interface.
468    ///
469    ///
470    ///
471    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
472    /// # Arguments
473    ///
474    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
475    ///
476    /// * `buffer` - Indicates the double pointer to a <b>OHNativeWindowBuffer</b> instance.
477    ///
478    /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
479    ///
480    /// # Returns
481    ///
482    /// * Returns an error code, 0 is success, otherwise, failed.
483    ///
484    /// Available since API-level: 8
485    ///
486    /// Version: 1.0
487    pub fn OH_NativeWindow_NativeWindowRequestBuffer(
488        window: *mut OHNativeWindow,
489        buffer: *mut *mut OHNativeWindowBuffer,
490        fenceFd: *mut ::core::ffi::c_int,
491    ) -> i32;
492    /// Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue
493    /// through a <b>OHNativeWindow</b> instance for content consumption.
494    ///
495    /// The fenceFd will be close by system.
496    ///
497    /// This interface is a non-thread-safe type interface.
498    ///
499    ///
500    ///
501    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
502    /// # Arguments
503    ///
504    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
505    ///
506    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
507    ///
508    /// * `fenceFd` - Indicates a file descriptor handle, which is used for timing synchronization.
509    ///
510    /// * `region` - Indicates a dirty region where content is updated.
511    ///
512    /// # Returns
513    ///
514    /// * Returns an error code, 0 is success, otherwise, failed.
515    ///
516    /// Available since API-level: 8
517    ///
518    /// Version: 1.0
519    pub fn OH_NativeWindow_NativeWindowFlushBuffer(
520        window: *mut OHNativeWindow,
521        buffer: *mut OHNativeWindowBuffer,
522        fenceFd: ::core::ffi::c_int,
523        region: Region,
524    ) -> i32;
525    /// Get the last flushed <b>OHNativeWindowBuffer</b> from a <b>OHNativeWindow</b> instance.
526    ///
527    ///
528    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
529    /// # Arguments
530    ///
531    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
532    ///
533    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> pointer.
534    ///
535    /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
536    ///
537    /// * `matrix` - Indicates the retrieved 4*4 transform matrix.
538    ///
539    /// # Returns
540    ///
541    /// * Returns an error code, 0 is success, otherwise, failed.
542    ///
543    /// Available since API-level: 11
544    ///
545    /// Version: 1.0
546    ///
547    /// **Deprecated** since 12
548    ///
549    /// **Use instead:** OH_NativeWindow_GetLastFlushedBufferV2
550    #[cfg(feature = "api-11")]
551    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
552    #[deprecated(
553        since = "12",
554        note = "Use instead: OH_NativeWindow_GetLastFlushedBufferV2"
555    )]
556    pub fn OH_NativeWindow_GetLastFlushedBuffer(
557        window: *mut OHNativeWindow,
558        buffer: *mut *mut OHNativeWindowBuffer,
559        fenceFd: *mut ::core::ffi::c_int,
560        matrix: *mut f32,
561    ) -> i32;
562    /// Returns the <b>OHNativeWindowBuffer</b> to the buffer queue through a <b>OHNativeWindow</b> instance,
563    /// without filling in any content. The <b>OHNativeWindowBuffer</b> can be used for another request.
564    ///
565    /// This interface is a non-thread-safe type interface.
566    ///
567    ///
568    ///
569    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
570    /// # Arguments
571    ///
572    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
573    ///
574    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
575    ///
576    /// # Returns
577    ///
578    /// * Returns an error code, 0 is success, otherwise, failed.
579    ///
580    /// Available since API-level: 8
581    ///
582    /// Version: 1.0
583    pub fn OH_NativeWindow_NativeWindowAbortBuffer(
584        window: *mut OHNativeWindow,
585        buffer: *mut OHNativeWindowBuffer,
586    ) -> i32;
587    /// Sets or obtains the attributes of a native window, including the width, height, and content format.
588    ///
589    /// This interface is a non-thread-safe type interface.
590    ///
591    ///
592    /// <p><strong>API Note</strong>
593    ///
594    /// <strong>Performance Note</strong>
595    /// <p>By default, the window buffer in the current operating system is accessed via the CPU. If an application
596    /// does not need to access the window buffer data using the CPU, it can proactively disable CPU access to
597    /// enhance energy efficiency and reduce power consumption.
598    /// </p>
599    /// <p>For details about how to optimize power consumption for data read/write operations in data buffers,
600    /// see [How do I proactively disable CPU access to window buffers to reduce power consumption?][`https://developer.huawei.com/consumer/en/doc/harmonyos-faqs/faqs-arkgraphics-2d-14`].</p>
601    /// </p>
602    ///
603    ///
604    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
605    /// # Arguments
606    ///
607    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
608    ///
609    /// * `code` - Indicates the operation code, pointer to <b>NativeWindowOperation</b>.
610    ///
611    /// * `...` - variable parameter, must correspond to code one-to-one.
612    ///
613    /// # Returns
614    ///
615    /// * Returns an error code, 0 is success, otherwise, failed.
616    ///
617    /// Available since API-level: 8
618    ///
619    /// Version: 1.0
620    pub fn OH_NativeWindow_NativeWindowHandleOpt(
621        window: *mut OHNativeWindow,
622        code: ::core::ffi::c_int,
623        ...
624    ) -> i32;
625    /// Obtains the pointer to a <b>BufferHandle</b> of a <b>OHNativeWindowBuffer</b> instance.
626    ///
627    /// This interface is a non-thread-safe type interface.
628    ///
629    ///
630    ///
631    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
632    /// # Arguments
633    ///
634    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
635    ///
636    /// # Returns
637    ///
638    /// * Returns the pointer to the <b>BufferHandle</b> instance obtained.
639    ///
640    /// Available since API-level: 8
641    ///
642    /// Version: 1.0
643    pub fn OH_NativeWindow_GetBufferHandleFromNative(
644        buffer: *mut OHNativeWindowBuffer,
645    ) -> *mut BufferHandle;
646    /// Adds the reference count of a native object.
647    ///
648    /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeObjectUnreference</b>,
649    /// otherwise memory leaks will occur.
650    ///
651    /// This interface is a non-thread-safe type interface.
652    ///
653    ///
654    ///
655    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
656    /// # Arguments
657    ///
658    /// * `obj` - Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
659    ///
660    /// # Returns
661    ///
662    /// * Returns an error code, 0 is success, otherwise, failed.
663    ///
664    /// Available since API-level: 8
665    ///
666    /// Version: 1.0
667    pub fn OH_NativeWindow_NativeObjectReference(obj: *mut ::core::ffi::c_void) -> i32;
668    /// Decreases the reference count of a native object and,
669    /// when the reference count reaches 0, destroys this object.
670    ///
671    /// This interface is a non-thread-safe type interface.
672    ///
673    ///
674    ///
675    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
676    /// # Arguments
677    ///
678    /// * `obj` - Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
679    ///
680    /// # Returns
681    ///
682    /// * Returns an error code, 0 is success, otherwise, failed.
683    ///
684    /// Available since API-level: 8
685    ///
686    /// Version: 1.0
687    pub fn OH_NativeWindow_NativeObjectUnreference(obj: *mut ::core::ffi::c_void) -> i32;
688    /// Obtains the magic ID of a native object.
689    ///
690    /// This interface is a non-thread-safe type interface.
691    ///
692    ///
693    ///
694    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
695    /// # Arguments
696    ///
697    /// * `obj` - Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
698    ///
699    /// # Returns
700    ///
701    /// * Returns the magic ID, which is unique for each native object.
702    ///
703    /// Available since API-level: 8
704    ///
705    /// Version: 1.0
706    pub fn OH_NativeWindow_GetNativeObjectMagic(obj: *mut ::core::ffi::c_void) -> i32;
707    /// Sets scalingMode of a native window.
708    ///
709    ///
710    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
711    /// # Arguments
712    ///
713    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
714    ///
715    /// * `sequence` - Indicates the sequence to a produce buffer.
716    ///
717    /// * `scalingMode` - Indicates the enum value to <b>OHScalingMode</b>
718    ///
719    /// # Returns
720    ///
721    /// * Returns an error code, 0 is success, otherwise, failed.
722    ///
723    /// Available since API-level: 9
724    ///
725    /// Version: 1.0
726    ///
727    /// **Deprecated** since 10
728    ///
729    /// **Use instead:** OH_NativeWindow_NativeWindowSetScalingModeV2
730    #[deprecated(
731        since = "10",
732        note = "Use instead: OH_NativeWindow_NativeWindowSetScalingModeV2"
733    )]
734    pub fn OH_NativeWindow_NativeWindowSetScalingMode(
735        window: *mut OHNativeWindow,
736        sequence: u32,
737        scalingMode: OHScalingMode,
738    ) -> i32;
739    /// Sets metaData of a native window.
740    ///
741    ///
742    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
743    /// # Arguments
744    ///
745    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
746    ///
747    /// * `sequence` - Indicates the sequence to a produce buffer.
748    ///
749    /// * `size` - Indicates the size of a <b>OHHDRMetaData</b> vector.
750    ///
751    /// * `metaDate` - Indicates the pointer to a <b>OHHDRMetaData</b> vector.
752    ///
753    /// # Returns
754    ///
755    /// * Returns an error code, 0 is success, otherwise, failed.
756    ///
757    /// Available since API-level: 9
758    ///
759    /// Version: 1.0
760    ///
761    /// **Deprecated** since 10
762    #[deprecated(since = "10")]
763    pub fn OH_NativeWindow_NativeWindowSetMetaData(
764        window: *mut OHNativeWindow,
765        sequence: u32,
766        size: i32,
767        metaData: *const OHHDRMetaData,
768    ) -> i32;
769    /// Sets metaDataSet of a native window.
770    ///
771    ///
772    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
773    /// # Arguments
774    ///
775    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
776    ///
777    /// * `sequence` - Indicates the sequence to a produce buffer.
778    ///
779    /// * `key` - Indicates the enum value to <b>OHHDRMetadataKey</b>
780    ///
781    /// * `size` - Indicates the size of a uint8_t vector.
782    ///
783    /// * `metaDate` - Indicates the pointer to a uint8_t vector.
784    ///
785    /// # Returns
786    ///
787    /// * Returns an error code, 0 is success, otherwise, failed.
788    ///
789    /// Available since API-level: 9
790    ///
791    /// Version: 1.0
792    ///
793    /// **Deprecated** since 10
794    #[deprecated(since = "10")]
795    pub fn OH_NativeWindow_NativeWindowSetMetaDataSet(
796        window: *mut OHNativeWindow,
797        sequence: u32,
798        key: OHHDRMetadataKey,
799        size: i32,
800        metaData: *const u8,
801    ) -> i32;
802    /// Sets tunnel handle of a native window.
803    ///
804    ///
805    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
806    /// # Arguments
807    ///
808    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
809    ///
810    /// * `handle` - Indicates the pointer to a <b>OHExtDataHandle</b>.
811    ///
812    /// # Returns
813    ///
814    /// * Returns an error code, 0 is success, otherwise, failed.
815    ///
816    /// Available since API-level: 9
817    ///
818    /// Version: 1.0
819    ///
820    /// **Deprecated** since 10
821    #[deprecated(since = "10")]
822    pub fn OH_NativeWindow_NativeWindowSetTunnelHandle(
823        window: *mut OHNativeWindow,
824        handle: *const OHExtDataHandle,
825    ) -> i32;
826    /// Attach a buffer to an <b>OHNativeWindow</b> instance.
827    ///
828    /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeWindowDetachBuffer</b>,
829    /// otherwise buffer management will be chaotic.
830    ///
831    /// This interface is a non-thread-safe type interface.
832    ///
833    ///
834    ///
835    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
836    /// # Arguments
837    ///
838    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
839    ///
840    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
841    ///
842    /// # Returns
843    ///
844    /// * Returns an error code, 0 is success, otherwise, failed.
845    ///
846    /// Available since API-level: 12
847    ///
848    /// Version: 1.0
849    #[cfg(feature = "api-12")]
850    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
851    pub fn OH_NativeWindow_NativeWindowAttachBuffer(
852        window: *mut OHNativeWindow,
853        buffer: *mut OHNativeWindowBuffer,
854    ) -> i32;
855    /// Detach a buffer from an <b>OHNativeWindow</b> instance.
856    ///
857    /// This interface is a non-thread-safe type interface.
858    ///
859    ///
860    ///
861    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
862    /// # Arguments
863    ///
864    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
865    ///
866    /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
867    ///
868    /// # Returns
869    ///
870    /// * Returns an error code, 0 is success, otherwise, failed.
871    ///
872    /// Available since API-level: 12
873    ///
874    /// Version: 1.0
875    #[cfg(feature = "api-12")]
876    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
877    pub fn OH_NativeWindow_NativeWindowDetachBuffer(
878        window: *mut OHNativeWindow,
879        buffer: *mut OHNativeWindowBuffer,
880    ) -> i32;
881    /// Get surfaceId from native window.
882    ///
883    /// This interface is a non-thread-safe type interface.
884    ///
885    ///
886    ///
887    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
888    /// # Arguments
889    ///
890    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
891    ///
892    /// * `surfaceId` - Indicates the pointer to a surfaceId.
893    ///
894    /// # Returns
895    ///
896    /// * Returns an error code, 0 is success, otherwise, failed.
897    ///
898    /// Available since API-level: 12
899    ///
900    /// Version: 1.0
901    #[cfg(feature = "api-12")]
902    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
903    pub fn OH_NativeWindow_GetSurfaceId(window: *mut OHNativeWindow, surfaceId: *mut u64) -> i32;
904    /// Creates an <b>OHNativeWindow</b> instance.
905    ///
906    /// This interface needs to be used in conjunction with <b>OH_NativeWindow_DestroyNativeWindow</b>,
907    /// otherwise memory leaks will occur.
908    ///
909    /// If there is a concurrent destroy OHNativeWindow, you need to add once and decrement once to the
910    /// OHNativeWindow reference count through <b>OH_NativeWindow_NativeObjectReference</b> and
911    /// <b>OH_NativeWindow_NativeObjectUnreference</b>.
912    ///
913    /// If the surface obtained through surfaceId is created in this process, the surface cannot be obtained
914    /// across processes.
915    ///
916    /// This interface is a non-thread-safe type interface.
917    ///
918    ///
919    ///
920    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
921    /// # Arguments
922    ///
923    /// * `surfaceId` - Indicates the surfaceId to a surface.
924    ///
925    /// * `window` - indicates the pointer to an <b>OHNativeWindow</b> instance.
926    ///
927    /// # Returns
928    ///
929    /// * Returns an error code, 0 is Success, otherwise, failed.
930    ///
931    /// Available since API-level: 12
932    ///
933    /// Version: 1.0
934    #[cfg(feature = "api-12")]
935    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
936    pub fn OH_NativeWindow_CreateNativeWindowFromSurfaceId(
937        surfaceId: u64,
938        window: *mut *mut OHNativeWindow,
939    ) -> i32;
940    /// Sets scalingMode of a native window.
941    ///
942    /// This interface is a non-thread-safe type interface.
943    ///
944    ///
945    ///
946    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
947    /// # Arguments
948    ///
949    /// * `window` - indicates the pointer to an <b>OHNativeWindow</b> instance.
950    ///
951    /// * `scalingMode` - Indicates the enum value to <b>OHScalingModeV2</b>
952    ///
953    /// # Returns
954    ///
955    /// * Returns an error code, 0 is Success, otherwise, failed.
956    ///
957    /// Available since API-level: 12
958    ///
959    /// Version: 1.0
960    #[cfg(feature = "api-12")]
961    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
962    pub fn OH_NativeWindow_NativeWindowSetScalingModeV2(
963        window: *mut OHNativeWindow,
964        scalingMode: OHScalingModeV2,
965    ) -> i32;
966    /// Set native window buffer hold.
967    ///
968    /// This interface is a non-thread-safe type interface.
969    ///
970    ///
971    ///
972    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
973    /// # Arguments
974    ///
975    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
976    ///
977    /// Available since API-level: 12
978    ///
979    /// Version: 1.0
980    #[cfg(feature = "api-12")]
981    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
982    pub fn OH_NativeWindow_SetBufferHold(window: *mut OHNativeWindow);
983    /// Write an OHNativeWindow to an OHIPCParcel.
984    ///
985    /// This interface is a non-thread-safe type interface.
986    ///
987    ///
988    ///
989    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
990    /// # Arguments
991    ///
992    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
993    ///
994    /// * `parcel` - Indicates the pointer to an <b>OHIPCParcel</b> instance.
995    ///
996    /// # Returns
997    ///
998    /// * [`NATIVE_ERROR_OK`] 0 - Success.
999    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - parcel is NULL or window is NULL.
1000    ///
1001    /// Available since API-level: 12
1002    ///
1003    /// Version: 1.0
1004    #[cfg(feature = "api-12")]
1005    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1006    pub fn OH_NativeWindow_WriteToParcel(
1007        window: *mut OHNativeWindow,
1008        parcel: *mut OHIPCParcel,
1009    ) -> i32;
1010    /// Read an OHNativeWindow from an OHIPCParcel.
1011    ///
1012    /// This interface is a non-thread-safe type interface.
1013    ///
1014    ///
1015    ///
1016    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1017    /// # Arguments
1018    ///
1019    /// * `parcel` - Indicates the pointer to an <b>OHIPCParcel</b> instance.
1020    ///
1021    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
1022    ///
1023    /// # Returns
1024    ///
1025    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1026    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - parcel is NULL or parcel does not contain the window.
1027    ///
1028    /// Available since API-level: 12
1029    ///
1030    /// Version: 1.0
1031    #[cfg(feature = "api-12")]
1032    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1033    pub fn OH_NativeWindow_ReadFromParcel(
1034        parcel: *mut OHIPCParcel,
1035        window: *mut *mut OHNativeWindow,
1036    ) -> i32;
1037    /// Get the last flushed <b>OHNativeWindowBuffer</b> from an <b>OHNativeWindow</b> instance.
1038    ///
1039    /// When the fenceFd is used up, you need to close it.
1040    ///
1041    /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeObjectUnreference</b>,
1042    /// otherwise memory leaks will occur.
1043    ///
1044    /// This interface is a non-thread-safe type interface.
1045    ///
1046    ///
1047    ///
1048    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1049    /// # Arguments
1050    ///
1051    /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
1052    ///
1053    /// * `buffer` - Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.
1054    ///
1055    /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
1056    ///
1057    /// * `matrix` - Indicates the retrieved 4*4 transform matrix.
1058    ///
1059    /// # Returns
1060    ///
1061    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1062    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL or buffer is NULL or fenceFd is NULL.
1063    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - buffer state is wrong.
1064    ///
1065    /// Available since API-level: 12
1066    ///
1067    /// Version: 1.0
1068    #[cfg(feature = "api-12")]
1069    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1070    pub fn OH_NativeWindow_GetLastFlushedBufferV2(
1071        window: *mut OHNativeWindow,
1072        buffer: *mut *mut OHNativeWindowBuffer,
1073        fenceFd: *mut ::core::ffi::c_int,
1074        matrix: *mut f32,
1075    ) -> i32;
1076    /// Set the color space of the native window.
1077    ///
1078    /// This interface is a non-thread-safe type interface.
1079    ///
1080    ///
1081    ///
1082    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1083    /// # Arguments
1084    ///
1085    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1086    ///
1087    /// * `colorSpace` - Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.
1088    ///
1089    /// # Returns
1090    ///
1091    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1092    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL.
1093    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect colorSpace state.
1094    ///
1095    /// Available since API-level: 12
1096    ///
1097    /// Version: 1.0
1098    #[cfg(feature = "api-12")]
1099    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1100    pub fn OH_NativeWindow_SetColorSpace(
1101        window: *mut OHNativeWindow,
1102        colorSpace: OH_NativeBuffer_ColorSpace,
1103    ) -> i32;
1104    /// Get the color space of the native window.
1105    ///
1106    /// This interface is a non-thread-safe type interface.
1107    ///
1108    ///
1109    ///
1110    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1111    /// # Arguments
1112    ///
1113    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1114    ///
1115    /// * `colorSpace` - Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.
1116    ///
1117    /// # Returns
1118    ///
1119    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1120    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL.
1121    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect colorSpace state.
1122    ///
1123    /// Available since API-level: 12
1124    ///
1125    /// Version: 1.0
1126    #[cfg(feature = "api-12")]
1127    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1128    pub fn OH_NativeWindow_GetColorSpace(
1129        window: *mut OHNativeWindow,
1130        colorSpace: *mut OH_NativeBuffer_ColorSpace,
1131    ) -> i32;
1132    /// Set the metadata type of the native window.
1133    ///
1134    /// This interface is a non-thread-safe type interface.
1135    ///
1136    ///
1137    ///
1138    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1139    /// # Arguments
1140    ///
1141    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1142    ///
1143    /// * `metadataKey` - Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.
1144    ///
1145    /// * `size` - Indicates the size of a uint8_t vector.
1146    ///
1147    /// * `metadata` - Indicates the pointer to a uint8_t vector.
1148    ///
1149    /// # Returns
1150    ///
1151    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1152    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window or metadata is NULL.
1153    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect metadata state.
1154    /// [`NATIVE_ERROR_UNSUPPORTED`] 50102000 - Unsupported metadata key.
1155    ///
1156    /// Available since API-level: 12
1157    ///
1158    /// Version: 1.0
1159    #[cfg(feature = "api-12")]
1160    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1161    pub fn OH_NativeWindow_SetMetadataValue(
1162        window: *mut OHNativeWindow,
1163        metadataKey: OH_NativeBuffer_MetadataKey,
1164        size: i32,
1165        metadata: *mut u8,
1166    ) -> i32;
1167    /// Set the metadata type of the native window.
1168    ///
1169    /// This interface is a non-thread-safe type interface.
1170    ///
1171    ///
1172    ///
1173    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1174    /// # Arguments
1175    ///
1176    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1177    ///
1178    /// * `metadataKey` - Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.
1179    ///
1180    /// * `size` - Indicates the size of a uint8_t vector.
1181    ///
1182    /// * `metadata` - Indicates the pointer to a uint8_t vector.
1183    ///
1184    /// # Returns
1185    ///
1186    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1187    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window, metadata, or size is NULL.
1188    /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect metadata state.
1189    /// [`NATIVE_ERROR_UNSUPPORTED`] 50102000 - Unsupported metadata key.
1190    ///
1191    /// Available since API-level: 12
1192    ///
1193    /// Version: 1.0
1194    #[cfg(feature = "api-12")]
1195    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1196    pub fn OH_NativeWindow_GetMetadataValue(
1197        window: *mut OHNativeWindow,
1198        metadataKey: OH_NativeBuffer_MetadataKey,
1199        size: *mut i32,
1200        metadata: *mut *mut u8,
1201    ) -> i32;
1202    /// Clean all <b>OHNativeWindowBuffer</b> caches of this <b>OHNativeWindow</b>
1203    /// This interface is a non-thread-safe type interface.
1204    ///
1205    ///
1206    ///
1207    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1208    /// # Arguments
1209    ///
1210    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1211    ///
1212    /// # Returns
1213    ///
1214    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1215    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL.
1216    /// [`NATIVE_ERROR_CONSUMER_DISCONNECTED`] 41211000 - the consumer is disconnected.
1217    /// [`NATIVE_ERROR_BINDER_ERROR`] 50401000 - ipc send failed.
1218    ///
1219    /// Available since API-level: 19
1220    ///
1221    /// Version: 1.0
1222    #[cfg(feature = "api-19")]
1223    #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1224    pub fn OH_NativeWindow_CleanCache(window: *mut OHNativeWindow) -> i32;
1225    /// PreAlloc <b>OHNativeWindowBuffer</b> of this <b>OHNativeWindow</b>
1226    /// This interface is a non-thread-safe type interface.
1227    ///
1228    ///
1229    ///
1230    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1231    /// # Arguments
1232    ///
1233    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1234    ///
1235    /// * `allocBufferCnt` - Indicates the count of <b>OHNativeWindowBuffers</b>.
1236    ///
1237    /// # Returns
1238    ///
1239    /// * Returns an error code, 0 is success, otherwise, failed.
1240    ///
1241    /// Available since API-level: 22
1242    ///
1243    /// Version: 1.0
1244    #[cfg(feature = "api-22")]
1245    #[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
1246    pub fn OH_NativeWindow_PreAllocBuffers(window: *mut OHNativeWindow, allocBufferCnt: u32)
1247        -> i32;
1248    /// Requests an <b>OHNativeWindowBuffer</b> through an <b>OHNativeWindow</b> instance for content production,
1249    ///
1250    /// and lock the <b>OHNativeWindowBuffer</b>, the interface needs to be paired with
1251    ///
1252    /// <b>OH_NativeWindow_UnlockAndFlushBuffer</b> for use, after lock, it must be unlocked in order to relock,
1253    ///
1254    /// repeatedly lock or unlock will return an illegal operation error code, the interface supports rendering images
1255    ///
1256    /// directly through memory read and write on the CPU.
1257    /// This interface is a non-thread-safe type interface.
1258    ///
1259    ///
1260    ///
1261    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1262    /// # Arguments
1263    ///
1264    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1265    ///
1266    /// * `region` - Indicates the info of the dirty region.
1267    ///
1268    /// * `buffer` - Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.
1269    ///
1270    /// # Returns
1271    ///
1272    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1273    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window or buffer is NULL.
1274    /// [`NATIVE_ERROR_UNKNOWN`] 50002000 - surface of window is NULL.
1275    ///
1276    /// Available since API-level: 23
1277    ///
1278    /// Version: 1.0
1279    #[cfg(feature = "api-23")]
1280    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
1281    pub fn OH_NativeWindow_LockBuffer(
1282        window: *mut OHNativeWindow,
1283        region: Region,
1284        buffer: *mut *mut OHNativeWindowBuffer,
1285    ) -> i32;
1286    /// Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue through an
1287    ///
1288    /// <b>OHNativeWindow</b> instance for content consumption, and unlock the <b>OHNativeWindowBuffer</b>.
1289    /// This interface is a non-thread-safe type interface.
1290    ///
1291    ///
1292    ///
1293    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1294    /// # Arguments
1295    ///
1296    /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1297    ///
1298    /// # Returns
1299    ///
1300    /// * [`NATIVE_ERROR_OK`] 0 - Success.
1301    /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL.
1302    /// [`NATIVE_ERROR_UNKNOWN`] 50002000 - surface of window is NULL.
1303    ///
1304    /// Available since API-level: 23
1305    ///
1306    /// Version: 1.0
1307    #[cfg(feature = "api-23")]
1308    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
1309    pub fn OH_NativeWindow_UnlockAndFlushBuffer(window: *mut OHNativeWindow) -> i32;
1310}