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