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
21extern_conformance!(
22    unsafe impl NSCoding for SKRegion {}
23);
24
25extern_conformance!(
26    unsafe impl NSCopying for SKRegion {}
27);
28
29unsafe impl CopyingHelper for SKRegion {
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for SKRegion {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for SKRegion {}
39);
40
41impl SKRegion {
42    extern_methods!(
43        #[cfg(feature = "objc2-core-graphics")]
44        #[unsafe(method(path))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn path(&self) -> Option<Retained<CGPath>>;
47
48        /// A shared infinite region
49        #[unsafe(method(infiniteRegion))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn infiniteRegion() -> Retained<Self>;
52
53        /// Create a circular region with radius
54        #[unsafe(method(initWithRadius:))]
55        #[unsafe(method_family = init)]
56        pub unsafe fn initWithRadius(this: Allocated<Self>, radius: c_float) -> Retained<Self>;
57
58        #[cfg(feature = "objc2-core-foundation")]
59        /// Create a rectangular region of size
60        #[unsafe(method(initWithSize:))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
63
64        #[cfg(feature = "objc2-core-graphics")]
65        /// Create a region bounded by a CGPath. Note that this option can be
66        /// costly to evaluate.
67        #[unsafe(method(initWithPath:))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn initWithPath(this: Allocated<Self>, path: &CGPath) -> Retained<Self>;
70
71        /// Create a new region that is the inverse of the current region.
72        /// The inverse of the infiniteRegion is an empty region.
73        /// Subclasses of SKRegion need to provide an implementation of inverseRegion.
74        #[unsafe(method(inverseRegion))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn inverseRegion(&self) -> Retained<Self>;
77
78        /// Create a new region that is the original region plus the supplied region
79        #[unsafe(method(regionByUnionWithRegion:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn regionByUnionWithRegion(&self, region: &SKRegion) -> Retained<Self>;
82
83        /// Create a new region that is the original region minus the supplied region
84        #[unsafe(method(regionByDifferenceFromRegion:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn regionByDifferenceFromRegion(&self, region: &SKRegion) -> Retained<Self>;
87
88        /// Create a new region that is the region covered by the original region and the supplied region
89        #[unsafe(method(regionByIntersectionWithRegion:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn regionByIntersectionWithRegion(&self, region: &SKRegion) -> Retained<Self>;
92
93        #[cfg(feature = "objc2-core-foundation")]
94        /// Test for containment
95        #[unsafe(method(containsPoint:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn containsPoint(&self, point: CGPoint) -> bool;
98    );
99}
100
101/// Methods declared on superclass `NSObject`.
102impl SKRegion {
103    extern_methods!(
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107
108        #[unsafe(method(new))]
109        #[unsafe(method_family = new)]
110        pub unsafe fn new() -> Retained<Self>;
111    );
112}