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