objc2_ui_kit/generated/
UIBezierPath.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/uikit/uibezierpath?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct UIBezierPath;
19);
20
21extern_conformance!(
22    unsafe impl NSCoding for UIBezierPath {}
23);
24
25extern_conformance!(
26    unsafe impl NSCopying for UIBezierPath {}
27);
28
29unsafe impl CopyingHelper for UIBezierPath {
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for UIBezierPath {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for UIBezierPath {}
39);
40
41impl UIBezierPath {
42    extern_methods!(
43        #[unsafe(method(bezierPath))]
44        #[unsafe(method_family = none)]
45        pub fn bezierPath() -> Retained<Self>;
46
47        #[cfg(feature = "objc2-core-foundation")]
48        #[unsafe(method(bezierPathWithRect:))]
49        #[unsafe(method_family = none)]
50        pub fn bezierPathWithRect(rect: CGRect) -> Retained<Self>;
51
52        #[cfg(feature = "objc2-core-foundation")]
53        #[unsafe(method(bezierPathWithOvalInRect:))]
54        #[unsafe(method_family = none)]
55        pub fn bezierPathWithOvalInRect(rect: CGRect) -> Retained<Self>;
56
57        #[cfg(feature = "objc2-core-foundation")]
58        #[unsafe(method(bezierPathWithRoundedRect:cornerRadius:))]
59        #[unsafe(method_family = none)]
60        pub fn bezierPathWithRoundedRect_cornerRadius(
61            rect: CGRect,
62            corner_radius: CGFloat,
63        ) -> Retained<Self>;
64
65        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
66        #[unsafe(method(bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:))]
67        #[unsafe(method_family = none)]
68        pub fn bezierPathWithRoundedRect_byRoundingCorners_cornerRadii(
69            rect: CGRect,
70            corners: UIRectCorner,
71            corner_radii: CGSize,
72        ) -> Retained<Self>;
73
74        #[cfg(feature = "objc2-core-foundation")]
75        #[unsafe(method(bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise:))]
76        #[unsafe(method_family = none)]
77        pub fn bezierPathWithArcCenter_radius_startAngle_endAngle_clockwise(
78            center: CGPoint,
79            radius: CGFloat,
80            start_angle: CGFloat,
81            end_angle: CGFloat,
82            clockwise: bool,
83        ) -> Retained<Self>;
84
85        #[cfg(feature = "objc2-core-graphics")]
86        #[unsafe(method(bezierPathWithCGPath:))]
87        #[unsafe(method_family = none)]
88        pub fn bezierPathWithCGPath(cg_path: &CGPath) -> Retained<Self>;
89
90        #[unsafe(method(init))]
91        #[unsafe(method_family = init)]
92        pub fn init(this: Allocated<Self>) -> Retained<Self>;
93
94        /// # Safety
95        ///
96        /// `coder` possibly has further requirements.
97        #[unsafe(method(initWithCoder:))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn initWithCoder(
100            this: Allocated<Self>,
101            coder: &NSCoder,
102        ) -> Option<Retained<Self>>;
103
104        #[cfg(feature = "objc2-core-graphics")]
105        #[unsafe(method(CGPath))]
106        #[unsafe(method_family = none)]
107        pub fn CGPath(&self) -> Retained<CGPath>;
108
109        #[cfg(feature = "objc2-core-graphics")]
110        /// Setter for [`CGPath`][Self::CGPath].
111        #[unsafe(method(setCGPath:))]
112        #[unsafe(method_family = none)]
113        pub fn setCGPath(&self, cg_path: &CGPath);
114
115        #[cfg(feature = "objc2-core-foundation")]
116        #[unsafe(method(moveToPoint:))]
117        #[unsafe(method_family = none)]
118        pub fn moveToPoint(&self, point: CGPoint);
119
120        #[cfg(feature = "objc2-core-foundation")]
121        #[unsafe(method(addLineToPoint:))]
122        #[unsafe(method_family = none)]
123        pub fn addLineToPoint(&self, point: CGPoint);
124
125        #[cfg(feature = "objc2-core-foundation")]
126        #[unsafe(method(addCurveToPoint:controlPoint1:controlPoint2:))]
127        #[unsafe(method_family = none)]
128        pub fn addCurveToPoint_controlPoint1_controlPoint2(
129            &self,
130            end_point: CGPoint,
131            control_point1: CGPoint,
132            control_point2: CGPoint,
133        );
134
135        #[cfg(feature = "objc2-core-foundation")]
136        #[unsafe(method(addQuadCurveToPoint:controlPoint:))]
137        #[unsafe(method_family = none)]
138        pub fn addQuadCurveToPoint_controlPoint(&self, end_point: CGPoint, control_point: CGPoint);
139
140        #[cfg(feature = "objc2-core-foundation")]
141        #[unsafe(method(addArcWithCenter:radius:startAngle:endAngle:clockwise:))]
142        #[unsafe(method_family = none)]
143        pub fn addArcWithCenter_radius_startAngle_endAngle_clockwise(
144            &self,
145            center: CGPoint,
146            radius: CGFloat,
147            start_angle: CGFloat,
148            end_angle: CGFloat,
149            clockwise: bool,
150        );
151
152        #[unsafe(method(closePath))]
153        #[unsafe(method_family = none)]
154        pub fn closePath(&self);
155
156        #[unsafe(method(removeAllPoints))]
157        #[unsafe(method_family = none)]
158        pub fn removeAllPoints(&self);
159
160        #[unsafe(method(appendPath:))]
161        #[unsafe(method_family = none)]
162        pub fn appendPath(&self, bezier_path: &UIBezierPath);
163
164        #[unsafe(method(bezierPathByReversingPath))]
165        #[unsafe(method_family = none)]
166        pub fn bezierPathByReversingPath(&self) -> Retained<UIBezierPath>;
167
168        #[cfg(feature = "objc2-core-foundation")]
169        #[unsafe(method(applyTransform:))]
170        #[unsafe(method_family = none)]
171        pub fn applyTransform(&self, transform: CGAffineTransform);
172
173        #[unsafe(method(isEmpty))]
174        #[unsafe(method_family = none)]
175        pub fn isEmpty(&self) -> bool;
176
177        #[cfg(feature = "objc2-core-foundation")]
178        #[unsafe(method(bounds))]
179        #[unsafe(method_family = none)]
180        pub fn bounds(&self) -> CGRect;
181
182        #[cfg(feature = "objc2-core-foundation")]
183        #[unsafe(method(currentPoint))]
184        #[unsafe(method_family = none)]
185        pub fn currentPoint(&self) -> CGPoint;
186
187        #[cfg(feature = "objc2-core-foundation")]
188        #[unsafe(method(containsPoint:))]
189        #[unsafe(method_family = none)]
190        pub fn containsPoint(&self, point: CGPoint) -> bool;
191
192        #[cfg(feature = "objc2-core-foundation")]
193        #[unsafe(method(lineWidth))]
194        #[unsafe(method_family = none)]
195        pub fn lineWidth(&self) -> CGFloat;
196
197        #[cfg(feature = "objc2-core-foundation")]
198        /// Setter for [`lineWidth`][Self::lineWidth].
199        #[unsafe(method(setLineWidth:))]
200        #[unsafe(method_family = none)]
201        pub fn setLineWidth(&self, line_width: CGFloat);
202
203        #[cfg(feature = "objc2-core-graphics")]
204        #[unsafe(method(lineCapStyle))]
205        #[unsafe(method_family = none)]
206        pub fn lineCapStyle(&self) -> CGLineCap;
207
208        #[cfg(feature = "objc2-core-graphics")]
209        /// Setter for [`lineCapStyle`][Self::lineCapStyle].
210        #[unsafe(method(setLineCapStyle:))]
211        #[unsafe(method_family = none)]
212        pub fn setLineCapStyle(&self, line_cap_style: CGLineCap);
213
214        #[cfg(feature = "objc2-core-graphics")]
215        #[unsafe(method(lineJoinStyle))]
216        #[unsafe(method_family = none)]
217        pub fn lineJoinStyle(&self) -> CGLineJoin;
218
219        #[cfg(feature = "objc2-core-graphics")]
220        /// Setter for [`lineJoinStyle`][Self::lineJoinStyle].
221        #[unsafe(method(setLineJoinStyle:))]
222        #[unsafe(method_family = none)]
223        pub fn setLineJoinStyle(&self, line_join_style: CGLineJoin);
224
225        #[cfg(feature = "objc2-core-foundation")]
226        #[unsafe(method(miterLimit))]
227        #[unsafe(method_family = none)]
228        pub fn miterLimit(&self) -> CGFloat;
229
230        #[cfg(feature = "objc2-core-foundation")]
231        /// Setter for [`miterLimit`][Self::miterLimit].
232        #[unsafe(method(setMiterLimit:))]
233        #[unsafe(method_family = none)]
234        pub fn setMiterLimit(&self, miter_limit: CGFloat);
235
236        #[cfg(feature = "objc2-core-foundation")]
237        #[unsafe(method(flatness))]
238        #[unsafe(method_family = none)]
239        pub fn flatness(&self) -> CGFloat;
240
241        #[cfg(feature = "objc2-core-foundation")]
242        /// Setter for [`flatness`][Self::flatness].
243        #[unsafe(method(setFlatness:))]
244        #[unsafe(method_family = none)]
245        pub fn setFlatness(&self, flatness: CGFloat);
246
247        #[unsafe(method(usesEvenOddFillRule))]
248        #[unsafe(method_family = none)]
249        pub fn usesEvenOddFillRule(&self) -> bool;
250
251        /// Setter for [`usesEvenOddFillRule`][Self::usesEvenOddFillRule].
252        #[unsafe(method(setUsesEvenOddFillRule:))]
253        #[unsafe(method_family = none)]
254        pub fn setUsesEvenOddFillRule(&self, uses_even_odd_fill_rule: bool);
255
256        #[cfg(feature = "objc2-core-foundation")]
257        /// # Safety
258        ///
259        /// `pattern` must be a valid pointer or null.
260        #[unsafe(method(setLineDash:count:phase:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setLineDash_count_phase(
263            &self,
264            pattern: *const CGFloat,
265            count: NSInteger,
266            phase: CGFloat,
267        );
268
269        #[cfg(feature = "objc2-core-foundation")]
270        /// # Safety
271        ///
272        /// - `pattern` must be a valid pointer or null.
273        /// - `count` must be a valid pointer or null.
274        /// - `phase` must be a valid pointer or null.
275        #[unsafe(method(getLineDash:count:phase:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn getLineDash_count_phase(
278            &self,
279            pattern: *mut CGFloat,
280            count: *mut NSInteger,
281            phase: *mut CGFloat,
282        );
283
284        #[unsafe(method(fill))]
285        #[unsafe(method_family = none)]
286        pub fn fill(&self);
287
288        #[unsafe(method(stroke))]
289        #[unsafe(method_family = none)]
290        pub fn stroke(&self);
291
292        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
293        #[unsafe(method(fillWithBlendMode:alpha:))]
294        #[unsafe(method_family = none)]
295        pub fn fillWithBlendMode_alpha(&self, blend_mode: CGBlendMode, alpha: CGFloat);
296
297        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
298        #[unsafe(method(strokeWithBlendMode:alpha:))]
299        #[unsafe(method_family = none)]
300        pub fn strokeWithBlendMode_alpha(&self, blend_mode: CGBlendMode, alpha: CGFloat);
301
302        #[unsafe(method(addClip))]
303        #[unsafe(method_family = none)]
304        pub fn addClip(&self);
305    );
306}
307
308/// Methods declared on superclass `NSObject`.
309impl UIBezierPath {
310    extern_methods!(
311        #[unsafe(method(new))]
312        #[unsafe(method_family = new)]
313        pub fn new() -> Retained<Self>;
314    );
315}
316
317impl DefaultRetained for UIBezierPath {
318    #[inline]
319    fn default_retained() -> Retained<Self> {
320        Self::new()
321    }
322}