objc2_sprite_kit/generated/
SKRegion.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::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skregion?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct SKRegion;
19);
20
21unsafe impl NSCoding for SKRegion {}
22
23unsafe impl NSCopying for SKRegion {}
24
25unsafe impl CopyingHelper for SKRegion {
26    type Result = Self;
27}
28
29unsafe impl NSObjectProtocol for SKRegion {}
30
31unsafe impl NSSecureCoding for SKRegion {}
32
33impl SKRegion {
34    extern_methods!(
35        #[cfg(feature = "objc2-core-graphics")]
36        #[unsafe(method(path))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn path(&self) -> Option<Retained<CGPath>>;
39
40        /// A shared infinite region
41        #[unsafe(method(infiniteRegion))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn infiniteRegion() -> Retained<Self>;
44
45        /// Create a circular region with radius
46        #[unsafe(method(initWithRadius:))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn initWithRadius(this: Allocated<Self>, radius: c_float) -> Retained<Self>;
49
50        #[cfg(feature = "objc2-core-foundation")]
51        /// Create a rectangular region of size
52        #[unsafe(method(initWithSize:))]
53        #[unsafe(method_family = init)]
54        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
55
56        #[cfg(feature = "objc2-core-graphics")]
57        /// Create a region bounded by a CGPath. Note that this option can be
58        /// costly to evaluate.
59        #[unsafe(method(initWithPath:))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn initWithPath(this: Allocated<Self>, path: &CGPath) -> Retained<Self>;
62
63        /// Create a new region that is the inverse of the current region.
64        /// The inverse of the infiniteRegion is an empty region.
65        /// Subclasses of SKRegion need to provide an implementation of inverseRegion.
66        #[unsafe(method(inverseRegion))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn inverseRegion(&self) -> Retained<Self>;
69
70        /// Create a new region that is the original region plus the supplied region
71        #[unsafe(method(regionByUnionWithRegion:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn regionByUnionWithRegion(&self, region: &SKRegion) -> Retained<Self>;
74
75        /// Create a new region that is the original region minus the supplied region
76        #[unsafe(method(regionByDifferenceFromRegion:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn regionByDifferenceFromRegion(&self, region: &SKRegion) -> Retained<Self>;
79
80        /// Create a new region that is the region covered by the original region and the supplied region
81        #[unsafe(method(regionByIntersectionWithRegion:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn regionByIntersectionWithRegion(&self, region: &SKRegion) -> Retained<Self>;
84
85        #[cfg(feature = "objc2-core-foundation")]
86        /// Test for containment
87        #[unsafe(method(containsPoint:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn containsPoint(&self, point: CGPoint) -> bool;
90    );
91}
92
93/// Methods declared on superclass `NSObject`.
94impl SKRegion {
95    extern_methods!(
96        #[unsafe(method(init))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99
100        #[unsafe(method(new))]
101        #[unsafe(method_family = new)]
102        pub unsafe fn new() -> Retained<Self>;
103    );
104}