1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13#[doc(alias = "CGMutablePathRef")]
15#[repr(C)]
16pub struct CGMutablePath {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 unsafe impl CGMutablePath: CGPath {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"CGPath"> for CGMutablePath {}
27);
28
29#[doc(alias = "CGPathRef")]
31#[repr(C)]
32pub struct CGPath {
33 inner: [u8; 0],
34 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
35}
36
37cf_type!(
38 unsafe impl CGPath {}
39);
40#[cfg(feature = "objc2")]
41cf_objc2_type!(
42 unsafe impl RefEncode<"CGPath"> for CGPath {}
43);
44
45#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct CGLineJoin(pub i32);
50impl CGLineJoin {
51 #[doc(alias = "kCGLineJoinMiter")]
52 pub const Miter: Self = Self(0);
53 #[doc(alias = "kCGLineJoinRound")]
54 pub const Round: Self = Self(1);
55 #[doc(alias = "kCGLineJoinBevel")]
56 pub const Bevel: Self = Self(2);
57}
58
59#[cfg(feature = "objc2")]
60unsafe impl Encode for CGLineJoin {
61 const ENCODING: Encoding = i32::ENCODING;
62}
63
64#[cfg(feature = "objc2")]
65unsafe impl RefEncode for CGLineJoin {
66 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
67}
68
69#[repr(transparent)]
72#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
73pub struct CGLineCap(pub i32);
74impl CGLineCap {
75 #[doc(alias = "kCGLineCapButt")]
76 pub const Butt: Self = Self(0);
77 #[doc(alias = "kCGLineCapRound")]
78 pub const Round: Self = Self(1);
79 #[doc(alias = "kCGLineCapSquare")]
80 pub const Square: Self = Self(2);
81}
82
83#[cfg(feature = "objc2")]
84unsafe impl Encode for CGLineCap {
85 const ENCODING: Encoding = i32::ENCODING;
86}
87
88#[cfg(feature = "objc2")]
89unsafe impl RefEncode for CGLineCap {
90 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
91}
92
93unsafe impl ConcreteType for CGPath {
94 #[doc(alias = "CGPathGetTypeID")]
95 #[inline]
96 fn type_id() -> CFTypeID {
97 extern "C-unwind" {
98 fn CGPathGetTypeID() -> CFTypeID;
99 }
100 unsafe { CGPathGetTypeID() }
101 }
102}
103
104impl CGMutablePath {
105 #[doc(alias = "CGPathCreateMutable")]
106 #[inline]
107 pub fn new() -> CFRetained<CGMutablePath> {
108 extern "C-unwind" {
109 fn CGPathCreateMutable() -> Option<NonNull<CGMutablePath>>;
110 }
111 let ret = unsafe { CGPathCreateMutable() };
112 let ret =
113 ret.expect("function was marked as returning non-null, but actually returned NULL");
114 unsafe { CFRetained::from_raw(ret) }
115 }
116}
117
118impl CGPath {
119 #[doc(alias = "CGPathCreateCopy")]
120 #[inline]
121 pub fn new_copy(path: Option<&CGPath>) -> Option<CFRetained<CGPath>> {
122 extern "C-unwind" {
123 fn CGPathCreateCopy(path: Option<&CGPath>) -> Option<NonNull<CGPath>>;
124 }
125 let ret = unsafe { CGPathCreateCopy(path) };
126 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
127 }
128
129 #[doc(alias = "CGPathCreateCopyByTransformingPath")]
133 #[inline]
134 pub unsafe fn new_copy_by_transforming_path(
135 path: Option<&CGPath>,
136 transform: *const CGAffineTransform,
137 ) -> Option<CFRetained<CGPath>> {
138 extern "C-unwind" {
139 fn CGPathCreateCopyByTransformingPath(
140 path: Option<&CGPath>,
141 transform: *const CGAffineTransform,
142 ) -> Option<NonNull<CGPath>>;
143 }
144 let ret = unsafe { CGPathCreateCopyByTransformingPath(path, transform) };
145 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
146 }
147}
148
149impl CGMutablePath {
150 #[doc(alias = "CGPathCreateMutableCopy")]
151 #[inline]
152 pub fn new_copy(path: Option<&CGPath>) -> Option<CFRetained<CGMutablePath>> {
153 extern "C-unwind" {
154 fn CGPathCreateMutableCopy(path: Option<&CGPath>) -> Option<NonNull<CGMutablePath>>;
155 }
156 let ret = unsafe { CGPathCreateMutableCopy(path) };
157 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
158 }
159
160 #[doc(alias = "CGPathCreateMutableCopyByTransformingPath")]
164 #[inline]
165 pub unsafe fn new_copy_by_transforming_path(
166 path: Option<&CGPath>,
167 transform: *const CGAffineTransform,
168 ) -> Option<CFRetained<CGMutablePath>> {
169 extern "C-unwind" {
170 fn CGPathCreateMutableCopyByTransformingPath(
171 path: Option<&CGPath>,
172 transform: *const CGAffineTransform,
173 ) -> Option<NonNull<CGMutablePath>>;
174 }
175 let ret = unsafe { CGPathCreateMutableCopyByTransformingPath(path, transform) };
176 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
177 }
178}
179
180impl CGPath {
181 #[doc(alias = "CGPathCreateWithRect")]
185 #[inline]
186 pub unsafe fn with_rect(
187 rect: CGRect,
188 transform: *const CGAffineTransform,
189 ) -> CFRetained<CGPath> {
190 extern "C-unwind" {
191 fn CGPathCreateWithRect(
192 rect: CGRect,
193 transform: *const CGAffineTransform,
194 ) -> Option<NonNull<CGPath>>;
195 }
196 let ret = unsafe { CGPathCreateWithRect(rect, transform) };
197 let ret =
198 ret.expect("function was marked as returning non-null, but actually returned NULL");
199 unsafe { CFRetained::from_raw(ret) }
200 }
201
202 #[doc(alias = "CGPathCreateWithEllipseInRect")]
206 #[inline]
207 pub unsafe fn with_ellipse_in_rect(
208 rect: CGRect,
209 transform: *const CGAffineTransform,
210 ) -> CFRetained<CGPath> {
211 extern "C-unwind" {
212 fn CGPathCreateWithEllipseInRect(
213 rect: CGRect,
214 transform: *const CGAffineTransform,
215 ) -> Option<NonNull<CGPath>>;
216 }
217 let ret = unsafe { CGPathCreateWithEllipseInRect(rect, transform) };
218 let ret =
219 ret.expect("function was marked as returning non-null, but actually returned NULL");
220 unsafe { CFRetained::from_raw(ret) }
221 }
222
223 #[doc(alias = "CGPathCreateWithRoundedRect")]
227 #[inline]
228 pub unsafe fn with_rounded_rect(
229 rect: CGRect,
230 corner_width: CGFloat,
231 corner_height: CGFloat,
232 transform: *const CGAffineTransform,
233 ) -> CFRetained<CGPath> {
234 extern "C-unwind" {
235 fn CGPathCreateWithRoundedRect(
236 rect: CGRect,
237 corner_width: CGFloat,
238 corner_height: CGFloat,
239 transform: *const CGAffineTransform,
240 ) -> Option<NonNull<CGPath>>;
241 }
242 let ret =
243 unsafe { CGPathCreateWithRoundedRect(rect, corner_width, corner_height, transform) };
244 let ret =
245 ret.expect("function was marked as returning non-null, but actually returned NULL");
246 unsafe { CFRetained::from_raw(ret) }
247 }
248}
249
250impl CGMutablePath {
251 #[doc(alias = "CGPathAddRoundedRect")]
255 #[inline]
256 pub unsafe fn add_rounded_rect(
257 path: Option<&CGMutablePath>,
258 transform: *const CGAffineTransform,
259 rect: CGRect,
260 corner_width: CGFloat,
261 corner_height: CGFloat,
262 ) {
263 extern "C-unwind" {
264 fn CGPathAddRoundedRect(
265 path: Option<&CGMutablePath>,
266 transform: *const CGAffineTransform,
267 rect: CGRect,
268 corner_width: CGFloat,
269 corner_height: CGFloat,
270 );
271 }
272 unsafe { CGPathAddRoundedRect(path, transform, rect, corner_width, corner_height) }
273 }
274}
275
276impl CGPath {
277 #[doc(alias = "CGPathCreateCopyByDashingPath")]
282 #[inline]
283 pub unsafe fn new_copy_by_dashing_path(
284 path: Option<&CGPath>,
285 transform: *const CGAffineTransform,
286 phase: CGFloat,
287 lengths: *const CGFloat,
288 count: usize,
289 ) -> Option<CFRetained<CGPath>> {
290 extern "C-unwind" {
291 fn CGPathCreateCopyByDashingPath(
292 path: Option<&CGPath>,
293 transform: *const CGAffineTransform,
294 phase: CGFloat,
295 lengths: *const CGFloat,
296 count: usize,
297 ) -> Option<NonNull<CGPath>>;
298 }
299 let ret = unsafe { CGPathCreateCopyByDashingPath(path, transform, phase, lengths, count) };
300 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
301 }
302
303 #[doc(alias = "CGPathCreateCopyByStrokingPath")]
307 #[inline]
308 pub unsafe fn new_copy_by_stroking_path(
309 path: Option<&CGPath>,
310 transform: *const CGAffineTransform,
311 line_width: CGFloat,
312 line_cap: CGLineCap,
313 line_join: CGLineJoin,
314 miter_limit: CGFloat,
315 ) -> Option<CFRetained<CGPath>> {
316 extern "C-unwind" {
317 fn CGPathCreateCopyByStrokingPath(
318 path: Option<&CGPath>,
319 transform: *const CGAffineTransform,
320 line_width: CGFloat,
321 line_cap: CGLineCap,
322 line_join: CGLineJoin,
323 miter_limit: CGFloat,
324 ) -> Option<NonNull<CGPath>>;
325 }
326 let ret = unsafe {
327 CGPathCreateCopyByStrokingPath(
328 path,
329 transform,
330 line_width,
331 line_cap,
332 line_join,
333 miter_limit,
334 )
335 };
336 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
337 }
338
339 #[doc(alias = "CGPathEqualToPath")]
340 #[inline]
341 pub fn equal_to_path(path1: Option<&CGPath>, path2: Option<&CGPath>) -> bool {
342 extern "C-unwind" {
343 fn CGPathEqualToPath(path1: Option<&CGPath>, path2: Option<&CGPath>) -> bool;
344 }
345 unsafe { CGPathEqualToPath(path1, path2) }
346 }
347}
348
349impl CGMutablePath {
350 #[doc(alias = "CGPathMoveToPoint")]
356 #[inline]
357 pub unsafe fn move_to_point(
358 path: Option<&CGMutablePath>,
359 m: *const CGAffineTransform,
360 x: CGFloat,
361 y: CGFloat,
362 ) {
363 extern "C-unwind" {
364 fn CGPathMoveToPoint(
365 path: Option<&CGMutablePath>,
366 m: *const CGAffineTransform,
367 x: CGFloat,
368 y: CGFloat,
369 );
370 }
371 unsafe { CGPathMoveToPoint(path, m, x, y) }
372 }
373
374 #[doc(alias = "CGPathAddLineToPoint")]
378 #[inline]
379 pub unsafe fn add_line_to_point(
380 path: Option<&CGMutablePath>,
381 m: *const CGAffineTransform,
382 x: CGFloat,
383 y: CGFloat,
384 ) {
385 extern "C-unwind" {
386 fn CGPathAddLineToPoint(
387 path: Option<&CGMutablePath>,
388 m: *const CGAffineTransform,
389 x: CGFloat,
390 y: CGFloat,
391 );
392 }
393 unsafe { CGPathAddLineToPoint(path, m, x, y) }
394 }
395
396 #[doc(alias = "CGPathAddQuadCurveToPoint")]
400 #[inline]
401 pub unsafe fn add_quad_curve_to_point(
402 path: Option<&CGMutablePath>,
403 m: *const CGAffineTransform,
404 cpx: CGFloat,
405 cpy: CGFloat,
406 x: CGFloat,
407 y: CGFloat,
408 ) {
409 extern "C-unwind" {
410 fn CGPathAddQuadCurveToPoint(
411 path: Option<&CGMutablePath>,
412 m: *const CGAffineTransform,
413 cpx: CGFloat,
414 cpy: CGFloat,
415 x: CGFloat,
416 y: CGFloat,
417 );
418 }
419 unsafe { CGPathAddQuadCurveToPoint(path, m, cpx, cpy, x, y) }
420 }
421
422 #[doc(alias = "CGPathAddCurveToPoint")]
426 #[inline]
427 pub unsafe fn add_curve_to_point(
428 path: Option<&CGMutablePath>,
429 m: *const CGAffineTransform,
430 cp1x: CGFloat,
431 cp1y: CGFloat,
432 cp2x: CGFloat,
433 cp2y: CGFloat,
434 x: CGFloat,
435 y: CGFloat,
436 ) {
437 extern "C-unwind" {
438 fn CGPathAddCurveToPoint(
439 path: Option<&CGMutablePath>,
440 m: *const CGAffineTransform,
441 cp1x: CGFloat,
442 cp1y: CGFloat,
443 cp2x: CGFloat,
444 cp2y: CGFloat,
445 x: CGFloat,
446 y: CGFloat,
447 );
448 }
449 unsafe { CGPathAddCurveToPoint(path, m, cp1x, cp1y, cp2x, cp2y, x, y) }
450 }
451
452 #[doc(alias = "CGPathCloseSubpath")]
453 #[inline]
454 pub fn close_subpath(path: Option<&CGMutablePath>) {
455 extern "C-unwind" {
456 fn CGPathCloseSubpath(path: Option<&CGMutablePath>);
457 }
458 unsafe { CGPathCloseSubpath(path) }
459 }
460
461 #[doc(alias = "CGPathAddRect")]
467 #[inline]
468 pub unsafe fn add_rect(
469 path: Option<&CGMutablePath>,
470 m: *const CGAffineTransform,
471 rect: CGRect,
472 ) {
473 extern "C-unwind" {
474 fn CGPathAddRect(
475 path: Option<&CGMutablePath>,
476 m: *const CGAffineTransform,
477 rect: CGRect,
478 );
479 }
480 unsafe { CGPathAddRect(path, m, rect) }
481 }
482
483 #[doc(alias = "CGPathAddRects")]
488 #[inline]
489 pub unsafe fn add_rects(
490 path: Option<&CGMutablePath>,
491 m: *const CGAffineTransform,
492 rects: *const CGRect,
493 count: usize,
494 ) {
495 extern "C-unwind" {
496 fn CGPathAddRects(
497 path: Option<&CGMutablePath>,
498 m: *const CGAffineTransform,
499 rects: *const CGRect,
500 count: usize,
501 );
502 }
503 unsafe { CGPathAddRects(path, m, rects, count) }
504 }
505
506 #[doc(alias = "CGPathAddLines")]
511 #[inline]
512 pub unsafe fn add_lines(
513 path: Option<&CGMutablePath>,
514 m: *const CGAffineTransform,
515 points: *const CGPoint,
516 count: usize,
517 ) {
518 extern "C-unwind" {
519 fn CGPathAddLines(
520 path: Option<&CGMutablePath>,
521 m: *const CGAffineTransform,
522 points: *const CGPoint,
523 count: usize,
524 );
525 }
526 unsafe { CGPathAddLines(path, m, points, count) }
527 }
528
529 #[doc(alias = "CGPathAddEllipseInRect")]
533 #[inline]
534 pub unsafe fn add_ellipse_in_rect(
535 path: Option<&CGMutablePath>,
536 m: *const CGAffineTransform,
537 rect: CGRect,
538 ) {
539 extern "C-unwind" {
540 fn CGPathAddEllipseInRect(
541 path: Option<&CGMutablePath>,
542 m: *const CGAffineTransform,
543 rect: CGRect,
544 );
545 }
546 unsafe { CGPathAddEllipseInRect(path, m, rect) }
547 }
548
549 #[doc(alias = "CGPathAddRelativeArc")]
553 #[inline]
554 pub unsafe fn add_relative_arc(
555 path: Option<&CGMutablePath>,
556 matrix: *const CGAffineTransform,
557 x: CGFloat,
558 y: CGFloat,
559 radius: CGFloat,
560 start_angle: CGFloat,
561 delta: CGFloat,
562 ) {
563 extern "C-unwind" {
564 fn CGPathAddRelativeArc(
565 path: Option<&CGMutablePath>,
566 matrix: *const CGAffineTransform,
567 x: CGFloat,
568 y: CGFloat,
569 radius: CGFloat,
570 start_angle: CGFloat,
571 delta: CGFloat,
572 );
573 }
574 unsafe { CGPathAddRelativeArc(path, matrix, x, y, radius, start_angle, delta) }
575 }
576
577 #[doc(alias = "CGPathAddArc")]
581 #[inline]
582 pub unsafe fn add_arc(
583 path: Option<&CGMutablePath>,
584 m: *const CGAffineTransform,
585 x: CGFloat,
586 y: CGFloat,
587 radius: CGFloat,
588 start_angle: CGFloat,
589 end_angle: CGFloat,
590 clockwise: bool,
591 ) {
592 extern "C-unwind" {
593 fn CGPathAddArc(
594 path: Option<&CGMutablePath>,
595 m: *const CGAffineTransform,
596 x: CGFloat,
597 y: CGFloat,
598 radius: CGFloat,
599 start_angle: CGFloat,
600 end_angle: CGFloat,
601 clockwise: bool,
602 );
603 }
604 unsafe { CGPathAddArc(path, m, x, y, radius, start_angle, end_angle, clockwise) }
605 }
606
607 #[doc(alias = "CGPathAddArcToPoint")]
611 #[inline]
612 pub unsafe fn add_arc_to_point(
613 path: Option<&CGMutablePath>,
614 m: *const CGAffineTransform,
615 x1: CGFloat,
616 y1: CGFloat,
617 x2: CGFloat,
618 y2: CGFloat,
619 radius: CGFloat,
620 ) {
621 extern "C-unwind" {
622 fn CGPathAddArcToPoint(
623 path: Option<&CGMutablePath>,
624 m: *const CGAffineTransform,
625 x1: CGFloat,
626 y1: CGFloat,
627 x2: CGFloat,
628 y2: CGFloat,
629 radius: CGFloat,
630 );
631 }
632 unsafe { CGPathAddArcToPoint(path, m, x1, y1, x2, y2, radius) }
633 }
634
635 #[doc(alias = "CGPathAddPath")]
639 #[inline]
640 pub unsafe fn add_path(
641 path1: Option<&CGMutablePath>,
642 m: *const CGAffineTransform,
643 path2: Option<&CGPath>,
644 ) {
645 extern "C-unwind" {
646 fn CGPathAddPath(
647 path1: Option<&CGMutablePath>,
648 m: *const CGAffineTransform,
649 path2: Option<&CGPath>,
650 );
651 }
652 unsafe { CGPathAddPath(path1, m, path2) }
653 }
654}
655
656impl CGPath {
657 #[doc(alias = "CGPathIsEmpty")]
659 #[inline]
660 pub fn is_empty(path: Option<&CGPath>) -> bool {
661 extern "C-unwind" {
662 fn CGPathIsEmpty(path: Option<&CGPath>) -> bool;
663 }
664 unsafe { CGPathIsEmpty(path) }
665 }
666
667 #[doc(alias = "CGPathIsRect")]
671 #[inline]
672 pub unsafe fn is_rect(path: Option<&CGPath>, rect: *mut CGRect) -> bool {
673 extern "C-unwind" {
674 fn CGPathIsRect(path: Option<&CGPath>, rect: *mut CGRect) -> bool;
675 }
676 unsafe { CGPathIsRect(path, rect) }
677 }
678
679 #[doc(alias = "CGPathGetCurrentPoint")]
680 #[inline]
681 pub fn current_point(path: Option<&CGPath>) -> CGPoint {
682 extern "C-unwind" {
683 fn CGPathGetCurrentPoint(path: Option<&CGPath>) -> CGPoint;
684 }
685 unsafe { CGPathGetCurrentPoint(path) }
686 }
687
688 #[doc(alias = "CGPathGetBoundingBox")]
689 #[inline]
690 pub fn bounding_box(path: Option<&CGPath>) -> CGRect {
691 extern "C-unwind" {
692 fn CGPathGetBoundingBox(path: Option<&CGPath>) -> CGRect;
693 }
694 unsafe { CGPathGetBoundingBox(path) }
695 }
696
697 #[doc(alias = "CGPathGetPathBoundingBox")]
698 #[inline]
699 pub fn path_bounding_box(path: Option<&CGPath>) -> CGRect {
700 extern "C-unwind" {
701 fn CGPathGetPathBoundingBox(path: Option<&CGPath>) -> CGRect;
702 }
703 unsafe { CGPathGetPathBoundingBox(path) }
704 }
705
706 #[doc(alias = "CGPathContainsPoint")]
710 #[inline]
711 pub unsafe fn contains_point(
712 path: Option<&CGPath>,
713 m: *const CGAffineTransform,
714 point: CGPoint,
715 eo_fill: bool,
716 ) -> bool {
717 extern "C-unwind" {
718 fn CGPathContainsPoint(
719 path: Option<&CGPath>,
720 m: *const CGAffineTransform,
721 point: CGPoint,
722 eo_fill: bool,
723 ) -> bool;
724 }
725 unsafe { CGPathContainsPoint(path, m, point, eo_fill) }
726 }
727}
728
729#[repr(transparent)]
732#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
733pub struct CGPathElementType(pub i32);
734impl CGPathElementType {
735 #[doc(alias = "kCGPathElementMoveToPoint")]
736 pub const MoveToPoint: Self = Self(0);
737 #[doc(alias = "kCGPathElementAddLineToPoint")]
738 pub const AddLineToPoint: Self = Self(1);
739 #[doc(alias = "kCGPathElementAddQuadCurveToPoint")]
740 pub const AddQuadCurveToPoint: Self = Self(2);
741 #[doc(alias = "kCGPathElementAddCurveToPoint")]
742 pub const AddCurveToPoint: Self = Self(3);
743 #[doc(alias = "kCGPathElementCloseSubpath")]
744 pub const CloseSubpath: Self = Self(4);
745}
746
747#[cfg(feature = "objc2")]
748unsafe impl Encode for CGPathElementType {
749 const ENCODING: Encoding = i32::ENCODING;
750}
751
752#[cfg(feature = "objc2")]
753unsafe impl RefEncode for CGPathElementType {
754 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
755}
756
757#[repr(C)]
759#[derive(Clone, Copy, Debug, PartialEq)]
760pub struct CGPathElement {
761 pub r#type: CGPathElementType,
762 pub points: NonNull<CGPoint>,
763}
764
765#[cfg(feature = "objc2")]
766unsafe impl Encode for CGPathElement {
767 const ENCODING: Encoding = Encoding::Struct(
768 "CGPathElement",
769 &[<CGPathElementType>::ENCODING, <NonNull<CGPoint>>::ENCODING],
770 );
771}
772
773#[cfg(feature = "objc2")]
774unsafe impl RefEncode for CGPathElement {
775 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
776}
777
778pub type CGPathApplierFunction =
780 Option<unsafe extern "C-unwind" fn(*mut c_void, NonNull<CGPathElement>)>;
781
782impl CGPath {
783 #[doc(alias = "CGPathApply")]
788 #[inline]
789 pub unsafe fn apply(path: Option<&CGPath>, info: *mut c_void, function: CGPathApplierFunction) {
790 extern "C-unwind" {
791 fn CGPathApply(
792 path: Option<&CGPath>,
793 info: *mut c_void,
794 function: CGPathApplierFunction,
795 );
796 }
797 unsafe { CGPathApply(path, info, function) }
798 }
799}
800
801#[cfg(feature = "block2")]
803pub type CGPathApplyBlock = *mut block2::DynBlock<dyn Fn(NonNull<CGPathElement>)>;
804
805impl CGPath {
806 #[doc(alias = "CGPathApplyWithBlock")]
810 #[cfg(feature = "block2")]
811 #[inline]
812 pub unsafe fn apply_with_block(&self, block: CGPathApplyBlock) {
813 extern "C-unwind" {
814 fn CGPathApplyWithBlock(path: &CGPath, block: CGPathApplyBlock);
815 }
816 unsafe { CGPathApplyWithBlock(self, block) }
817 }
818
819 #[doc(alias = "CGPathCreateCopyByNormalizing")]
820 #[inline]
821 pub fn new_copy_by_normalizing(
822 path: Option<&CGPath>,
823 even_odd_fill_rule: bool,
824 ) -> Option<CFRetained<CGPath>> {
825 extern "C-unwind" {
826 fn CGPathCreateCopyByNormalizing(
827 path: Option<&CGPath>,
828 even_odd_fill_rule: bool,
829 ) -> Option<NonNull<CGPath>>;
830 }
831 let ret = unsafe { CGPathCreateCopyByNormalizing(path, even_odd_fill_rule) };
832 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
833 }
834
835 #[doc(alias = "CGPathCreateCopyByUnioningPath")]
836 #[inline]
837 pub fn new_copy_by_unioning_path(
838 path: Option<&CGPath>,
839 mask_path: Option<&CGPath>,
840 even_odd_fill_rule: bool,
841 ) -> Option<CFRetained<CGPath>> {
842 extern "C-unwind" {
843 fn CGPathCreateCopyByUnioningPath(
844 path: Option<&CGPath>,
845 mask_path: Option<&CGPath>,
846 even_odd_fill_rule: bool,
847 ) -> Option<NonNull<CGPath>>;
848 }
849 let ret = unsafe { CGPathCreateCopyByUnioningPath(path, mask_path, even_odd_fill_rule) };
850 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
851 }
852
853 #[doc(alias = "CGPathCreateCopyByIntersectingPath")]
854 #[inline]
855 pub fn new_copy_by_intersecting_path(
856 path: Option<&CGPath>,
857 mask_path: Option<&CGPath>,
858 even_odd_fill_rule: bool,
859 ) -> Option<CFRetained<CGPath>> {
860 extern "C-unwind" {
861 fn CGPathCreateCopyByIntersectingPath(
862 path: Option<&CGPath>,
863 mask_path: Option<&CGPath>,
864 even_odd_fill_rule: bool,
865 ) -> Option<NonNull<CGPath>>;
866 }
867 let ret =
868 unsafe { CGPathCreateCopyByIntersectingPath(path, mask_path, even_odd_fill_rule) };
869 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
870 }
871
872 #[doc(alias = "CGPathCreateCopyBySubtractingPath")]
873 #[inline]
874 pub fn new_copy_by_subtracting_path(
875 path: Option<&CGPath>,
876 mask_path: Option<&CGPath>,
877 even_odd_fill_rule: bool,
878 ) -> Option<CFRetained<CGPath>> {
879 extern "C-unwind" {
880 fn CGPathCreateCopyBySubtractingPath(
881 path: Option<&CGPath>,
882 mask_path: Option<&CGPath>,
883 even_odd_fill_rule: bool,
884 ) -> Option<NonNull<CGPath>>;
885 }
886 let ret = unsafe { CGPathCreateCopyBySubtractingPath(path, mask_path, even_odd_fill_rule) };
887 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
888 }
889
890 #[doc(alias = "CGPathCreateCopyBySymmetricDifferenceOfPath")]
891 #[inline]
892 pub fn new_copy_by_symmetric_difference_of_path(
893 path: Option<&CGPath>,
894 mask_path: Option<&CGPath>,
895 even_odd_fill_rule: bool,
896 ) -> Option<CFRetained<CGPath>> {
897 extern "C-unwind" {
898 fn CGPathCreateCopyBySymmetricDifferenceOfPath(
899 path: Option<&CGPath>,
900 mask_path: Option<&CGPath>,
901 even_odd_fill_rule: bool,
902 ) -> Option<NonNull<CGPath>>;
903 }
904 let ret = unsafe {
905 CGPathCreateCopyBySymmetricDifferenceOfPath(path, mask_path, even_odd_fill_rule)
906 };
907 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
908 }
909
910 #[doc(alias = "CGPathCreateCopyOfLineBySubtractingPath")]
911 #[inline]
912 pub fn new_copy_of_line_by_subtracting_path(
913 path: Option<&CGPath>,
914 mask_path: Option<&CGPath>,
915 even_odd_fill_rule: bool,
916 ) -> Option<CFRetained<CGPath>> {
917 extern "C-unwind" {
918 fn CGPathCreateCopyOfLineBySubtractingPath(
919 path: Option<&CGPath>,
920 mask_path: Option<&CGPath>,
921 even_odd_fill_rule: bool,
922 ) -> Option<NonNull<CGPath>>;
923 }
924 let ret =
925 unsafe { CGPathCreateCopyOfLineBySubtractingPath(path, mask_path, even_odd_fill_rule) };
926 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
927 }
928
929 #[doc(alias = "CGPathCreateCopyOfLineByIntersectingPath")]
930 #[inline]
931 pub fn new_copy_of_line_by_intersecting_path(
932 path: Option<&CGPath>,
933 mask_path: Option<&CGPath>,
934 even_odd_fill_rule: bool,
935 ) -> Option<CFRetained<CGPath>> {
936 extern "C-unwind" {
937 fn CGPathCreateCopyOfLineByIntersectingPath(
938 path: Option<&CGPath>,
939 mask_path: Option<&CGPath>,
940 even_odd_fill_rule: bool,
941 ) -> Option<NonNull<CGPath>>;
942 }
943 let ret = unsafe {
944 CGPathCreateCopyOfLineByIntersectingPath(path, mask_path, even_odd_fill_rule)
945 };
946 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
947 }
948
949 #[doc(alias = "CGPathCreateSeparateComponents")]
950 #[inline]
951 pub fn new_separate_components(
952 path: Option<&CGPath>,
953 even_odd_fill_rule: bool,
954 ) -> Option<CFRetained<CFArray>> {
955 extern "C-unwind" {
956 fn CGPathCreateSeparateComponents(
957 path: Option<&CGPath>,
958 even_odd_fill_rule: bool,
959 ) -> Option<NonNull<CFArray>>;
960 }
961 let ret = unsafe { CGPathCreateSeparateComponents(path, even_odd_fill_rule) };
962 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
963 }
964
965 #[doc(alias = "CGPathCreateCopyByFlattening")]
966 #[inline]
967 pub fn new_copy_by_flattening(
968 path: Option<&CGPath>,
969 flattening_threshold: CGFloat,
970 ) -> Option<CFRetained<CGPath>> {
971 extern "C-unwind" {
972 fn CGPathCreateCopyByFlattening(
973 path: Option<&CGPath>,
974 flattening_threshold: CGFloat,
975 ) -> Option<NonNull<CGPath>>;
976 }
977 let ret = unsafe { CGPathCreateCopyByFlattening(path, flattening_threshold) };
978 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
979 }
980
981 #[doc(alias = "CGPathIntersectsPath")]
982 #[inline]
983 pub fn intersects_path(
984 path1: Option<&CGPath>,
985 path2: Option<&CGPath>,
986 even_odd_fill_rule: bool,
987 ) -> bool {
988 extern "C-unwind" {
989 fn CGPathIntersectsPath(
990 path1: Option<&CGPath>,
991 path2: Option<&CGPath>,
992 even_odd_fill_rule: bool,
993 ) -> bool;
994 }
995 unsafe { CGPathIntersectsPath(path1, path2, even_odd_fill_rule) }
996 }
997}
998
999#[deprecated = "renamed to `CGMutablePath::new`"]
1000#[inline]
1001pub extern "C-unwind" fn CGPathCreateMutable() -> CFRetained<CGMutablePath> {
1002 extern "C-unwind" {
1003 fn CGPathCreateMutable() -> Option<NonNull<CGMutablePath>>;
1004 }
1005 let ret = unsafe { CGPathCreateMutable() };
1006 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1007 unsafe { CFRetained::from_raw(ret) }
1008}
1009
1010#[deprecated = "renamed to `CGPath::new_copy`"]
1011#[inline]
1012pub extern "C-unwind" fn CGPathCreateCopy(path: Option<&CGPath>) -> Option<CFRetained<CGPath>> {
1013 extern "C-unwind" {
1014 fn CGPathCreateCopy(path: Option<&CGPath>) -> Option<NonNull<CGPath>>;
1015 }
1016 let ret = unsafe { CGPathCreateCopy(path) };
1017 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1018}
1019
1020#[deprecated = "renamed to `CGPath::new_copy_by_transforming_path`"]
1021#[inline]
1022pub unsafe extern "C-unwind" fn CGPathCreateCopyByTransformingPath(
1023 path: Option<&CGPath>,
1024 transform: *const CGAffineTransform,
1025) -> Option<CFRetained<CGPath>> {
1026 extern "C-unwind" {
1027 fn CGPathCreateCopyByTransformingPath(
1028 path: Option<&CGPath>,
1029 transform: *const CGAffineTransform,
1030 ) -> Option<NonNull<CGPath>>;
1031 }
1032 let ret = unsafe { CGPathCreateCopyByTransformingPath(path, transform) };
1033 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1034}
1035
1036#[deprecated = "renamed to `CGMutablePath::new_copy`"]
1037#[inline]
1038pub extern "C-unwind" fn CGPathCreateMutableCopy(
1039 path: Option<&CGPath>,
1040) -> Option<CFRetained<CGMutablePath>> {
1041 extern "C-unwind" {
1042 fn CGPathCreateMutableCopy(path: Option<&CGPath>) -> Option<NonNull<CGMutablePath>>;
1043 }
1044 let ret = unsafe { CGPathCreateMutableCopy(path) };
1045 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1046}
1047
1048#[deprecated = "renamed to `CGMutablePath::new_copy_by_transforming_path`"]
1049#[inline]
1050pub unsafe extern "C-unwind" fn CGPathCreateMutableCopyByTransformingPath(
1051 path: Option<&CGPath>,
1052 transform: *const CGAffineTransform,
1053) -> Option<CFRetained<CGMutablePath>> {
1054 extern "C-unwind" {
1055 fn CGPathCreateMutableCopyByTransformingPath(
1056 path: Option<&CGPath>,
1057 transform: *const CGAffineTransform,
1058 ) -> Option<NonNull<CGMutablePath>>;
1059 }
1060 let ret = unsafe { CGPathCreateMutableCopyByTransformingPath(path, transform) };
1061 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1062}
1063
1064#[deprecated = "renamed to `CGPath::with_rect`"]
1065#[inline]
1066pub unsafe extern "C-unwind" fn CGPathCreateWithRect(
1067 rect: CGRect,
1068 transform: *const CGAffineTransform,
1069) -> CFRetained<CGPath> {
1070 extern "C-unwind" {
1071 fn CGPathCreateWithRect(
1072 rect: CGRect,
1073 transform: *const CGAffineTransform,
1074 ) -> Option<NonNull<CGPath>>;
1075 }
1076 let ret = unsafe { CGPathCreateWithRect(rect, transform) };
1077 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1078 unsafe { CFRetained::from_raw(ret) }
1079}
1080
1081#[deprecated = "renamed to `CGPath::with_ellipse_in_rect`"]
1082#[inline]
1083pub unsafe extern "C-unwind" fn CGPathCreateWithEllipseInRect(
1084 rect: CGRect,
1085 transform: *const CGAffineTransform,
1086) -> CFRetained<CGPath> {
1087 extern "C-unwind" {
1088 fn CGPathCreateWithEllipseInRect(
1089 rect: CGRect,
1090 transform: *const CGAffineTransform,
1091 ) -> Option<NonNull<CGPath>>;
1092 }
1093 let ret = unsafe { CGPathCreateWithEllipseInRect(rect, transform) };
1094 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1095 unsafe { CFRetained::from_raw(ret) }
1096}
1097
1098#[deprecated = "renamed to `CGPath::with_rounded_rect`"]
1099#[inline]
1100pub unsafe extern "C-unwind" fn CGPathCreateWithRoundedRect(
1101 rect: CGRect,
1102 corner_width: CGFloat,
1103 corner_height: CGFloat,
1104 transform: *const CGAffineTransform,
1105) -> CFRetained<CGPath> {
1106 extern "C-unwind" {
1107 fn CGPathCreateWithRoundedRect(
1108 rect: CGRect,
1109 corner_width: CGFloat,
1110 corner_height: CGFloat,
1111 transform: *const CGAffineTransform,
1112 ) -> Option<NonNull<CGPath>>;
1113 }
1114 let ret = unsafe { CGPathCreateWithRoundedRect(rect, corner_width, corner_height, transform) };
1115 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1116 unsafe { CFRetained::from_raw(ret) }
1117}
1118
1119extern "C-unwind" {
1120 #[deprecated = "renamed to `CGMutablePath::add_rounded_rect`"]
1121 pub fn CGPathAddRoundedRect(
1122 path: Option<&CGMutablePath>,
1123 transform: *const CGAffineTransform,
1124 rect: CGRect,
1125 corner_width: CGFloat,
1126 corner_height: CGFloat,
1127 );
1128}
1129
1130#[deprecated = "renamed to `CGPath::new_copy_by_dashing_path`"]
1131#[inline]
1132pub unsafe extern "C-unwind" fn CGPathCreateCopyByDashingPath(
1133 path: Option<&CGPath>,
1134 transform: *const CGAffineTransform,
1135 phase: CGFloat,
1136 lengths: *const CGFloat,
1137 count: usize,
1138) -> Option<CFRetained<CGPath>> {
1139 extern "C-unwind" {
1140 fn CGPathCreateCopyByDashingPath(
1141 path: Option<&CGPath>,
1142 transform: *const CGAffineTransform,
1143 phase: CGFloat,
1144 lengths: *const CGFloat,
1145 count: usize,
1146 ) -> Option<NonNull<CGPath>>;
1147 }
1148 let ret = unsafe { CGPathCreateCopyByDashingPath(path, transform, phase, lengths, count) };
1149 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1150}
1151
1152#[deprecated = "renamed to `CGPath::new_copy_by_stroking_path`"]
1153#[inline]
1154pub unsafe extern "C-unwind" fn CGPathCreateCopyByStrokingPath(
1155 path: Option<&CGPath>,
1156 transform: *const CGAffineTransform,
1157 line_width: CGFloat,
1158 line_cap: CGLineCap,
1159 line_join: CGLineJoin,
1160 miter_limit: CGFloat,
1161) -> Option<CFRetained<CGPath>> {
1162 extern "C-unwind" {
1163 fn CGPathCreateCopyByStrokingPath(
1164 path: Option<&CGPath>,
1165 transform: *const CGAffineTransform,
1166 line_width: CGFloat,
1167 line_cap: CGLineCap,
1168 line_join: CGLineJoin,
1169 miter_limit: CGFloat,
1170 ) -> Option<NonNull<CGPath>>;
1171 }
1172 let ret = unsafe {
1173 CGPathCreateCopyByStrokingPath(
1174 path,
1175 transform,
1176 line_width,
1177 line_cap,
1178 line_join,
1179 miter_limit,
1180 )
1181 };
1182 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1183}
1184
1185#[deprecated = "renamed to `CGPath::equal_to_path`"]
1186#[inline]
1187pub extern "C-unwind" fn CGPathEqualToPath(path1: Option<&CGPath>, path2: Option<&CGPath>) -> bool {
1188 extern "C-unwind" {
1189 fn CGPathEqualToPath(path1: Option<&CGPath>, path2: Option<&CGPath>) -> bool;
1190 }
1191 unsafe { CGPathEqualToPath(path1, path2) }
1192}
1193
1194extern "C-unwind" {
1195 #[deprecated = "renamed to `CGMutablePath::move_to_point`"]
1196 pub fn CGPathMoveToPoint(
1197 path: Option<&CGMutablePath>,
1198 m: *const CGAffineTransform,
1199 x: CGFloat,
1200 y: CGFloat,
1201 );
1202}
1203
1204extern "C-unwind" {
1205 #[deprecated = "renamed to `CGMutablePath::add_line_to_point`"]
1206 pub fn CGPathAddLineToPoint(
1207 path: Option<&CGMutablePath>,
1208 m: *const CGAffineTransform,
1209 x: CGFloat,
1210 y: CGFloat,
1211 );
1212}
1213
1214extern "C-unwind" {
1215 #[deprecated = "renamed to `CGMutablePath::add_quad_curve_to_point`"]
1216 pub fn CGPathAddQuadCurveToPoint(
1217 path: Option<&CGMutablePath>,
1218 m: *const CGAffineTransform,
1219 cpx: CGFloat,
1220 cpy: CGFloat,
1221 x: CGFloat,
1222 y: CGFloat,
1223 );
1224}
1225
1226extern "C-unwind" {
1227 #[deprecated = "renamed to `CGMutablePath::add_curve_to_point`"]
1228 pub fn CGPathAddCurveToPoint(
1229 path: Option<&CGMutablePath>,
1230 m: *const CGAffineTransform,
1231 cp1x: CGFloat,
1232 cp1y: CGFloat,
1233 cp2x: CGFloat,
1234 cp2y: CGFloat,
1235 x: CGFloat,
1236 y: CGFloat,
1237 );
1238}
1239
1240#[deprecated = "renamed to `CGMutablePath::close_subpath`"]
1241#[inline]
1242pub extern "C-unwind" fn CGPathCloseSubpath(path: Option<&CGMutablePath>) {
1243 extern "C-unwind" {
1244 fn CGPathCloseSubpath(path: Option<&CGMutablePath>);
1245 }
1246 unsafe { CGPathCloseSubpath(path) }
1247}
1248
1249extern "C-unwind" {
1250 #[deprecated = "renamed to `CGMutablePath::add_rect`"]
1251 pub fn CGPathAddRect(path: Option<&CGMutablePath>, m: *const CGAffineTransform, rect: CGRect);
1252}
1253
1254extern "C-unwind" {
1255 #[deprecated = "renamed to `CGMutablePath::add_rects`"]
1256 pub fn CGPathAddRects(
1257 path: Option<&CGMutablePath>,
1258 m: *const CGAffineTransform,
1259 rects: *const CGRect,
1260 count: usize,
1261 );
1262}
1263
1264extern "C-unwind" {
1265 #[deprecated = "renamed to `CGMutablePath::add_lines`"]
1266 pub fn CGPathAddLines(
1267 path: Option<&CGMutablePath>,
1268 m: *const CGAffineTransform,
1269 points: *const CGPoint,
1270 count: usize,
1271 );
1272}
1273
1274extern "C-unwind" {
1275 #[deprecated = "renamed to `CGMutablePath::add_ellipse_in_rect`"]
1276 pub fn CGPathAddEllipseInRect(
1277 path: Option<&CGMutablePath>,
1278 m: *const CGAffineTransform,
1279 rect: CGRect,
1280 );
1281}
1282
1283extern "C-unwind" {
1284 #[deprecated = "renamed to `CGMutablePath::add_relative_arc`"]
1285 pub fn CGPathAddRelativeArc(
1286 path: Option<&CGMutablePath>,
1287 matrix: *const CGAffineTransform,
1288 x: CGFloat,
1289 y: CGFloat,
1290 radius: CGFloat,
1291 start_angle: CGFloat,
1292 delta: CGFloat,
1293 );
1294}
1295
1296extern "C-unwind" {
1297 #[deprecated = "renamed to `CGMutablePath::add_arc`"]
1298 pub fn CGPathAddArc(
1299 path: Option<&CGMutablePath>,
1300 m: *const CGAffineTransform,
1301 x: CGFloat,
1302 y: CGFloat,
1303 radius: CGFloat,
1304 start_angle: CGFloat,
1305 end_angle: CGFloat,
1306 clockwise: bool,
1307 );
1308}
1309
1310extern "C-unwind" {
1311 #[deprecated = "renamed to `CGMutablePath::add_arc_to_point`"]
1312 pub fn CGPathAddArcToPoint(
1313 path: Option<&CGMutablePath>,
1314 m: *const CGAffineTransform,
1315 x1: CGFloat,
1316 y1: CGFloat,
1317 x2: CGFloat,
1318 y2: CGFloat,
1319 radius: CGFloat,
1320 );
1321}
1322
1323extern "C-unwind" {
1324 #[deprecated = "renamed to `CGMutablePath::add_path`"]
1325 pub fn CGPathAddPath(
1326 path1: Option<&CGMutablePath>,
1327 m: *const CGAffineTransform,
1328 path2: Option<&CGPath>,
1329 );
1330}
1331
1332#[deprecated = "renamed to `CGPath::is_empty`"]
1333#[inline]
1334pub extern "C-unwind" fn CGPathIsEmpty(path: Option<&CGPath>) -> bool {
1335 extern "C-unwind" {
1336 fn CGPathIsEmpty(path: Option<&CGPath>) -> bool;
1337 }
1338 unsafe { CGPathIsEmpty(path) }
1339}
1340
1341extern "C-unwind" {
1342 #[deprecated = "renamed to `CGPath::is_rect`"]
1343 pub fn CGPathIsRect(path: Option<&CGPath>, rect: *mut CGRect) -> bool;
1344}
1345
1346#[deprecated = "renamed to `CGPath::current_point`"]
1347#[inline]
1348pub extern "C-unwind" fn CGPathGetCurrentPoint(path: Option<&CGPath>) -> CGPoint {
1349 extern "C-unwind" {
1350 fn CGPathGetCurrentPoint(path: Option<&CGPath>) -> CGPoint;
1351 }
1352 unsafe { CGPathGetCurrentPoint(path) }
1353}
1354
1355#[deprecated = "renamed to `CGPath::bounding_box`"]
1356#[inline]
1357pub extern "C-unwind" fn CGPathGetBoundingBox(path: Option<&CGPath>) -> CGRect {
1358 extern "C-unwind" {
1359 fn CGPathGetBoundingBox(path: Option<&CGPath>) -> CGRect;
1360 }
1361 unsafe { CGPathGetBoundingBox(path) }
1362}
1363
1364#[deprecated = "renamed to `CGPath::path_bounding_box`"]
1365#[inline]
1366pub extern "C-unwind" fn CGPathGetPathBoundingBox(path: Option<&CGPath>) -> CGRect {
1367 extern "C-unwind" {
1368 fn CGPathGetPathBoundingBox(path: Option<&CGPath>) -> CGRect;
1369 }
1370 unsafe { CGPathGetPathBoundingBox(path) }
1371}
1372
1373extern "C-unwind" {
1374 #[deprecated = "renamed to `CGPath::contains_point`"]
1375 pub fn CGPathContainsPoint(
1376 path: Option<&CGPath>,
1377 m: *const CGAffineTransform,
1378 point: CGPoint,
1379 eo_fill: bool,
1380 ) -> bool;
1381}
1382
1383extern "C-unwind" {
1384 #[deprecated = "renamed to `CGPath::apply`"]
1385 pub fn CGPathApply(path: Option<&CGPath>, info: *mut c_void, function: CGPathApplierFunction);
1386}
1387
1388extern "C-unwind" {
1389 #[cfg(feature = "block2")]
1390 #[deprecated = "renamed to `CGPath::apply_with_block`"]
1391 pub fn CGPathApplyWithBlock(path: &CGPath, block: CGPathApplyBlock);
1392}
1393
1394#[deprecated = "renamed to `CGPath::new_copy_by_normalizing`"]
1395#[inline]
1396pub extern "C-unwind" fn CGPathCreateCopyByNormalizing(
1397 path: Option<&CGPath>,
1398 even_odd_fill_rule: bool,
1399) -> Option<CFRetained<CGPath>> {
1400 extern "C-unwind" {
1401 fn CGPathCreateCopyByNormalizing(
1402 path: Option<&CGPath>,
1403 even_odd_fill_rule: bool,
1404 ) -> Option<NonNull<CGPath>>;
1405 }
1406 let ret = unsafe { CGPathCreateCopyByNormalizing(path, even_odd_fill_rule) };
1407 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1408}
1409
1410#[deprecated = "renamed to `CGPath::new_copy_by_unioning_path`"]
1411#[inline]
1412pub extern "C-unwind" fn CGPathCreateCopyByUnioningPath(
1413 path: Option<&CGPath>,
1414 mask_path: Option<&CGPath>,
1415 even_odd_fill_rule: bool,
1416) -> Option<CFRetained<CGPath>> {
1417 extern "C-unwind" {
1418 fn CGPathCreateCopyByUnioningPath(
1419 path: Option<&CGPath>,
1420 mask_path: Option<&CGPath>,
1421 even_odd_fill_rule: bool,
1422 ) -> Option<NonNull<CGPath>>;
1423 }
1424 let ret = unsafe { CGPathCreateCopyByUnioningPath(path, mask_path, even_odd_fill_rule) };
1425 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1426}
1427
1428#[deprecated = "renamed to `CGPath::new_copy_by_intersecting_path`"]
1429#[inline]
1430pub extern "C-unwind" fn CGPathCreateCopyByIntersectingPath(
1431 path: Option<&CGPath>,
1432 mask_path: Option<&CGPath>,
1433 even_odd_fill_rule: bool,
1434) -> Option<CFRetained<CGPath>> {
1435 extern "C-unwind" {
1436 fn CGPathCreateCopyByIntersectingPath(
1437 path: Option<&CGPath>,
1438 mask_path: Option<&CGPath>,
1439 even_odd_fill_rule: bool,
1440 ) -> Option<NonNull<CGPath>>;
1441 }
1442 let ret = unsafe { CGPathCreateCopyByIntersectingPath(path, mask_path, even_odd_fill_rule) };
1443 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1444}
1445
1446#[deprecated = "renamed to `CGPath::new_copy_by_subtracting_path`"]
1447#[inline]
1448pub extern "C-unwind" fn CGPathCreateCopyBySubtractingPath(
1449 path: Option<&CGPath>,
1450 mask_path: Option<&CGPath>,
1451 even_odd_fill_rule: bool,
1452) -> Option<CFRetained<CGPath>> {
1453 extern "C-unwind" {
1454 fn CGPathCreateCopyBySubtractingPath(
1455 path: Option<&CGPath>,
1456 mask_path: Option<&CGPath>,
1457 even_odd_fill_rule: bool,
1458 ) -> Option<NonNull<CGPath>>;
1459 }
1460 let ret = unsafe { CGPathCreateCopyBySubtractingPath(path, mask_path, even_odd_fill_rule) };
1461 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1462}
1463
1464#[deprecated = "renamed to `CGPath::new_copy_by_symmetric_difference_of_path`"]
1465#[inline]
1466pub extern "C-unwind" fn CGPathCreateCopyBySymmetricDifferenceOfPath(
1467 path: Option<&CGPath>,
1468 mask_path: Option<&CGPath>,
1469 even_odd_fill_rule: bool,
1470) -> Option<CFRetained<CGPath>> {
1471 extern "C-unwind" {
1472 fn CGPathCreateCopyBySymmetricDifferenceOfPath(
1473 path: Option<&CGPath>,
1474 mask_path: Option<&CGPath>,
1475 even_odd_fill_rule: bool,
1476 ) -> Option<NonNull<CGPath>>;
1477 }
1478 let ret =
1479 unsafe { CGPathCreateCopyBySymmetricDifferenceOfPath(path, mask_path, even_odd_fill_rule) };
1480 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1481}
1482
1483#[deprecated = "renamed to `CGPath::new_copy_of_line_by_subtracting_path`"]
1484#[inline]
1485pub extern "C-unwind" fn CGPathCreateCopyOfLineBySubtractingPath(
1486 path: Option<&CGPath>,
1487 mask_path: Option<&CGPath>,
1488 even_odd_fill_rule: bool,
1489) -> Option<CFRetained<CGPath>> {
1490 extern "C-unwind" {
1491 fn CGPathCreateCopyOfLineBySubtractingPath(
1492 path: Option<&CGPath>,
1493 mask_path: Option<&CGPath>,
1494 even_odd_fill_rule: bool,
1495 ) -> Option<NonNull<CGPath>>;
1496 }
1497 let ret =
1498 unsafe { CGPathCreateCopyOfLineBySubtractingPath(path, mask_path, even_odd_fill_rule) };
1499 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1500}
1501
1502#[deprecated = "renamed to `CGPath::new_copy_of_line_by_intersecting_path`"]
1503#[inline]
1504pub extern "C-unwind" fn CGPathCreateCopyOfLineByIntersectingPath(
1505 path: Option<&CGPath>,
1506 mask_path: Option<&CGPath>,
1507 even_odd_fill_rule: bool,
1508) -> Option<CFRetained<CGPath>> {
1509 extern "C-unwind" {
1510 fn CGPathCreateCopyOfLineByIntersectingPath(
1511 path: Option<&CGPath>,
1512 mask_path: Option<&CGPath>,
1513 even_odd_fill_rule: bool,
1514 ) -> Option<NonNull<CGPath>>;
1515 }
1516 let ret =
1517 unsafe { CGPathCreateCopyOfLineByIntersectingPath(path, mask_path, even_odd_fill_rule) };
1518 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1519}
1520
1521#[deprecated = "renamed to `CGPath::new_separate_components`"]
1522#[inline]
1523pub extern "C-unwind" fn CGPathCreateSeparateComponents(
1524 path: Option<&CGPath>,
1525 even_odd_fill_rule: bool,
1526) -> Option<CFRetained<CFArray>> {
1527 extern "C-unwind" {
1528 fn CGPathCreateSeparateComponents(
1529 path: Option<&CGPath>,
1530 even_odd_fill_rule: bool,
1531 ) -> Option<NonNull<CFArray>>;
1532 }
1533 let ret = unsafe { CGPathCreateSeparateComponents(path, even_odd_fill_rule) };
1534 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1535}
1536
1537#[deprecated = "renamed to `CGPath::new_copy_by_flattening`"]
1538#[inline]
1539pub extern "C-unwind" fn CGPathCreateCopyByFlattening(
1540 path: Option<&CGPath>,
1541 flattening_threshold: CGFloat,
1542) -> Option<CFRetained<CGPath>> {
1543 extern "C-unwind" {
1544 fn CGPathCreateCopyByFlattening(
1545 path: Option<&CGPath>,
1546 flattening_threshold: CGFloat,
1547 ) -> Option<NonNull<CGPath>>;
1548 }
1549 let ret = unsafe { CGPathCreateCopyByFlattening(path, flattening_threshold) };
1550 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1551}
1552
1553#[deprecated = "renamed to `CGPath::intersects_path`"]
1554#[inline]
1555pub extern "C-unwind" fn CGPathIntersectsPath(
1556 path1: Option<&CGPath>,
1557 path2: Option<&CGPath>,
1558 even_odd_fill_rule: bool,
1559) -> bool {
1560 extern "C-unwind" {
1561 fn CGPathIntersectsPath(
1562 path1: Option<&CGPath>,
1563 path2: Option<&CGPath>,
1564 even_odd_fill_rule: bool,
1565 ) -> bool;
1566 }
1567 unsafe { CGPathIntersectsPath(path1, path2, even_odd_fill_rule) }
1568}