1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
/* automatically generated by rust-bindgen 0.69.4 */

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
impl<T> __IncompleteArrayField<T> {
    #[inline]
    pub const fn new() -> Self {
        __IncompleteArrayField(::core::marker::PhantomData, [])
    }
    #[inline]
    pub fn as_ptr(&self) -> *const T {
        self as *const _ as *const T
    }
    #[inline]
    pub fn as_mut_ptr(&mut self) -> *mut T {
        self as *mut _ as *mut T
    }
    #[inline]
    pub unsafe fn as_slice(&self, len: usize) -> &[T] {
        ::core::slice::from_raw_parts(self.as_ptr(), len)
    }
    #[inline]
    pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
        ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
    }
}
impl<T> ::core::fmt::Debug for __IncompleteArrayField<T> {
    fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        fmt.write_str("__IncompleteArrayField")
    }
}
#[repr(C)]
#[derive(Debug)]
pub struct BufferHandle {
    ///< buffer fd, -1 if not supported
    pub fd: i32,
    ///< the width of memory
    pub width: i32,
    ///< the stride of memory
    pub stride: i32,
    ///< the height of memory
    pub height: i32,
    pub size: i32,
    ///< the format of memory
    pub format: i32,
    ///< the usage of memory
    pub usage: u64,
    ///< Virtual address of memory
    pub virAddr: *mut ::core::ffi::c_void,
    ///< Shared memory key
    pub key: i32,
    ///< Physical address
    pub phyAddr: u64,
    ///< the number of reserved fd value
    pub reserveFds: u32,
    ///< the number of reserved integer value
    pub reserveInts: u32,
    ///< the data
    pub reserve: __IncompleteArrayField<i32>,
}
/** @brief native window.
@since 8*/
#[repr(C)]
#[derive(Debug)]
pub struct NativeWindow {
    _unused: [u8; 0],
}
/** @brief native window buffer.
@since 8*/
#[repr(C)]
#[derive(Debug)]
pub struct NativeWindowBuffer {
    _unused: [u8; 0],
}
/** @brief define the new type name OHNativeWindow for struct NativeWindow.
@since 8*/
pub type OHNativeWindow = NativeWindow;
/** @brief define the new type name OHNativeWindowBuffer for struct NativeWindowBuffer.
@since 8*/
pub type OHNativeWindowBuffer = NativeWindowBuffer;
/** @brief indicates a dirty region where content is updated.
@since 8*/
#[repr(C)]
#[derive(Debug)]
pub struct Region {
    pub rects: *mut Region_Rect,
    /// if rectNumber is 0, fill the Buffer dirty size by default
    pub rectNumber: i32,
}
/// if rects is nullptr, fill the Buffer dirty size by default
#[repr(C)]
#[derive(Debug)]
pub struct Region_Rect {
    pub x: i32,
    pub y: i32,
    pub w: u32,
    pub h: u32,
}
pub mod NativeWindowOperation {
    /** @brief Indicates the operation code in the function OH_NativeWindow_NativeWindowHandleOpt.
    @since 8*/
    pub type Type = ::core::ffi::c_uint;
    /** set native window buffer geometry,
    variable parameter in function is
    [in] int32_t height, [in] int32_t width*/
    pub const SET_BUFFER_GEOMETRY: Type = 0;
    /** get native window buffer geometry,
    variable parameter in function is
    [out] int32_t *height, [out] int32_t *width*/
    pub const GET_BUFFER_GEOMETRY: Type = 1;
    /** get native window buffer format,
    variable parameter in function is
    [out] int32_t *format*/
    pub const GET_FORMAT: Type = 2;
    /** set native window buffer format,
    variable parameter in function is
    [in] int32_t format*/
    pub const SET_FORMAT: Type = 3;
    /** get native window buffer usage,
    variable parameter in function is
    [out] int32_t *usage.*/
    pub const GET_USAGE: Type = 4;
    /** set native window buffer usage,
    variable parameter in function is
    [in] int32_t usage.*/
    pub const SET_USAGE: Type = 5;
    /** set native window buffer stride,
    variable parameter in function is
    [in] int32_t stride.*/
    pub const SET_STRIDE: Type = 6;
    /** get native window buffer stride,
    variable parameter in function is
    [out] int32_t *stride.*/
    pub const GET_STRIDE: Type = 7;
    /** set native window buffer swap interval,
    variable parameter in function is
    [in] int32_t interval.*/
    pub const SET_SWAP_INTERVAL: Type = 8;
    /** get native window buffer swap interval,
    variable parameter in function is
    [out] int32_t *interval.*/
    pub const GET_SWAP_INTERVAL: Type = 9;
    /** set native window buffer timeout,
    variable parameter in function is
    [in] int32_t timeout.*/
    pub const SET_TIMEOUT: Type = 10;
    /** get native window buffer timeout,
    variable parameter in function is
    [out] int32_t *timeout.*/
    pub const GET_TIMEOUT: Type = 11;
    /** set native window buffer colorGamut,
    variable parameter in function is
    [in] int32_t colorGamut.*/
    pub const SET_COLOR_GAMUT: Type = 12;
    /** get native window buffer colorGamut,
    variable parameter in function is
    [out int32_t *colorGamut].*/
    pub const GET_COLOR_GAMUT: Type = 13;
    /** set native window buffer transform,
    variable parameter in function is
    [in] int32_t transform.*/
    pub const SET_TRANSFORM: Type = 14;
    /** get native window buffer transform,
    variable parameter in function is
    [out] int32_t *transform.*/
    pub const GET_TRANSFORM: Type = 15;
    /** set native window buffer uiTimestamp,
    variable parameter in function is
    [in] uint64_t uiTimestamp.*/
    pub const SET_UI_TIMESTAMP: Type = 16;
}
pub mod OHScalingMode {
    /** @brief Indicates Scaling Mode.
    @since 9
    @deprecated(since = "10")*/
    pub type Type = ::core::ffi::c_uint;
    /** the window content is not updated until a buffer of
    the window size is received*/
    pub const OH_SCALING_MODE_FREEZE: Type = 0;
    /// the buffer is scaled in two dimensions to match the window size
    pub const OH_SCALING_MODE_SCALE_TO_WINDOW: Type = 1;
    /** the buffer is uniformly scaled so that the smaller size of
    the buffer matches the window size*/
    pub const OH_SCALING_MODE_SCALE_CROP: Type = 2;
    /** the window is clipped to the size of the buffer's clipping rectangle
    pixels outside the clipping rectangle are considered fully transparent.*/
    pub const OH_SCALING_MODE_NO_SCALE_CROP: Type = 3;
}
pub mod OHHDRMetadataKey {
    /** @brief Enumerates the HDR metadata keys.
    @since 9
    @deprecated(since = "10")*/
    pub type Type = ::core::ffi::c_uint;
    pub const OH_METAKEY_RED_PRIMARY_X: Type = 0;
    pub const OH_METAKEY_RED_PRIMARY_Y: Type = 1;
    pub const OH_METAKEY_GREEN_PRIMARY_X: Type = 2;
    pub const OH_METAKEY_GREEN_PRIMARY_Y: Type = 3;
    pub const OH_METAKEY_BLUE_PRIMARY_X: Type = 4;
    pub const OH_METAKEY_BLUE_PRIMARY_Y: Type = 5;
    pub const OH_METAKEY_WHITE_PRIMARY_X: Type = 6;
    pub const OH_METAKEY_WHITE_PRIMARY_Y: Type = 7;
    pub const OH_METAKEY_MAX_LUMINANCE: Type = 8;
    pub const OH_METAKEY_MIN_LUMINANCE: Type = 9;
    pub const OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL: Type = 10;
    pub const OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL: Type = 11;
    pub const OH_METAKEY_HDR10_PLUS: Type = 12;
    pub const OH_METAKEY_HDR_VIVID: Type = 13;
}
/** @brief Defines the HDR metadata.
@since 9
@deprecated(since = "10")*/
#[repr(C)]
#[derive(Debug)]
pub struct OHHDRMetaData {
    pub key: OHHDRMetadataKey::Type,
    pub value: f32,
}
/** @brief Defines the ExtData Handle
@since 9
@deprecated(since = "10")*/
#[repr(C)]
#[derive(Debug)]
pub struct OHExtDataHandle {
    pub fd: i32,
    pub reserveInts: u32,
    pub reserve: __IncompleteArrayField<i32>,
}
extern "C" {
    /** @brief Creates a <b>OHNativeWindow</b> instance. A new <b>OHNativeWindow</b> instance is created each time this function is called.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param pSurface Indicates the pointer to a <b>ProduceSurface</b>. The type is a pointer to <b>sptr<OHOS::Surface></b>.
    @return Returns the pointer to the <b>OHNativeWindow</b> instance created.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_CreateNativeWindow(
        pSurface: *mut ::core::ffi::c_void,
    ) -> *mut OHNativeWindow;
}
extern "C" {
    /** @brief Decreases the reference count of a <b>OHNativeWindow</b> instance by 1, and when the reference count reaches 0, destroys the instance.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_DestroyNativeWindow(window: *mut OHNativeWindow);
}
extern "C" {
    /** @brief Creates a <b>OHNativeWindowBuffer</b> instance. A new <b>OHNativeWindowBuffer</b> instance is created each time this function is called.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param pSurfaceBuffer Indicates the pointer to a produce buffer. The type is <b>sptr<OHOS::SurfaceBuffer></b>.
    @return Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(
        pSurfaceBuffer: *mut ::core::ffi::c_void,
    ) -> *mut OHNativeWindowBuffer;
}
extern "C" {
    /** @brief Decreases the reference count of a <b>OHNativeWindowBuffer</b> instance by 1 and, when the reference count reaches 0, destroys the instance.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_DestroyNativeWindowBuffer(buffer: *mut OHNativeWindowBuffer);
}
extern "C" {
    /** @brief Requests a <b>OHNativeWindowBuffer</b> through a <b>OHNativeWindow</b> instance for content production.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param buffer Indicates the double pointer to a <b>OHNativeWindowBuffer</b> instance.
    @param fenceFd Indicates the pointer to a file descriptor handle.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_NativeWindowRequestBuffer(
        window: *mut OHNativeWindow,
        buffer: *mut *mut OHNativeWindowBuffer,
        fenceFd: *mut ::core::ffi::c_int,
    ) -> i32;
}
extern "C" {
    /** @brief Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue through a <b>OHNativeWindow</b> instance for content consumption.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
    @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization.
    @param region Indicates a dirty region where content is updated.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_NativeWindowFlushBuffer(
        window: *mut OHNativeWindow,
        buffer: *mut OHNativeWindowBuffer,
        fenceFd: ::core::ffi::c_int,
        region: Region,
    ) -> i32;
}
extern "C" {
    /** @brief Returns the <b>OHNativeWindowBuffer</b> to the buffer queue through a <b>OHNativeWindow</b> instance, without filling in any content. The <b>OHNativeWindowBuffer</b> can be used for another request.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_NativeWindowAbortBuffer(
        window: *mut OHNativeWindow,
        buffer: *mut OHNativeWindowBuffer,
    ) -> i32;
}
extern "C" {
    /** @brief Sets or obtains the attributes of a native window, including the width, height, and content format.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param code Indicates the operation code, pointer to <b>NativeWindowOperation</b>.
    @param ... variable parameter, must correspond to code one-to-one.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_NativeWindowHandleOpt(
        window: *mut OHNativeWindow,
        code: ::core::ffi::c_int,
        ...
    ) -> i32;
}
extern "C" {
    /** @brief Obtains the pointer to a <b>BufferHandle</b> of a <b>OHNativeWindowBuffer</b> instance.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
    @return Returns the pointer to the <b>BufferHandle</b> instance obtained.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_GetBufferHandleFromNative(
        buffer: *mut OHNativeWindowBuffer,
    ) -> *mut BufferHandle;
}
extern "C" {
    /** @brief Adds the reference count of a native object.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param obj Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_NativeObjectReference(obj: *mut ::core::ffi::c_void) -> i32;
}
extern "C" {
    /** @brief Decreases the reference count of a native object and, when the reference count reaches 0, destroys this object.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param obj Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_NativeObjectUnreference(obj: *mut ::core::ffi::c_void) -> i32;
}
extern "C" {
    /** @brief Obtains the magic ID of a native object.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param obj Indicates the pointer to a <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
    @return Returns the magic ID, which is unique for each native object.
    @since 8
    @version 1.0*/
    pub fn OH_NativeWindow_GetNativeObjectMagic(obj: *mut ::core::ffi::c_void) -> i32;
}
extern "C" {
    /** @brief Sets scalingMode of a native window.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param sequence Indicates the sequence to a produce buffer.
    @param scalingMode Indicates the enum value to <b>OHScalingMode</b>
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 9
    @version 1.0
    @deprecated(since = "10")*/
    pub fn OH_NativeWindow_NativeWindowSetScalingMode(
        window: *mut OHNativeWindow,
        sequence: u32,
        scalingMode: OHScalingMode::Type,
    ) -> i32;
}
extern "C" {
    /** @brief Sets metaData of a native window.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param sequence Indicates the sequence to a produce buffer.
    @param size Indicates the size of a <b>OHHDRMetaData</b> vector.
    @param metaDate Indicates the pointer to a <b>OHHDRMetaData</b> vector.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 9
    @version 1.0
    @deprecated(since = "10")*/
    pub fn OH_NativeWindow_NativeWindowSetMetaData(
        window: *mut OHNativeWindow,
        sequence: u32,
        size: i32,
        metaData: *const OHHDRMetaData,
    ) -> i32;
}
extern "C" {
    /** @brief Sets metaDataSet of a native window.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param sequence Indicates the sequence to a produce buffer.
    @param key Indicates the enum value to <b>OHHDRMetadataKey</b>
    @param size Indicates the size of a uint8_t vector.
    @param metaDate Indicates the pointer to a uint8_t vector.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 9
    @version 1.0
    @deprecated(since = "10")*/
    pub fn OH_NativeWindow_NativeWindowSetMetaDataSet(
        window: *mut OHNativeWindow,
        sequence: u32,
        key: OHHDRMetadataKey::Type,
        size: i32,
        metaData: *const u8,
    ) -> i32;
}
extern "C" {
    /** @brief Sets tunnel handle of a native window.

    @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
    @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
    @param handle Indicates the pointer to a <b>OHExtDataHandle</b>.
    @return Returns an error code, 0 is success, otherwise, failed.
    @since 9
    @version 1.0
    @deprecated(since = "10")*/
    pub fn OH_NativeWindow_NativeWindowSetTunnelHandle(
        window: *mut OHNativeWindow,
        handle: *const OHExtDataHandle,
    ) -> i32;
}