objc2_sprite_kit/generated/
SKShapeNode.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11#[cfg(feature = "objc2-core-graphics")]
12use objc2_core_graphics::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17extern_class!(
18    /// A SpriteKit Node used to stroke or fill a shape. CGPaths are used to supply the path.
19    ///
20    /// See CGPath
21    /// <a href="http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CGPath/Reference/reference.html">
22    /// reference pages
23    /// </a>
24    /// for details on how to construct a CGPath.
25    ///
26    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skshapenode?language=objc)
27    #[unsafe(super(SKNode, NSResponder, NSObject))]
28    #[derive(Debug, PartialEq, Eq, Hash)]
29    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
30    #[cfg(target_os = "macos")]
31    pub struct SKShapeNode;
32);
33
34#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
35#[cfg(target_os = "macos")]
36unsafe impl NSCoding for SKShapeNode {}
37
38#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
39#[cfg(target_os = "macos")]
40unsafe impl NSCopying for SKShapeNode {}
41
42#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
43#[cfg(target_os = "macos")]
44unsafe impl CopyingHelper for SKShapeNode {
45    type Result = Self;
46}
47
48#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
49#[cfg(target_os = "macos")]
50unsafe impl NSObjectProtocol for SKShapeNode {}
51
52#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
53#[cfg(target_os = "macos")]
54unsafe impl NSSecureCoding for SKShapeNode {}
55
56#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
57#[cfg(target_os = "macos")]
58impl SKShapeNode {
59    extern_methods!(
60        #[cfg(feature = "objc2-core-graphics")]
61        #[unsafe(method(shapeNodeWithPath:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn shapeNodeWithPath(path: &CGPath, mtm: MainThreadMarker) -> Retained<Self>;
64
65        #[cfg(feature = "objc2-core-graphics")]
66        #[unsafe(method(shapeNodeWithPath:centered:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn shapeNodeWithPath_centered(
69            path: &CGPath,
70            centered: bool,
71            mtm: MainThreadMarker,
72        ) -> Retained<Self>;
73
74        #[cfg(feature = "objc2-core-foundation")]
75        #[unsafe(method(shapeNodeWithRect:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn shapeNodeWithRect(rect: CGRect, mtm: MainThreadMarker) -> Retained<Self>;
78
79        #[cfg(feature = "objc2-core-foundation")]
80        #[unsafe(method(shapeNodeWithRectOfSize:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn shapeNodeWithRectOfSize(
83            size: CGSize,
84            mtm: MainThreadMarker,
85        ) -> Retained<Self>;
86
87        #[cfg(feature = "objc2-core-foundation")]
88        #[unsafe(method(shapeNodeWithRect:cornerRadius:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn shapeNodeWithRect_cornerRadius(
91            rect: CGRect,
92            corner_radius: CGFloat,
93            mtm: MainThreadMarker,
94        ) -> Retained<Self>;
95
96        #[cfg(feature = "objc2-core-foundation")]
97        #[unsafe(method(shapeNodeWithRectOfSize:cornerRadius:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn shapeNodeWithRectOfSize_cornerRadius(
100            size: CGSize,
101            corner_radius: CGFloat,
102            mtm: MainThreadMarker,
103        ) -> Retained<Self>;
104
105        #[cfg(feature = "objc2-core-foundation")]
106        #[unsafe(method(shapeNodeWithCircleOfRadius:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn shapeNodeWithCircleOfRadius(
109            radius: CGFloat,
110            mtm: MainThreadMarker,
111        ) -> Retained<Self>;
112
113        #[cfg(feature = "objc2-core-foundation")]
114        #[unsafe(method(shapeNodeWithEllipseInRect:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn shapeNodeWithEllipseInRect(
117            rect: CGRect,
118            mtm: MainThreadMarker,
119        ) -> Retained<Self>;
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[unsafe(method(shapeNodeWithEllipseOfSize:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn shapeNodeWithEllipseOfSize(
125            size: CGSize,
126            mtm: MainThreadMarker,
127        ) -> Retained<Self>;
128
129        #[cfg(feature = "objc2-core-foundation")]
130        #[unsafe(method(shapeNodeWithPoints:count:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn shapeNodeWithPoints_count(
133            points: NonNull<CGPoint>,
134            num_points: usize,
135            mtm: MainThreadMarker,
136        ) -> Retained<Self>;
137
138        #[cfg(feature = "objc2-core-foundation")]
139        #[unsafe(method(shapeNodeWithSplinePoints:count:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn shapeNodeWithSplinePoints_count(
142            points: NonNull<CGPoint>,
143            num_points: usize,
144            mtm: MainThreadMarker,
145        ) -> Retained<Self>;
146
147        #[cfg(feature = "objc2-core-graphics")]
148        /// The CGPath to be drawn (in the Node's coordinate space)
149        #[unsafe(method(path))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn path(&self) -> Option<Retained<CGPath>>;
152
153        #[cfg(feature = "objc2-core-graphics")]
154        /// Setter for [`path`][Self::path].
155        #[unsafe(method(setPath:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setPath(&self, path: Option<&CGPath>);
158
159        /// The color to draw the path with. (for no stroke use [SKColor clearColor]). Defaults to [SKColor whiteColor].
160        #[unsafe(method(strokeColor))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn strokeColor(&self) -> Retained<NSColor>;
163
164        /// Setter for [`strokeColor`][Self::strokeColor].
165        #[unsafe(method(setStrokeColor:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setStrokeColor(&self, stroke_color: &NSColor);
168
169        /// The color to fill the path with. Defaults to [SKColor clearColor] (no fill).
170        #[unsafe(method(fillColor))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn fillColor(&self) -> Retained<NSColor>;
173
174        /// Setter for [`fillColor`][Self::fillColor].
175        #[unsafe(method(setFillColor:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setFillColor(&self, fill_color: &NSColor);
178
179        /// Sets the blend mode to use when composing the shape with the final framebuffer.
180        ///
181        /// See: SKNode.SKBlendMode
182        #[unsafe(method(blendMode))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn blendMode(&self) -> SKBlendMode;
185
186        /// Setter for [`blendMode`][Self::blendMode].
187        #[unsafe(method(setBlendMode:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setBlendMode(&self, blend_mode: SKBlendMode);
190
191        /// If set to YES, the path stroke edges and caps is smoothed (antialiased) when drawn.
192        #[unsafe(method(isAntialiased))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn isAntialiased(&self) -> bool;
195
196        /// Setter for [`isAntialiased`][Self::isAntialiased].
197        #[unsafe(method(setAntialiased:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setAntialiased(&self, antialiased: bool);
200
201        #[cfg(feature = "objc2-core-foundation")]
202        /// The width used to stroke the path. Widths larger than 2.0 may result in artifacts. Defaults to 1.0.
203        #[unsafe(method(lineWidth))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn lineWidth(&self) -> CGFloat;
206
207        #[cfg(feature = "objc2-core-foundation")]
208        /// Setter for [`lineWidth`][Self::lineWidth].
209        #[unsafe(method(setLineWidth:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn setLineWidth(&self, line_width: CGFloat);
212
213        #[cfg(feature = "objc2-core-foundation")]
214        /// Add a glow to the path stroke of the specified width. Defaults to 0.0 (no glow)
215        #[unsafe(method(glowWidth))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn glowWidth(&self) -> CGFloat;
218
219        #[cfg(feature = "objc2-core-foundation")]
220        /// Setter for [`glowWidth`][Self::glowWidth].
221        #[unsafe(method(setGlowWidth:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setGlowWidth(&self, glow_width: CGFloat);
224
225        #[cfg(feature = "objc2-core-graphics")]
226        /// The cap type that should be used when stroking a non-closed path
227        #[unsafe(method(lineCap))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn lineCap(&self) -> CGLineCap;
230
231        #[cfg(feature = "objc2-core-graphics")]
232        /// Setter for [`lineCap`][Self::lineCap].
233        #[unsafe(method(setLineCap:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setLineCap(&self, line_cap: CGLineCap);
236
237        #[cfg(feature = "objc2-core-graphics")]
238        /// The join type that should be used when stroking a path
239        #[unsafe(method(lineJoin))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn lineJoin(&self) -> CGLineJoin;
242
243        #[cfg(feature = "objc2-core-graphics")]
244        /// Setter for [`lineJoin`][Self::lineJoin].
245        #[unsafe(method(setLineJoin:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn setLineJoin(&self, line_join: CGLineJoin);
248
249        #[cfg(feature = "objc2-core-foundation")]
250        /// When a miter join is used, the maximum ratio of miter length to line with to be used
251        #[unsafe(method(miterLimit))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn miterLimit(&self) -> CGFloat;
254
255        #[cfg(feature = "objc2-core-foundation")]
256        /// Setter for [`miterLimit`][Self::miterLimit].
257        #[unsafe(method(setMiterLimit:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setMiterLimit(&self, miter_limit: CGFloat);
260
261        #[cfg(feature = "objc2-core-foundation")]
262        /// The length of the node's path if it were to be stroked
263        #[unsafe(method(lineLength))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn lineLength(&self) -> CGFloat;
266
267        #[cfg(feature = "SKTexture")]
268        #[unsafe(method(fillTexture))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn fillTexture(&self) -> Option<Retained<SKTexture>>;
271
272        #[cfg(feature = "SKTexture")]
273        /// Setter for [`fillTexture`][Self::fillTexture].
274        #[unsafe(method(setFillTexture:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn setFillTexture(&self, fill_texture: Option<&SKTexture>);
277
278        #[cfg(feature = "SKShader")]
279        #[unsafe(method(fillShader))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn fillShader(&self) -> Option<Retained<SKShader>>;
282
283        #[cfg(feature = "SKShader")]
284        /// Setter for [`fillShader`][Self::fillShader].
285        #[unsafe(method(setFillShader:))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn setFillShader(&self, fill_shader: Option<&SKShader>);
288
289        #[cfg(feature = "SKTexture")]
290        #[unsafe(method(strokeTexture))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn strokeTexture(&self) -> Option<Retained<SKTexture>>;
293
294        #[cfg(feature = "SKTexture")]
295        /// Setter for [`strokeTexture`][Self::strokeTexture].
296        #[unsafe(method(setStrokeTexture:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setStrokeTexture(&self, stroke_texture: Option<&SKTexture>);
299
300        #[cfg(feature = "SKShader")]
301        #[unsafe(method(strokeShader))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn strokeShader(&self) -> Option<Retained<SKShader>>;
304
305        #[cfg(feature = "SKShader")]
306        /// Setter for [`strokeShader`][Self::strokeShader].
307        #[unsafe(method(setStrokeShader:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setStrokeShader(&self, stroke_shader: Option<&SKShader>);
310
311        #[cfg(feature = "SKAttribute")]
312        /// Optional dictionary of SKAttributeValues
313        /// Attributes can be used with custom SKShaders.
314        #[unsafe(method(attributeValues))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
317
318        #[cfg(feature = "SKAttribute")]
319        /// Setter for [`attributeValues`][Self::attributeValues].
320        #[unsafe(method(setAttributeValues:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn setAttributeValues(
323            &self,
324            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
325        );
326
327        #[cfg(feature = "SKAttribute")]
328        #[unsafe(method(valueForAttributeNamed:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn valueForAttributeNamed(
331            &self,
332            key: &NSString,
333        ) -> Option<Retained<SKAttributeValue>>;
334
335        #[cfg(feature = "SKAttribute")]
336        #[unsafe(method(setValue:forAttributeNamed:))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
339    );
340}
341
342/// Methods declared on superclass `SKNode`.
343#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
344#[cfg(target_os = "macos")]
345impl SKShapeNode {
346    extern_methods!(
347        #[unsafe(method(init))]
348        #[unsafe(method_family = init)]
349        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
350
351        /// Support coding and decoding via NSKeyedArchiver.
352        #[unsafe(method(initWithCoder:))]
353        #[unsafe(method_family = init)]
354        pub unsafe fn initWithCoder(
355            this: Allocated<Self>,
356            a_decoder: &NSCoder,
357        ) -> Option<Retained<Self>>;
358
359        #[unsafe(method(node))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
362
363        #[unsafe(method(nodeWithFileNamed:))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn nodeWithFileNamed(
366            filename: &NSString,
367            mtm: MainThreadMarker,
368        ) -> Option<Retained<Self>>;
369
370        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
373            filename: &NSString,
374            classes: &NSSet<AnyClass>,
375            mtm: MainThreadMarker,
376        ) -> Result<Retained<Self>, Retained<NSError>>;
377    );
378}
379
380/// Methods declared on superclass `NSObject`.
381#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
382#[cfg(target_os = "macos")]
383impl SKShapeNode {
384    extern_methods!(
385        #[unsafe(method(new))]
386        #[unsafe(method_family = new)]
387        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
388    );
389}