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 /// Use [`OH_NativeWindow_GetBufferHandleFromNative`] to get a [`BufferHandleand`] from a buffer
108 /// and then retrieve the stride from the [`BufferHandle`].
109 #[deprecated(since = "16")]
110 pub const GET_STRIDE: Type = 7;
111 /// set native window buffer swap interval,
112 /// variable parameter in function is
113 /// [in] int32_t interval.
114 pub const SET_SWAP_INTERVAL: Type = 8;
115 /// get native window buffer swap interval,
116 /// variable parameter in function is
117 /// [out] int32_t *interval.
118 pub const GET_SWAP_INTERVAL: Type = 9;
119 /// set the timeout in milliseconds when the native window requests a buffer,
120 /// the default value is 3000 milliseconds when not set,
121 /// variable parameter in function is
122 /// [in] int32_t timeout, in milliseconds.
123 pub const SET_TIMEOUT: Type = 10;
124 /// get the timeout in milliseconds when the native window requests a buffer,
125 /// the default value is 3000 milliseconds when not set,
126 /// variable parameter in function is
127 /// [out] int32_t *timeout, in milliseconds.
128 pub const GET_TIMEOUT: Type = 11;
129 /// set native window buffer colorGamut,
130 /// variable parameter in function is
131 /// [in] int32_t colorGamut, the enumeration value refers to [`OH_NativeBuffer_ColorGamut`].
132 pub const SET_COLOR_GAMUT: Type = 12;
133 /// get native window buffer colorGamut,
134 /// variable parameter in function is
135 /// [out] int32_t *colorGamut, the enumeration value refers to [`OH_NativeBuffer_ColorGamut`].
136 pub const GET_COLOR_GAMUT: Type = 13;
137 /// set native window buffer transform,
138 /// variable parameter in function is
139 /// [in] int32_t transform, the enumeration value refers to [`OH_NativeBuffer_TransformType`].
140 pub const SET_TRANSFORM: Type = 14;
141 /// get native window buffer transform,
142 /// variable parameter in function is
143 /// [out] int32_t *transform, the enumeration value refers to [`OH_NativeBuffer_TransformType`].
144 pub const GET_TRANSFORM: Type = 15;
145 /// set native window buffer uiTimestamp,
146 /// variable parameter in function is
147 /// [in] uint64_t uiTimestamp.
148 pub const SET_UI_TIMESTAMP: Type = 16;
149 /// get native window bufferqueue size,
150 /// variable parameter in function is
151 /// [out] int32_t *size.
152 ///
153 /// Available since API-level: 12
154 #[cfg(feature = "api-12")]
155 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
156 pub const GET_BUFFERQUEUE_SIZE: Type = 17;
157 /// set surface source type,
158 /// variable parameter in function is
159 /// [in] int32_t sourceType, the enumeration value refers to [`OHSurfaceSource`].
160 ///
161 /// Available since API-level: 12
162 #[cfg(feature = "api-12")]
163 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
164 pub const SET_SOURCE_TYPE: Type = 18;
165 /// get surface source type,
166 /// variable parameter in function is
167 /// [out] int32_t *sourceType, the enumeration value refers to [`OHSurfaceSource`].
168 ///
169 /// Available since API-level: 12
170 #[cfg(feature = "api-12")]
171 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
172 pub const GET_SOURCE_TYPE: Type = 19;
173 /// set app framework type,
174 /// variable parameter in function is
175 /// [in] char* frameworkType. maximum length is 64 bytes, otherwise the setting fails.
176 ///
177 /// Available since API-level: 12
178 #[cfg(feature = "api-12")]
179 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
180 pub const SET_APP_FRAMEWORK_TYPE: Type = 20;
181 /// get app framework type,
182 /// variable parameter in function is
183 /// [out] char** frameworkType.
184 ///
185 /// Available since API-level: 12
186 #[cfg(feature = "api-12")]
187 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
188 pub const GET_APP_FRAMEWORK_TYPE: Type = 21;
189 /// set hdr white point brightness,
190 /// variable parameter in function is
191 /// [in] float brightness. the value range is 0.0f to 1.0f.
192 ///
193 /// Available since API-level: 12
194 #[cfg(feature = "api-12")]
195 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
196 pub const SET_HDR_WHITE_POINT_BRIGHTNESS: Type = 22;
197 /// set sdr white point brightness,
198 /// variable parameter in function is
199 /// [in] float brightness. the value range is 0.0f to 1.0f.
200 ///
201 /// Available since API-level: 12
202 #[cfg(feature = "api-12")]
203 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
204 pub const SET_SDR_WHITE_POINT_BRIGHTNESS: Type = 23;
205 /// Set native window buffer desiredPresentTimestamp, indicates the desired time to present the buffer.
206 ///
207 /// Which should be generated by std::chrono::steady_clock in nanoseconds.
208 ///
209 /// It is only effective when RenderService is the consumer.
210 ///
211 /// The buffer will wait until desiredPresentTimestamp is reached before being consumed and displayed.
212 ///
213 /// If multiple buffers reach desiredPresentTimestamp, the earlier buffer will be dropped.
214 ///
215 /// This Operation should be called before calling <b>OH_NativeWindow_NativeWindowFlushBuffer</b>.
216 ///
217 /// If desiredPresentTimestamp is greater than 1 second of the consumer-provided timestamp,
218 /// the desiredPresentTimestamp will be ignored.
219 ///
220 /// Variable parameter in function is
221 /// [in] int64_t desiredPresentTimestamp.
222 ///
223 /// Available since API-level: 13
224 #[cfg(feature = "api-13")]
225 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
226 pub const SET_DESIRED_PRESENT_TIMESTAMP: Type = 24;
227}
228impl OHScalingMode {
229 /// the window content is not updated until a buffer of
230 /// the window size is received
231 pub const OH_SCALING_MODE_FREEZE: OHScalingMode = OHScalingMode(0);
232 /// the buffer is scaled in two dimensions to match the window size
233 pub const OH_SCALING_MODE_SCALE_TO_WINDOW: OHScalingMode = OHScalingMode(1);
234 /// the buffer is uniformly scaled so that the smaller size of
235 /// the buffer matches the window size
236 pub const OH_SCALING_MODE_SCALE_CROP: OHScalingMode = OHScalingMode(2);
237 /// the window is clipped to the size of the buffer's clipping rectangle
238 /// pixels outside the clipping rectangle are considered fully transparent.
239 pub const OH_SCALING_MODE_NO_SCALE_CROP: OHScalingMode = OHScalingMode(3);
240}
241#[repr(transparent)]
242/// Indicates Scaling Mode.
243///
244/// Available since API-level: 9
245/// = "10")
246/// OHScalingModeV2
247#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
248pub struct OHScalingMode(pub ::core::ffi::c_uint);
249#[cfg(feature = "api-12")]
250#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
251impl OHScalingModeV2 {
252 /// the window content is not updated until a buffer of
253 /// the window size is received
254 pub const OH_SCALING_MODE_FREEZE_V2: OHScalingModeV2 = OHScalingModeV2(0);
255 /// the buffer is scaled in two dimensions to match the window size
256 pub const OH_SCALING_MODE_SCALE_TO_WINDOW_V2: OHScalingModeV2 = OHScalingModeV2(1);
257 /// the buffer is uniformly scaled so that the smaller size of
258 /// the buffer matches the window size
259 pub const OH_SCALING_MODE_SCALE_CROP_V2: OHScalingModeV2 = OHScalingModeV2(2);
260 /// the window is clipped to the size of the buffer's clipping rectangle
261 /// pixels outside the clipping rectangle are considered fully transparent.
262 pub const OH_SCALING_MODE_NO_SCALE_CROP_V2: OHScalingModeV2 = OHScalingModeV2(3);
263 /// Adapt to the buffer and scale proportionally to the buffer size. Prioritize displaying all buffer content.
264 /// If the size is not the same as the window size, fill the unfilled area of the window with a background color.
265 pub const OH_SCALING_MODE_SCALE_FIT_V2: OHScalingModeV2 = OHScalingModeV2(4);
266}
267#[repr(transparent)]
268/// Indicates Scaling Mode.
269///
270/// Available since API-level: 12
271#[cfg(feature = "api-12")]
272#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
273#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
274pub struct OHScalingModeV2(pub ::core::ffi::c_uint);
275impl OHHDRMetadataKey {
276 pub const OH_METAKEY_RED_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(0);
277 pub const OH_METAKEY_RED_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(1);
278 pub const OH_METAKEY_GREEN_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(2);
279 pub const OH_METAKEY_GREEN_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(3);
280 pub const OH_METAKEY_BLUE_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(4);
281 pub const OH_METAKEY_BLUE_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(5);
282 pub const OH_METAKEY_WHITE_PRIMARY_X: OHHDRMetadataKey = OHHDRMetadataKey(6);
283 pub const OH_METAKEY_WHITE_PRIMARY_Y: OHHDRMetadataKey = OHHDRMetadataKey(7);
284 pub const OH_METAKEY_MAX_LUMINANCE: OHHDRMetadataKey = OHHDRMetadataKey(8);
285 pub const OH_METAKEY_MIN_LUMINANCE: OHHDRMetadataKey = OHHDRMetadataKey(9);
286 pub const OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL: OHHDRMetadataKey = OHHDRMetadataKey(10);
287 pub const OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL: OHHDRMetadataKey = OHHDRMetadataKey(11);
288 pub const OH_METAKEY_HDR10_PLUS: OHHDRMetadataKey = OHHDRMetadataKey(12);
289 pub const OH_METAKEY_HDR_VIVID: OHHDRMetadataKey = OHHDRMetadataKey(13);
290}
291#[repr(transparent)]
292/// Enumerates the HDR metadata keys.
293///
294/// Available since API-level: 9
295/// = "10")
296#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
297pub struct OHHDRMetadataKey(pub ::core::ffi::c_uint);
298/// Defines the HDR metadata.
299///
300/// Available since API-level: 9
301/// = "10")
302#[repr(C)]
303#[derive(Debug, Copy, Clone)]
304pub struct OHHDRMetaData {
305 pub key: OHHDRMetadataKey,
306 pub value: f32,
307}
308/// Defines the ExtData Handle
309///
310/// Available since API-level: 9
311/// = "10")
312#[repr(C)]
313#[derive(Debug)]
314pub struct OHExtDataHandle {
315 pub fd: i32,
316 pub reserveInts: u32,
317 pub reserve: __IncompleteArrayField<i32>,
318}
319#[cfg(feature = "api-12")]
320#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
321impl OHSurfaceSource {
322 pub const OH_SURFACE_SOURCE_DEFAULT: OHSurfaceSource = OHSurfaceSource(0);
323 pub const OH_SURFACE_SOURCE_UI: OHSurfaceSource = OHSurfaceSource(1);
324 pub const OH_SURFACE_SOURCE_GAME: OHSurfaceSource = OHSurfaceSource(2);
325 pub const OH_SURFACE_SOURCE_CAMERA: OHSurfaceSource = OHSurfaceSource(3);
326 pub const OH_SURFACE_SOURCE_VIDEO: OHSurfaceSource = OHSurfaceSource(4);
327}
328#[repr(transparent)]
329/// Indicates the source type of surface.
330///
331/// Available since API-level: 12
332#[cfg(feature = "api-12")]
333#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
334#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
335pub struct OHSurfaceSource(pub ::core::ffi::c_uint);
336extern "C" {
337 /// Creates a <b>OHNativeWindow</b> instance. A new <b>OHNativeWindow</b> instance is created each time this function is called.
338 ///
339 ///
340 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
341 /// # Arguments
342 ///
343 /// * `pSurface` - Indicates the pointer to a <b>ProduceSurface</b>. The type is a pointer to <b>sptr<OHOS::Surface></b>.
344 ///
345 /// # Returns
346 ///
347 /// * Returns the pointer to the <b>OHNativeWindow</b> instance created.
348 ///
349 /// Available since API-level: 8
350 ///
351 /// Version: 1.0
352 ///
353 /// **Deprecated** since 12
354 #[deprecated(since = "12")]
355 pub fn OH_NativeWindow_CreateNativeWindow(
356 pSurface: *mut ::core::ffi::c_void,
357 ) -> *mut OHNativeWindow;
358 /// Decreases the reference count of a <b>OHNativeWindow</b> instance by 1,
359 /// and when the reference count reaches 0, destroys the instance.
360 ///
361 /// This interface is a non-thread-safe type interface.
362 ///
363 ///
364 ///
365 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
366 /// # Arguments
367 ///
368 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
369 ///
370 /// Available since API-level: 8
371 ///
372 /// Version: 1.0
373 pub fn OH_NativeWindow_DestroyNativeWindow(window: *mut OHNativeWindow);
374 /// Creates a <b>OHNativeWindowBuffer</b> instance. A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.
375 ///
376 ///
377 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
378 /// # Arguments
379 ///
380 /// * `pSurfaceBuffer` - Indicates the pointer to a produce buffer. The type is <b>sptr<OHOS::SurfaceBuffer></b>.
381 ///
382 /// # Returns
383 ///
384 /// * Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
385 ///
386 /// Available since API-level: 8
387 ///
388 /// Version: 1.0
389 ///
390 /// **Deprecated** since 12
391 /// OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer
392 #[deprecated(since = "12")]
393 pub fn OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(
394 pSurfaceBuffer: *mut ::core::ffi::c_void,
395 ) -> *mut OHNativeWindowBuffer;
396 /// Creates a <b>OHNativeWindowBuffer</b> instance.
397 ///
398 /// A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.
399 ///
400 /// This interface needs to be used in conjunction with <b>OH_NativeWindow_DestroyNativeWindowBuffer</b>,
401 /// otherwise memory leaks will occur.
402 ///
403 /// This interface is a non-thread-safe type interface.
404 ///
405 ///
406 ///
407 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
408 /// # Arguments
409 ///
410 /// * `nativeBuffer` - Indicates the pointer to a native buffer. The type is <b>OH_NativeBuffer*</b>.
411 ///
412 /// # Returns
413 ///
414 /// * Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
415 ///
416 /// Available since API-level: 11
417 ///
418 /// Version: 1.0
419 #[cfg(feature = "api-11")]
420 #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
421 pub fn OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(
422 nativeBuffer: *mut OH_NativeBuffer,
423 ) -> *mut OHNativeWindowBuffer;
424 /// Decreases the reference count of a <b>OHNativeWindowBuffer</b> instance by 1 and,
425 /// when the reference count reaches 0, destroys the instance.
426 ///
427 /// This interface is a non-thread-safe type interface.
428 ///
429 ///
430 ///
431 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
432 /// # Arguments
433 ///
434 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
435 ///
436 /// Available since API-level: 8
437 ///
438 /// Version: 1.0
439 pub fn OH_NativeWindow_DestroyNativeWindowBuffer(buffer: *mut OHNativeWindowBuffer);
440 /// Requests a <b>OHNativeWindowBuffer</b> through a <b>OHNativeWindow</b> instance for content production.
441 ///
442 /// Before calling this interface, you need to set the width and height of
443 /// <b>OHNativeWindow</b> through <b>SET_BUFFER_GEOMETRY</b>.
444 ///
445 /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeWindowFlushBuffer</b>,
446 /// otherwise buffer will be exhausted.
447 ///
448 /// When the fenceFd is used up, you need to close it.
449 ///
450 /// This interface is a non-thread-safe type interface.
451 ///
452 ///
453 ///
454 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
455 /// # Arguments
456 ///
457 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
458 ///
459 /// * `buffer` - Indicates the double pointer to a <b>OHNativeWindowBuffer</b> instance.
460 ///
461 /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
462 ///
463 /// # Returns
464 ///
465 /// * Returns an error code, 0 is success, otherwise, failed.
466 ///
467 /// Available since API-level: 8
468 ///
469 /// Version: 1.0
470 pub fn OH_NativeWindow_NativeWindowRequestBuffer(
471 window: *mut OHNativeWindow,
472 buffer: *mut *mut OHNativeWindowBuffer,
473 fenceFd: *mut ::core::ffi::c_int,
474 ) -> i32;
475 /// Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue
476 /// through a <b>OHNativeWindow</b> instance for content consumption.
477 ///
478 /// The fenceFd will be close by system.
479 ///
480 /// This interface is a non-thread-safe type interface.
481 ///
482 ///
483 ///
484 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
485 /// # Arguments
486 ///
487 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
488 ///
489 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
490 ///
491 /// * `fenceFd` - Indicates a file descriptor handle, which is used for timing synchronization.
492 ///
493 /// * `region` - Indicates a dirty region where content is updated.
494 ///
495 /// # Returns
496 ///
497 /// * Returns an error code, 0 is success, otherwise, failed.
498 ///
499 /// Available since API-level: 8
500 ///
501 /// Version: 1.0
502 pub fn OH_NativeWindow_NativeWindowFlushBuffer(
503 window: *mut OHNativeWindow,
504 buffer: *mut OHNativeWindowBuffer,
505 fenceFd: ::core::ffi::c_int,
506 region: Region,
507 ) -> i32;
508 /// Get the last flushed <b>OHNativeWindowBuffer</b> from a <b>OHNativeWindow</b> instance.
509 ///
510 ///
511 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
512 /// # Arguments
513 ///
514 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
515 ///
516 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> pointer.
517 ///
518 /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
519 ///
520 /// * `matrix` - Indicates the retrieved 4*4 transform matrix.
521 ///
522 /// # Returns
523 ///
524 /// * Returns an error code, 0 is success, otherwise, failed.
525 ///
526 /// Available since API-level: 11
527 ///
528 /// Version: 1.0
529 ///
530 /// **Deprecated** since 12
531 /// OH_NativeWindow_GetLastFlushedBufferV2
532 #[cfg(feature = "api-11")]
533 #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
534 #[deprecated(since = "12")]
535 pub fn OH_NativeWindow_GetLastFlushedBuffer(
536 window: *mut OHNativeWindow,
537 buffer: *mut *mut OHNativeWindowBuffer,
538 fenceFd: *mut ::core::ffi::c_int,
539 matrix: *mut f32,
540 ) -> i32;
541 /// Returns the <b>OHNativeWindowBuffer</b> to the buffer queue through a <b>OHNativeWindow</b> instance,
542 /// without filling in any content. The <b>OHNativeWindowBuffer</b> can be used for another request.
543 ///
544 /// This interface is a non-thread-safe type interface.
545 ///
546 ///
547 ///
548 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
549 /// # Arguments
550 ///
551 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
552 ///
553 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
554 ///
555 /// # Returns
556 ///
557 /// * Returns an error code, 0 is success, otherwise, failed.
558 ///
559 /// Available since API-level: 8
560 ///
561 /// Version: 1.0
562 pub fn OH_NativeWindow_NativeWindowAbortBuffer(
563 window: *mut OHNativeWindow,
564 buffer: *mut OHNativeWindowBuffer,
565 ) -> i32;
566 /// Sets or obtains the attributes of a native window, including the width, height, and content format.
567 ///
568 /// This interface is a non-thread-safe type interface.
569 ///
570 ///
571 ///
572 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
573 /// # Arguments
574 ///
575 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
576 ///
577 /// * `code` - Indicates the operation code, pointer to <b>NativeWindowOperation</b>.
578 ///
579 /// * `...` - variable parameter, must correspond to code one-to-one.
580 ///
581 /// # Returns
582 ///
583 /// * Returns an error code, 0 is success, otherwise, failed.
584 ///
585 /// Available since API-level: 8
586 ///
587 /// Version: 1.0
588 pub fn OH_NativeWindow_NativeWindowHandleOpt(
589 window: *mut OHNativeWindow,
590 code: ::core::ffi::c_int,
591 ...
592 ) -> i32;
593 /// Obtains the pointer to a <b>BufferHandle</b> of a <b>OHNativeWindowBuffer</b> instance.
594 ///
595 /// This interface is a non-thread-safe type interface.
596 ///
597 ///
598 ///
599 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
600 /// # Arguments
601 ///
602 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
603 ///
604 /// # Returns
605 ///
606 /// * Returns the pointer to the <b>BufferHandle</b> instance obtained.
607 ///
608 /// Available since API-level: 8
609 ///
610 /// Version: 1.0
611 pub fn OH_NativeWindow_GetBufferHandleFromNative(
612 buffer: *mut OHNativeWindowBuffer,
613 ) -> *mut BufferHandle;
614 /// Adds the reference count of a native object.
615 ///
616 /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeObjectUnreference</b>,
617 /// otherwise memory leaks will occur.
618 ///
619 /// This interface is a non-thread-safe type interface.
620 ///
621 ///
622 ///
623 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
624 /// # Arguments
625 ///
626 /// * `obj` - Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
627 ///
628 /// # Returns
629 ///
630 /// * Returns an error code, 0 is success, otherwise, failed.
631 ///
632 /// Available since API-level: 8
633 ///
634 /// Version: 1.0
635 pub fn OH_NativeWindow_NativeObjectReference(obj: *mut ::core::ffi::c_void) -> i32;
636 /// Decreases the reference count of a native object and,
637 /// when the reference count reaches 0, destroys this object.
638 ///
639 /// This interface is a non-thread-safe type interface.
640 ///
641 ///
642 ///
643 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
644 /// # Arguments
645 ///
646 /// * `obj` - Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
647 ///
648 /// # Returns
649 ///
650 /// * Returns an error code, 0 is success, otherwise, failed.
651 ///
652 /// Available since API-level: 8
653 ///
654 /// Version: 1.0
655 pub fn OH_NativeWindow_NativeObjectUnreference(obj: *mut ::core::ffi::c_void) -> i32;
656 /// Obtains the magic ID of a native object.
657 ///
658 /// This interface is a non-thread-safe type interface.
659 ///
660 ///
661 ///
662 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
663 /// # Arguments
664 ///
665 /// * `obj` - Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
666 ///
667 /// # Returns
668 ///
669 /// * Returns the magic ID, which is unique for each native object.
670 ///
671 /// Available since API-level: 8
672 ///
673 /// Version: 1.0
674 pub fn OH_NativeWindow_GetNativeObjectMagic(obj: *mut ::core::ffi::c_void) -> i32;
675 /// Sets scalingMode of a native window.
676 ///
677 ///
678 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
679 /// # Arguments
680 ///
681 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
682 ///
683 /// * `sequence` - Indicates the sequence to a produce buffer.
684 ///
685 /// * `scalingMode` - Indicates the enum value to <b>OHScalingMode</b>
686 ///
687 /// # Returns
688 ///
689 /// * Returns an error code, 0 is success, otherwise, failed.
690 ///
691 /// Available since API-level: 9
692 ///
693 /// Version: 1.0
694 /// = "10")
695 /// OH_NativeWindow_NativeWindowSetScalingModeV2
696 pub fn OH_NativeWindow_NativeWindowSetScalingMode(
697 window: *mut OHNativeWindow,
698 sequence: u32,
699 scalingMode: OHScalingMode,
700 ) -> i32;
701 /// Sets metaData of a native window.
702 ///
703 ///
704 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
705 /// # Arguments
706 ///
707 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
708 ///
709 /// * `sequence` - Indicates the sequence to a produce buffer.
710 ///
711 /// * `size` - Indicates the size of a <b>OHHDRMetaData</b> vector.
712 ///
713 /// * `metaDate` - Indicates the pointer to a <b>OHHDRMetaData</b> vector.
714 ///
715 /// # Returns
716 ///
717 /// * Returns an error code, 0 is success, otherwise, failed.
718 ///
719 /// Available since API-level: 9
720 ///
721 /// Version: 1.0
722 /// = "10")
723 pub fn OH_NativeWindow_NativeWindowSetMetaData(
724 window: *mut OHNativeWindow,
725 sequence: u32,
726 size: i32,
727 metaData: *const OHHDRMetaData,
728 ) -> i32;
729 /// Sets metaDataSet of a native window.
730 ///
731 ///
732 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
733 /// # Arguments
734 ///
735 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
736 ///
737 /// * `sequence` - Indicates the sequence to a produce buffer.
738 ///
739 /// * `key` - Indicates the enum value to <b>OHHDRMetadataKey</b>
740 ///
741 /// * `size` - Indicates the size of a uint8_t vector.
742 ///
743 /// * `metaDate` - Indicates the pointer to a uint8_t vector.
744 ///
745 /// # Returns
746 ///
747 /// * Returns an error code, 0 is success, otherwise, failed.
748 ///
749 /// Available since API-level: 9
750 ///
751 /// Version: 1.0
752 /// = "10")
753 pub fn OH_NativeWindow_NativeWindowSetMetaDataSet(
754 window: *mut OHNativeWindow,
755 sequence: u32,
756 key: OHHDRMetadataKey,
757 size: i32,
758 metaData: *const u8,
759 ) -> i32;
760 /// Sets tunnel handle of a native window.
761 ///
762 ///
763 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
764 /// # Arguments
765 ///
766 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
767 ///
768 /// * `handle` - Indicates the pointer to a <b>OHExtDataHandle</b>.
769 ///
770 /// # Returns
771 ///
772 /// * Returns an error code, 0 is success, otherwise, failed.
773 ///
774 /// Available since API-level: 9
775 ///
776 /// Version: 1.0
777 /// = "10")
778 pub fn OH_NativeWindow_NativeWindowSetTunnelHandle(
779 window: *mut OHNativeWindow,
780 handle: *const OHExtDataHandle,
781 ) -> i32;
782 /// Attach a buffer to an <b>OHNativeWindow</b> instance.
783 ///
784 /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeWindowDetachBuffer</b>,
785 /// otherwise buffer management will be chaotic.
786 ///
787 /// This interface is a non-thread-safe type interface.
788 ///
789 ///
790 ///
791 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
792 /// # Arguments
793 ///
794 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
795 ///
796 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
797 ///
798 /// # Returns
799 ///
800 /// * Returns an error code, 0 is success, otherwise, failed.
801 ///
802 /// Available since API-level: 12
803 ///
804 /// Version: 1.0
805 #[cfg(feature = "api-12")]
806 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
807 pub fn OH_NativeWindow_NativeWindowAttachBuffer(
808 window: *mut OHNativeWindow,
809 buffer: *mut OHNativeWindowBuffer,
810 ) -> i32;
811 /// Detach a buffer from an <b>OHNativeWindow</b> instance.
812 ///
813 /// This interface is a non-thread-safe type interface.
814 ///
815 ///
816 ///
817 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
818 /// # Arguments
819 ///
820 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
821 ///
822 /// * `buffer` - Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
823 ///
824 /// # Returns
825 ///
826 /// * Returns an error code, 0 is success, otherwise, failed.
827 ///
828 /// Available since API-level: 12
829 ///
830 /// Version: 1.0
831 #[cfg(feature = "api-12")]
832 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
833 pub fn OH_NativeWindow_NativeWindowDetachBuffer(
834 window: *mut OHNativeWindow,
835 buffer: *mut OHNativeWindowBuffer,
836 ) -> i32;
837 /// Get surfaceId from native window.
838 ///
839 /// This interface is a non-thread-safe type interface.
840 ///
841 ///
842 ///
843 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
844 /// # Arguments
845 ///
846 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
847 ///
848 /// * `surfaceId` - Indicates the pointer to a surfaceId.
849 ///
850 /// # Returns
851 ///
852 /// * Returns an error code, 0 is success, otherwise, failed.
853 ///
854 /// Available since API-level: 12
855 ///
856 /// Version: 1.0
857 #[cfg(feature = "api-12")]
858 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
859 pub fn OH_NativeWindow_GetSurfaceId(window: *mut OHNativeWindow, surfaceId: *mut u64) -> i32;
860 /// Creates an <b>OHNativeWindow</b> instance.
861 ///
862 /// This interface needs to be used in conjunction with <b>OH_NativeWindow_DestroyNativeWindow</b>,
863 /// otherwise memory leaks will occur.
864 ///
865 /// If there is a concurrent destroy OHNativeWindow, you need to add once and decrement once to the
866 /// OHNativeWindow reference count through <b>OH_NativeWindow_NativeObjectReference</b> and
867 /// <b>OH_NativeWindow_NativeObjectUnreference</b>.
868 ///
869 /// If the surface obtained through surfaceId is created in this process, the surface cannot be obtained
870 /// across processes.
871 ///
872 /// This interface is a non-thread-safe type interface.
873 ///
874 ///
875 ///
876 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
877 /// # Arguments
878 ///
879 /// * `surfaceId` - Indicates the surfaceId to a surface.
880 ///
881 /// * `window` - indicates the pointer to an <b>OHNativeWindow</b> instance.
882 ///
883 /// # Returns
884 ///
885 /// * Returns an error code, 0 is Success, otherwise, failed.
886 ///
887 /// Available since API-level: 12
888 ///
889 /// Version: 1.0
890 #[cfg(feature = "api-12")]
891 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
892 pub fn OH_NativeWindow_CreateNativeWindowFromSurfaceId(
893 surfaceId: u64,
894 window: *mut *mut OHNativeWindow,
895 ) -> i32;
896 /// Sets scalingMode of a native window.
897 ///
898 /// This interface is a non-thread-safe type interface.
899 ///
900 ///
901 ///
902 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
903 /// # Arguments
904 ///
905 /// * `window` - indicates the pointer to an <b>OHNativeWindow</b> instance.
906 ///
907 /// * `scalingMode` - Indicates the enum value to <b>OHScalingModeV2</b>
908 ///
909 /// # Returns
910 ///
911 /// * Returns an error code, 0 is Success, otherwise, failed.
912 ///
913 /// Available since API-level: 12
914 ///
915 /// Version: 1.0
916 #[cfg(feature = "api-12")]
917 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
918 pub fn OH_NativeWindow_NativeWindowSetScalingModeV2(
919 window: *mut OHNativeWindow,
920 scalingMode: OHScalingModeV2,
921 ) -> i32;
922 /// Set native window buffer hold.
923 ///
924 /// This interface is a non-thread-safe type interface.
925 ///
926 ///
927 ///
928 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
929 /// # Arguments
930 ///
931 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
932 ///
933 /// Available since API-level: 12
934 ///
935 /// Version: 1.0
936 #[cfg(feature = "api-12")]
937 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
938 pub fn OH_NativeWindow_SetBufferHold(window: *mut OHNativeWindow);
939 /// Write an OHNativeWindow to an OHIPCParcel.
940 ///
941 /// This interface is a non-thread-safe type interface.
942 ///
943 ///
944 ///
945 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
946 /// # Arguments
947 ///
948 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
949 ///
950 /// * `parcel` - Indicates the pointer to an <b>OHIPCParcel</b> instance.
951 ///
952 /// # Returns
953 ///
954 /// * [`NATIVE_ERROR_OK`] 0 - Success.
955 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - parcel is NULL or window is NULL.
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_WriteToParcel(
963 window: *mut OHNativeWindow,
964 parcel: *mut OHIPCParcel,
965 ) -> i32;
966 /// Read an OHNativeWindow from an OHIPCParcel.
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 /// * `parcel` - Indicates the pointer to an <b>OHIPCParcel</b> instance.
976 ///
977 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
978 ///
979 /// # Returns
980 ///
981 /// * [`NATIVE_ERROR_OK`] 0 - Success.
982 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - parcel is NULL or parcel does not contain the window.
983 ///
984 /// Available since API-level: 12
985 ///
986 /// Version: 1.0
987 #[cfg(feature = "api-12")]
988 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
989 pub fn OH_NativeWindow_ReadFromParcel(
990 parcel: *mut OHIPCParcel,
991 window: *mut *mut OHNativeWindow,
992 ) -> i32;
993 /// Get the last flushed <b>OHNativeWindowBuffer</b> from an <b>OHNativeWindow</b> instance.
994 ///
995 /// When the fenceFd is used up, you need to close it.
996 ///
997 /// This interface needs to be used in conjunction with <b>OH_NativeWindow_NativeObjectUnreference</b>,
998 /// otherwise memory leaks will occur.
999 ///
1000 /// This interface is a non-thread-safe type interface.
1001 ///
1002 ///
1003 ///
1004 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1005 /// # Arguments
1006 ///
1007 /// * `window` - Indicates the pointer to an <b>OHNativeWindow</b> instance.
1008 ///
1009 /// * `buffer` - Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.
1010 ///
1011 /// * `fenceFd` - Indicates the pointer to a file descriptor handle.
1012 ///
1013 /// * `matrix` - Indicates the retrieved 4*4 transform matrix.
1014 ///
1015 /// # Returns
1016 ///
1017 /// * [`NATIVE_ERROR_OK`] 0 - Success.
1018 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL or buffer is NULL or fenceFd is NULL.
1019 /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - buffer state is wrong.
1020 ///
1021 /// Available since API-level: 12
1022 ///
1023 /// Version: 1.0
1024 #[cfg(feature = "api-12")]
1025 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1026 pub fn OH_NativeWindow_GetLastFlushedBufferV2(
1027 window: *mut OHNativeWindow,
1028 buffer: *mut *mut OHNativeWindowBuffer,
1029 fenceFd: *mut ::core::ffi::c_int,
1030 matrix: *mut f32,
1031 ) -> i32;
1032 /// Set the color space of the native window.
1033 ///
1034 /// This interface is a non-thread-safe type interface.
1035 ///
1036 ///
1037 ///
1038 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1039 /// # Arguments
1040 ///
1041 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1042 ///
1043 /// * `colorSpace` - Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.
1044 ///
1045 /// # Returns
1046 ///
1047 /// * [`NATIVE_ERROR_OK`] 0 - Success.
1048 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL.
1049 /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect colorSpace state.
1050 ///
1051 /// Available since API-level: 12
1052 ///
1053 /// Version: 1.0
1054 #[cfg(feature = "api-12")]
1055 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1056 pub fn OH_NativeWindow_SetColorSpace(
1057 window: *mut OHNativeWindow,
1058 colorSpace: OH_NativeBuffer_ColorSpace,
1059 ) -> i32;
1060 /// Get the color space of the native window.
1061 ///
1062 /// This interface is a non-thread-safe type interface.
1063 ///
1064 ///
1065 ///
1066 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1067 /// # Arguments
1068 ///
1069 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1070 ///
1071 /// * `colorSpace` - Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.
1072 ///
1073 /// # Returns
1074 ///
1075 /// * [`NATIVE_ERROR_OK`] 0 - Success.
1076 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window is NULL.
1077 /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect colorSpace state.
1078 ///
1079 /// Available since API-level: 12
1080 ///
1081 /// Version: 1.0
1082 #[cfg(feature = "api-12")]
1083 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1084 pub fn OH_NativeWindow_GetColorSpace(
1085 window: *mut OHNativeWindow,
1086 colorSpace: *mut OH_NativeBuffer_ColorSpace,
1087 ) -> i32;
1088 /// Set the metadata type of the native window.
1089 ///
1090 /// This interface is a non-thread-safe type interface.
1091 ///
1092 ///
1093 ///
1094 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1095 /// # Arguments
1096 ///
1097 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1098 ///
1099 /// * `metadataKey` - Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.
1100 ///
1101 /// * `size` - Indicates the size of a uint8_t vector.
1102 ///
1103 /// * `metadata` - Indicates the pointer to a uint8_t vector.
1104 ///
1105 /// # Returns
1106 ///
1107 /// * [`NATIVE_ERROR_OK`] 0 - Success.
1108 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window or metadata is NULL.
1109 /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect metadata state.
1110 /// [`NATIVE_ERROR_UNSUPPORTED`] 50102000 - Unsupported metadata key.
1111 ///
1112 /// Available since API-level: 12
1113 ///
1114 /// Version: 1.0
1115 #[cfg(feature = "api-12")]
1116 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1117 pub fn OH_NativeWindow_SetMetadataValue(
1118 window: *mut OHNativeWindow,
1119 metadataKey: OH_NativeBuffer_MetadataKey,
1120 size: i32,
1121 metadata: *mut u8,
1122 ) -> i32;
1123 /// Set the metadata type of the native window.
1124 ///
1125 /// This interface is a non-thread-safe type interface.
1126 ///
1127 ///
1128 ///
1129 /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeWindow
1130 /// # Arguments
1131 ///
1132 /// * `window` - Indicates the pointer to a <b>OHNativeWindow</b> instance.
1133 ///
1134 /// * `metadataKey` - Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.
1135 ///
1136 /// * `size` - Indicates the size of a uint8_t vector.
1137 ///
1138 /// * `metadata` - Indicates the pointer to a uint8_t vector.
1139 ///
1140 /// # Returns
1141 ///
1142 /// * [`NATIVE_ERROR_OK`] 0 - Success.
1143 /// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - window, metadata, or size is NULL.
1144 /// [`NATIVE_ERROR_BUFFER_STATE_INVALID`] 41207000 - Incorrect metadata state.
1145 /// [`NATIVE_ERROR_UNSUPPORTED`] 50102000 - Unsupported metadata key.
1146 ///
1147 /// Available since API-level: 12
1148 ///
1149 /// Version: 1.0
1150 #[cfg(feature = "api-12")]
1151 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1152 pub fn OH_NativeWindow_GetMetadataValue(
1153 window: *mut OHNativeWindow,
1154 metadataKey: OH_NativeBuffer_MetadataKey,
1155 size: *mut i32,
1156 metadata: *mut *mut u8,
1157 ) -> i32;
1158}