Skip to main content

ohos_drawing_sys/rect/
rect_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 crate::types::*;
7
8extern "C" {
9    /// Creates an <b>OH_Drawing_Rect</b> object.
10    ///
11    ///
12    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
13    /// # Arguments
14    ///
15    /// * `left` - Indicates the left position of the rect.
16    ///
17    /// * `top` - Indicates the top position of the rect.
18    ///
19    /// * `right` - Indicates the right position of the rect.
20    ///
21    /// * `bottom` - Indicates the bottom position of the rect.
22    ///
23    /// # Returns
24    ///
25    /// * Returns the pointer to the <b>OH_Drawing_Rect</b> object created.
26    ///
27    /// Available since API-level: 11
28    ///
29    /// Version: 1.0
30    #[cfg(feature = "api-11")]
31    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
32    pub fn OH_Drawing_RectCreate(
33        left: f32,
34        top: f32,
35        right: f32,
36        bottom: f32,
37    ) -> *mut OH_Drawing_Rect;
38    /// If rect intersects other, sets rect to intersection.
39    ///
40    ///
41    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
42    /// # Arguments
43    ///
44    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
45    ///
46    /// * `other` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
47    ///
48    /// # Returns
49    ///
50    /// * Returns true if have area in common.
51    ///
52    /// Available since API-level: 12
53    ///
54    /// Version: 1.0
55    #[cfg(feature = "api-12")]
56    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
57    pub fn OH_Drawing_RectIntersect(
58        rect: *mut OH_Drawing_Rect,
59        other: *const OH_Drawing_Rect,
60    ) -> bool;
61    /// Sets rect to the union of rect and other.
62    ///
63    ///
64    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
65    /// # Arguments
66    ///
67    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
68    ///
69    /// * `other` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
70    ///
71    /// # Returns
72    ///
73    /// * Returns true if rect and other are not nullptr, and other is not empty;
74    /// false if rect or other is nullptr, or other is empty.
75    ///
76    /// Available since API-level: 12
77    ///
78    /// Version: 1.0
79    #[cfg(feature = "api-12")]
80    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
81    pub fn OH_Drawing_RectJoin(rect: *mut OH_Drawing_Rect, other: *const OH_Drawing_Rect) -> bool;
82    /// Set the left position of the rect.
83    ///
84    ///
85    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
86    /// # Arguments
87    ///
88    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
89    ///
90    /// * `left` - Indicates the left position of the rect.
91    ///
92    /// Available since API-level: 12
93    ///
94    /// Version: 1.0
95    #[cfg(feature = "api-12")]
96    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
97    pub fn OH_Drawing_RectSetLeft(rect: *mut OH_Drawing_Rect, left: f32);
98    /// Set the top position of the rect.
99    ///
100    ///
101    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
102    /// # Arguments
103    ///
104    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
105    ///
106    /// * `top` - Indicates the top position of the rect.
107    ///
108    /// Available since API-level: 12
109    ///
110    /// Version: 1.0
111    #[cfg(feature = "api-12")]
112    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
113    pub fn OH_Drawing_RectSetTop(rect: *mut OH_Drawing_Rect, top: f32);
114    /// Set the right position of the rect.
115    ///
116    ///
117    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
118    /// # Arguments
119    ///
120    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
121    ///
122    /// * `right` - Indicates the right position of the rect.
123    ///
124    /// Available since API-level: 12
125    ///
126    /// Version: 1.0
127    #[cfg(feature = "api-12")]
128    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
129    pub fn OH_Drawing_RectSetRight(rect: *mut OH_Drawing_Rect, right: f32);
130    /// Set the bottom position of the rect.
131    ///
132    ///
133    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
134    /// # Arguments
135    ///
136    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
137    ///
138    /// * `bottom` - Indicates the bottom position of the rect.
139    ///
140    /// Available since API-level: 12
141    ///
142    /// Version: 1.0
143    #[cfg(feature = "api-12")]
144    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
145    pub fn OH_Drawing_RectSetBottom(rect: *mut OH_Drawing_Rect, bottom: f32);
146    /// Get the left position of the rect.
147    ///
148    ///
149    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
150    /// # Arguments
151    ///
152    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
153    ///
154    /// # Returns
155    ///
156    /// * Return the left position of the rect.
157    ///
158    /// Available since API-level: 12
159    ///
160    /// Version: 1.0
161    #[cfg(feature = "api-12")]
162    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
163    pub fn OH_Drawing_RectGetLeft(rect: *mut OH_Drawing_Rect) -> f32;
164    /// Get the top position of the rect.
165    ///
166    ///
167    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
168    /// # Arguments
169    ///
170    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
171    ///
172    /// # Returns
173    ///
174    /// * Return the top position of the rect.
175    ///
176    /// Available since API-level: 12
177    ///
178    /// Version: 1.0
179    #[cfg(feature = "api-12")]
180    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
181    pub fn OH_Drawing_RectGetTop(rect: *mut OH_Drawing_Rect) -> f32;
182    /// Get the right position of the rect.
183    ///
184    ///
185    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
186    /// # Arguments
187    ///
188    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
189    ///
190    /// # Returns
191    ///
192    /// * Return the right position of the rect.
193    ///
194    /// Available since API-level: 12
195    ///
196    /// Version: 1.0
197    #[cfg(feature = "api-12")]
198    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
199    pub fn OH_Drawing_RectGetRight(rect: *mut OH_Drawing_Rect) -> f32;
200    /// Get the bottom position of the rect.
201    ///
202    ///
203    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
204    /// # Arguments
205    ///
206    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
207    ///
208    /// # Returns
209    ///
210    /// * Return the bottom position of the rect.
211    ///
212    /// Available since API-level: 12
213    ///
214    /// Version: 1.0
215    #[cfg(feature = "api-12")]
216    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
217    pub fn OH_Drawing_RectGetBottom(rect: *mut OH_Drawing_Rect) -> f32;
218    /// Get the height position of the rect.
219    ///
220    ///
221    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
222    /// # Arguments
223    ///
224    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
225    ///
226    /// Available since API-level: 12
227    ///
228    /// Version: 1.0
229    #[cfg(feature = "api-12")]
230    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
231    pub fn OH_Drawing_RectGetHeight(rect: *mut OH_Drawing_Rect) -> f32;
232    /// Get the width position of the rect.
233    ///
234    ///
235    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
236    /// # Arguments
237    ///
238    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
239    ///
240    /// # Returns
241    ///
242    /// * Returns the width.
243    ///
244    /// Available since API-level: 12
245    ///
246    /// Version: 1.0
247    #[cfg(feature = "api-12")]
248    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
249    pub fn OH_Drawing_RectGetWidth(rect: *mut OH_Drawing_Rect) -> f32;
250    /// Copy the original rectangular object to the destination rectangular object.
251    ///
252    ///
253    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
254    /// # Arguments
255    ///
256    /// * `src` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
257    ///
258    /// * `dst` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
259    ///
260    /// Available since API-level: 12
261    ///
262    /// Version: 1.0
263    #[cfg(feature = "api-12")]
264    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
265    pub fn OH_Drawing_RectCopy(src: *mut OH_Drawing_Rect, dst: *mut OH_Drawing_Rect);
266    /// Destroys an <b>OH_Drawing_Rect</b> object and reclaims the memory occupied by the object.
267    ///
268    ///
269    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
270    /// # Arguments
271    ///
272    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
273    ///
274    /// Available since API-level: 11
275    ///
276    /// Version: 1.0
277    #[cfg(feature = "api-11")]
278    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
279    pub fn OH_Drawing_RectDestroy(rect: *mut OH_Drawing_Rect);
280    /// Creates an <b>OH_Drawing_Array</b> object, which is used to store multiple <b>OH_Drawing_Rect</b> object.
281    ///
282    ///
283    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
284    /// # Arguments
285    ///
286    /// * `size` - Indicates the size of the array object.
287    ///
288    /// # Returns
289    ///
290    /// * Returns the pointer to the <b>OH_Drawing_Array</b> object created.
291    /// If nullptr is returned, the creation fails.
292    /// The possible cause of the failure is that the available memory is empty,
293    /// or size is invalid.
294    ///
295    /// Available since API-level: 18
296    ///
297    /// Version: 1.0
298    #[cfg(feature = "api-18")]
299    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
300    pub fn OH_Drawing_RectCreateArray(size: usize) -> *mut OH_Drawing_Array;
301    /// Gets the size of an <b>OH_Drawing_Array</b> object.
302    ///
303    ///
304    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
305    /// # Arguments
306    ///
307    /// * `rectArray` - Indicates the array object.
308    ///
309    /// * `pSize` - Indicates the size pointer.
310    ///
311    /// # Returns
312    ///
313    /// * Returns the error code.
314    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
315    /// Returns [`OH_DRAWING_ERROR_INVALID_PARAMETER`] if rectArray or pSize is nullptr.
316    ///
317    /// Available since API-level: 18
318    ///
319    /// Version: 1.0
320    #[cfg(feature = "api-18")]
321    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
322    pub fn OH_Drawing_RectGetArraySize(
323        rectArray: *mut OH_Drawing_Array,
324        pSize: *mut usize,
325    ) -> crate::error_code::DrawingResult;
326    /// Gets the specified <b>OH_Drawing_Rect</b> object from <b>OH_Drawing_Array</b> object.
327    ///
328    ///
329    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
330    /// # Arguments
331    ///
332    /// * `rectArray` - Indicates the array object.
333    ///
334    /// * `index` - Indicates the index of array, caller must make sure the index is valid.
335    ///
336    /// * `rect` - Pointers to Pointer of <b>OH_Drawing_Rect</b> object, returned to the caller.
337    ///
338    /// # Returns
339    ///
340    /// * Returns the error code.
341    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
342    /// Returns [`OH_DRAWING_ERROR_INVALID_PARAMETER`] if rectArray or rect is nullptr,
343    /// or index is valid.
344    ///
345    /// Available since API-level: 18
346    ///
347    /// Version: 1.0
348    #[cfg(feature = "api-18")]
349    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
350    pub fn OH_Drawing_RectGetArrayElement(
351        rectArray: *mut OH_Drawing_Array,
352        index: usize,
353        rect: *mut *mut OH_Drawing_Rect,
354    ) -> crate::error_code::DrawingResult;
355    /// Destroys an array <b>OH_Drawing_Rect</b> object and reclaims the memory occupied by the object.
356    ///
357    ///
358    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
359    /// # Arguments
360    ///
361    /// * `rectArray` - Indicates the pointer to an <b>OH_Drawing_Array</b> object.
362    ///
363    /// # Returns
364    ///
365    /// * Returns the error code.
366    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
367    /// Returns [`OH_DRAWING_ERROR_INVALID_PARAMETER`] if rectArray is nullptr.
368    ///
369    /// Available since API-level: 18
370    ///
371    /// Version: 1.0
372    #[cfg(feature = "api-18")]
373    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
374    pub fn OH_Drawing_RectDestroyArray(
375        rectArray: *mut OH_Drawing_Array,
376    ) -> crate::error_code::DrawingResult;
377    /// Determine whether one <b>OH_Drawing_Rect</b> object totally contains another <b>OH_Drawing_Rect</b> object.
378    ///
379    /// # Arguments
380    ///
381    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
382    ///
383    /// * `other` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
384    ///
385    /// * `isContains` - Indicates whether rect totally contains other.
386    ///
387    /// # Returns
388    ///
389    /// * Returns the error code.
390    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
391    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect, other or isContains is nullptr.
392    ///
393    /// Available since API-level: 22
394    ///
395    /// Version: 1.0
396    #[cfg(feature = "api-22")]
397    #[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
398    pub fn OH_Drawing_RectContains(
399        rect: *mut OH_Drawing_Rect,
400        other: *const OH_Drawing_Rect,
401        isContains: *mut bool,
402    ) -> crate::error_code::DrawingResult;
403    /// Add the specified values to the left and top boundaried of an <b>OH_Drawing_Rect</b> object.
404    ///
405    /// # Arguments
406    ///
407    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
408    ///
409    /// * `left` - Indicates the value added to the left boundary of an <b>OH_Drawing_Rect</b> object.
410    ///
411    /// * `top` - Indicates the value added to the top boundary of an <b>OH_Drawing_Rect</b> object.
412    ///
413    /// * `right` - Indicates the value added to the right boundary of an <b>OH_Drawing_Rect</b> object.
414    ///
415    /// * `bottom` - Indicates the value added to the bottom boundary of an <b>OH_Drawing_Rect</b> object.
416    ///
417    /// # Returns
418    ///
419    /// * Returns the error code.
420    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
421    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect is nullptr.
422    ///
423    /// Available since API-level: 22
424    ///
425    /// Version: 1.0
426    #[cfg(feature = "api-22")]
427    #[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
428    pub fn OH_Drawing_RectInset(
429        rect: *mut OH_Drawing_Rect,
430        left: f32,
431        top: f32,
432        right: f32,
433        bottom: f32,
434    ) -> crate::error_code::DrawingResult;
435    /// Checks if rect is empty.
436    ///
437    /// # Arguments
438    ///
439    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
440    ///
441    /// * `isEmpty` - Indicates whether rect is empty.
442    ///
443    /// # Returns
444    ///
445    /// * Returns the error code.
446    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
447    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect or isEmpty is nullptr.
448    ///
449    /// Available since API-level: 23
450    #[cfg(feature = "api-23")]
451    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
452    pub fn OH_Drawing_RectIsEmpty(
453        rect: *const OH_Drawing_Rect,
454        isEmpty: *mut bool,
455    ) -> crate::error_code::DrawingResult;
456    /// Offsets rect by adding dx to its left and right coordinates, and adding dy to its top and bottom
457    /// coordinates.
458    ///
459    /// # Arguments
460    ///
461    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
462    ///
463    /// * `dx` - Indicates the distance to offset on the x-axis in pixels.
464    ///
465    /// * `dy` - Indicates the distance to offset on the y-axis in pixels.
466    ///
467    /// # Returns
468    ///
469    /// * Returns the error code.
470    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
471    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect is nullptr.
472    ///
473    /// Available since API-level: 23
474    #[cfg(feature = "api-23")]
475    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
476    pub fn OH_Drawing_RectOffset(
477        rect: *mut OH_Drawing_Rect,
478        dx: f32,
479        dy: f32,
480    ) -> crate::error_code::DrawingResult;
481    /// Offsets rect to a specific position and keeps the width and height unchanged.
482    ///
483    /// # Arguments
484    ///
485    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
486    ///
487    /// * `newLeft` - Indicates the new left coordinate.
488    ///
489    /// * `newTop` - Indicates the new top coordinate.
490    ///
491    /// # Returns
492    ///
493    /// * Returns the error code.
494    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
495    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect is nullptr.
496    ///
497    /// Available since API-level: 23
498    #[cfg(feature = "api-23")]
499    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
500    pub fn OH_Drawing_RectOffsetTo(
501        rect: *mut OH_Drawing_Rect,
502        newLeft: f32,
503        newTop: f32,
504    ) -> crate::error_code::DrawingResult;
505    /// Sets the boundary coordinates of rect to zero.
506    ///
507    /// # Arguments
508    ///
509    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
510    ///
511    /// # Returns
512    ///
513    /// * Returns the error code.
514    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
515    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect is nullptr.
516    ///
517    /// Available since API-level: 23
518    #[cfg(feature = "api-23")]
519    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
520    pub fn OH_Drawing_RectSetEmpty(rect: *mut OH_Drawing_Rect) -> crate::error_code::DrawingResult;
521    /// Swaps the left and right if the left is greater than right; and swaps top and bottom if the top is greater
522    /// than bottom. If the edges are already valid, then nothing is done.
523    ///
524    /// # Arguments
525    ///
526    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
527    ///
528    /// # Returns
529    ///
530    /// * Returns the error code.
531    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
532    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect is nullptr.
533    ///
534    /// Available since API-level: 23
535    #[cfg(feature = "api-23")]
536    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
537    pub fn OH_Drawing_RectSort(rect: *mut OH_Drawing_Rect) -> crate::error_code::DrawingResult;
538    /// Sets rect to the union of itself and another.
539    ///
540    /// # Arguments
541    ///
542    /// * `rect` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
543    ///
544    /// * `other` - Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
545    ///
546    /// # Returns
547    ///
548    /// * Returns the error code.
549    /// Returns [`OH_DRAWING_SUCCESS`] if the operation is successful.
550    /// Returns [`OH_DRAWING_ERROR_INCORRECT_PARAMETER`] if rect or other is nullptr.
551    ///
552    /// Available since API-level: 23
553    #[cfg(feature = "api-23")]
554    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
555    pub fn OH_Drawing_RectUnion(
556        rect: *mut OH_Drawing_Rect,
557        other: *const OH_Drawing_Rect,
558    ) -> crate::error_code::DrawingResult;
559}