objc2_core_graphics/generated/
CGGeometry.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2_core_foundation::*;
6
7use crate::*;
8
9extern "C" {
10    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpointzero?language=objc)
11    pub static CGPointZero: CGPoint;
12}
13
14extern "C" {
15    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgsizezero?language=objc)
16    pub static CGSizeZero: CGSize;
17}
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgrectzero?language=objc)
21    pub static CGRectZero: CGRect;
22}
23
24extern "C" {
25    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgrectnull?language=objc)
26    pub static CGRectNull: CGRect;
27}
28
29extern "C" {
30    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgrectinfinite?language=objc)
31    pub static CGRectInfinite: CGRect;
32}
33
34// TODO: pub fn CGPointMake(x: CGFloat,y: CGFloat,) -> CGPoint;
35
36// TODO: pub fn CGSizeMake(width: CGFloat,height: CGFloat,) -> CGSize;
37
38// TODO: pub fn CGVectorMake(dx: CGFloat,dy: CGFloat,) -> CGVector;
39
40// TODO: pub fn CGRectMake(x: CGFloat,y: CGFloat,width: CGFloat,height: CGFloat,) -> CGRect;
41
42#[inline]
43pub extern "C-unwind" fn CGRectGetMinX(rect: CGRect) -> CGFloat {
44    extern "C-unwind" {
45        fn CGRectGetMinX(rect: CGRect) -> CGFloat;
46    }
47    unsafe { CGRectGetMinX(rect) }
48}
49
50#[inline]
51pub extern "C-unwind" fn CGRectGetMidX(rect: CGRect) -> CGFloat {
52    extern "C-unwind" {
53        fn CGRectGetMidX(rect: CGRect) -> CGFloat;
54    }
55    unsafe { CGRectGetMidX(rect) }
56}
57
58#[inline]
59pub extern "C-unwind" fn CGRectGetMaxX(rect: CGRect) -> CGFloat {
60    extern "C-unwind" {
61        fn CGRectGetMaxX(rect: CGRect) -> CGFloat;
62    }
63    unsafe { CGRectGetMaxX(rect) }
64}
65
66#[inline]
67pub extern "C-unwind" fn CGRectGetMinY(rect: CGRect) -> CGFloat {
68    extern "C-unwind" {
69        fn CGRectGetMinY(rect: CGRect) -> CGFloat;
70    }
71    unsafe { CGRectGetMinY(rect) }
72}
73
74#[inline]
75pub extern "C-unwind" fn CGRectGetMidY(rect: CGRect) -> CGFloat {
76    extern "C-unwind" {
77        fn CGRectGetMidY(rect: CGRect) -> CGFloat;
78    }
79    unsafe { CGRectGetMidY(rect) }
80}
81
82#[inline]
83pub extern "C-unwind" fn CGRectGetMaxY(rect: CGRect) -> CGFloat {
84    extern "C-unwind" {
85        fn CGRectGetMaxY(rect: CGRect) -> CGFloat;
86    }
87    unsafe { CGRectGetMaxY(rect) }
88}
89
90#[inline]
91pub extern "C-unwind" fn CGRectGetWidth(rect: CGRect) -> CGFloat {
92    extern "C-unwind" {
93        fn CGRectGetWidth(rect: CGRect) -> CGFloat;
94    }
95    unsafe { CGRectGetWidth(rect) }
96}
97
98#[inline]
99pub extern "C-unwind" fn CGRectGetHeight(rect: CGRect) -> CGFloat {
100    extern "C-unwind" {
101        fn CGRectGetHeight(rect: CGRect) -> CGFloat;
102    }
103    unsafe { CGRectGetHeight(rect) }
104}
105
106#[inline]
107pub extern "C-unwind" fn CGPointEqualToPoint(point1: CGPoint, point2: CGPoint) -> bool {
108    extern "C-unwind" {
109        fn CGPointEqualToPoint(point1: CGPoint, point2: CGPoint) -> bool;
110    }
111    unsafe { CGPointEqualToPoint(point1, point2) }
112}
113
114#[inline]
115pub extern "C-unwind" fn CGSizeEqualToSize(size1: CGSize, size2: CGSize) -> bool {
116    extern "C-unwind" {
117        fn CGSizeEqualToSize(size1: CGSize, size2: CGSize) -> bool;
118    }
119    unsafe { CGSizeEqualToSize(size1, size2) }
120}
121
122#[inline]
123pub extern "C-unwind" fn CGRectEqualToRect(rect1: CGRect, rect2: CGRect) -> bool {
124    extern "C-unwind" {
125        fn CGRectEqualToRect(rect1: CGRect, rect2: CGRect) -> bool;
126    }
127    unsafe { CGRectEqualToRect(rect1, rect2) }
128}
129
130#[must_use]
131#[inline]
132pub extern "C-unwind" fn CGRectStandardize(rect: CGRect) -> CGRect {
133    extern "C-unwind" {
134        fn CGRectStandardize(rect: CGRect) -> CGRect;
135    }
136    unsafe { CGRectStandardize(rect) }
137}
138
139#[inline]
140pub extern "C-unwind" fn CGRectIsEmpty(rect: CGRect) -> bool {
141    extern "C-unwind" {
142        fn CGRectIsEmpty(rect: CGRect) -> bool;
143    }
144    unsafe { CGRectIsEmpty(rect) }
145}
146
147#[inline]
148pub extern "C-unwind" fn CGRectIsNull(rect: CGRect) -> bool {
149    extern "C-unwind" {
150        fn CGRectIsNull(rect: CGRect) -> bool;
151    }
152    unsafe { CGRectIsNull(rect) }
153}
154
155#[inline]
156pub extern "C-unwind" fn CGRectIsInfinite(rect: CGRect) -> bool {
157    extern "C-unwind" {
158        fn CGRectIsInfinite(rect: CGRect) -> bool;
159    }
160    unsafe { CGRectIsInfinite(rect) }
161}
162
163#[must_use]
164#[inline]
165pub extern "C-unwind" fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect {
166    extern "C-unwind" {
167        fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect;
168    }
169    unsafe { CGRectInset(rect, dx, dy) }
170}
171
172#[must_use]
173#[inline]
174pub extern "C-unwind" fn CGRectIntegral(rect: CGRect) -> CGRect {
175    extern "C-unwind" {
176        fn CGRectIntegral(rect: CGRect) -> CGRect;
177    }
178    unsafe { CGRectIntegral(rect) }
179}
180
181#[must_use]
182#[inline]
183pub extern "C-unwind" fn CGRectUnion(r1: CGRect, r2: CGRect) -> CGRect {
184    extern "C-unwind" {
185        fn CGRectUnion(r1: CGRect, r2: CGRect) -> CGRect;
186    }
187    unsafe { CGRectUnion(r1, r2) }
188}
189
190#[must_use]
191#[inline]
192pub extern "C-unwind" fn CGRectIntersection(r1: CGRect, r2: CGRect) -> CGRect {
193    extern "C-unwind" {
194        fn CGRectIntersection(r1: CGRect, r2: CGRect) -> CGRect;
195    }
196    unsafe { CGRectIntersection(r1, r2) }
197}
198
199#[must_use]
200#[inline]
201pub extern "C-unwind" fn CGRectOffset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect {
202    extern "C-unwind" {
203        fn CGRectOffset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect;
204    }
205    unsafe { CGRectOffset(rect, dx, dy) }
206}
207
208extern "C-unwind" {
209    /// # Safety
210    ///
211    /// - `slice` must be a valid pointer.
212    /// - `remainder` must be a valid pointer.
213    pub fn CGRectDivide(
214        rect: CGRect,
215        slice: NonNull<CGRect>,
216        remainder: NonNull<CGRect>,
217        amount: CGFloat,
218        edge: CGRectEdge,
219    );
220}
221
222#[inline]
223pub extern "C-unwind" fn CGRectContainsPoint(rect: CGRect, point: CGPoint) -> bool {
224    extern "C-unwind" {
225        fn CGRectContainsPoint(rect: CGRect, point: CGPoint) -> bool;
226    }
227    unsafe { CGRectContainsPoint(rect, point) }
228}
229
230#[inline]
231pub extern "C-unwind" fn CGRectContainsRect(rect1: CGRect, rect2: CGRect) -> bool {
232    extern "C-unwind" {
233        fn CGRectContainsRect(rect1: CGRect, rect2: CGRect) -> bool;
234    }
235    unsafe { CGRectContainsRect(rect1, rect2) }
236}
237
238#[inline]
239pub extern "C-unwind" fn CGRectIntersectsRect(rect1: CGRect, rect2: CGRect) -> bool {
240    extern "C-unwind" {
241        fn CGRectIntersectsRect(rect1: CGRect, rect2: CGRect) -> bool;
242    }
243    unsafe { CGRectIntersectsRect(rect1, rect2) }
244}
245
246/// * Persistent representations. **
247#[inline]
248pub extern "C-unwind" fn CGPointCreateDictionaryRepresentation(
249    point: CGPoint,
250) -> CFRetained<CFDictionary> {
251    extern "C-unwind" {
252        fn CGPointCreateDictionaryRepresentation(point: CGPoint) -> Option<NonNull<CFDictionary>>;
253    }
254    let ret = unsafe { CGPointCreateDictionaryRepresentation(point) };
255    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
256    unsafe { CFRetained::from_raw(ret) }
257}
258
259extern "C-unwind" {
260    /// # Safety
261    ///
262    /// - `dict` generics must be of the correct type.
263    /// - `point` must be a valid pointer or null.
264    pub fn CGPointMakeWithDictionaryRepresentation(
265        dict: Option<&CFDictionary>,
266        point: *mut CGPoint,
267    ) -> bool;
268}
269
270#[inline]
271pub extern "C-unwind" fn CGSizeCreateDictionaryRepresentation(
272    size: CGSize,
273) -> CFRetained<CFDictionary> {
274    extern "C-unwind" {
275        fn CGSizeCreateDictionaryRepresentation(size: CGSize) -> Option<NonNull<CFDictionary>>;
276    }
277    let ret = unsafe { CGSizeCreateDictionaryRepresentation(size) };
278    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
279    unsafe { CFRetained::from_raw(ret) }
280}
281
282extern "C-unwind" {
283    /// # Safety
284    ///
285    /// - `dict` generics must be of the correct type.
286    /// - `size` must be a valid pointer or null.
287    pub fn CGSizeMakeWithDictionaryRepresentation(
288        dict: Option<&CFDictionary>,
289        size: *mut CGSize,
290    ) -> bool;
291}
292
293#[inline]
294pub extern "C-unwind" fn CGRectCreateDictionaryRepresentation(
295    param1: CGRect,
296) -> CFRetained<CFDictionary> {
297    extern "C-unwind" {
298        fn CGRectCreateDictionaryRepresentation(param1: CGRect) -> Option<NonNull<CFDictionary>>;
299    }
300    let ret = unsafe { CGRectCreateDictionaryRepresentation(param1) };
301    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
302    unsafe { CFRetained::from_raw(ret) }
303}
304
305extern "C-unwind" {
306    /// # Safety
307    ///
308    /// - `dict` generics must be of the correct type.
309    /// - `rect` must be a valid pointer or null.
310    pub fn CGRectMakeWithDictionaryRepresentation(
311        dict: Option<&CFDictionary>,
312        rect: *mut CGRect,
313    ) -> bool;
314}
315
316// TODO: pub fn CGPointMake(x: CGFloat,y: CGFloat,) -> CGPoint;
317
318// TODO: pub fn CGSizeMake(width: CGFloat,height: CGFloat,) -> CGSize;
319
320// TODO: pub fn CGVectorMake(dx: CGFloat,dy: CGFloat,) -> CGVector;
321
322// TODO: pub fn CGRectMake(x: CGFloat,y: CGFloat,width: CGFloat,height: CGFloat,) -> CGRect;
323
324// TODO: pub fn __CGPointEqualToPoint(point1: CGPoint,point2: CGPoint,) -> bool;
325
326// TODO: pub fn __CGSizeEqualToSize(size1: CGSize,size2: CGSize,) -> bool;