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