objc2_sprite_kit/generated/
SKEffectNode.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-image")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_core_image::*;
12use objc2_foundation::*;
13
14use crate::*;
15
16extern_class!(
17    /// A SpriteKit node that applies frame buffer effects to the rendered results of its child nodes. This is done continuously on live content and is not a simple snapshot of the rendered result at one instant of time.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skeffectnode?language=objc)
20    #[unsafe(super(SKNode, NSResponder, NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
23    #[cfg(target_os = "macos")]
24    pub struct SKEffectNode;
25);
26
27#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
28#[cfg(target_os = "macos")]
29extern_conformance!(
30    unsafe impl NSCoding for SKEffectNode {}
31);
32
33#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
34#[cfg(target_os = "macos")]
35extern_conformance!(
36    unsafe impl NSCopying for SKEffectNode {}
37);
38
39#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
40#[cfg(target_os = "macos")]
41unsafe impl CopyingHelper for SKEffectNode {
42    type Result = Self;
43}
44
45#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
46#[cfg(target_os = "macos")]
47extern_conformance!(
48    unsafe impl NSObjectProtocol for SKEffectNode {}
49);
50
51#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
52#[cfg(target_os = "macos")]
53extern_conformance!(
54    unsafe impl NSSecureCoding for SKEffectNode {}
55);
56
57#[cfg(all(
58    feature = "SKNode",
59    feature = "SKWarpGeometry",
60    feature = "objc2-app-kit"
61))]
62#[cfg(target_os = "macos")]
63extern_conformance!(
64    unsafe impl SKWarpable for SKEffectNode {}
65);
66
67#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
68#[cfg(target_os = "macos")]
69impl SKEffectNode {
70    extern_methods!(
71        #[cfg(feature = "objc2-core-image")]
72        /// A CIFilter to be used as an effect
73        ///
74        /// Any CIFilter that requires only a single "inputImage" and produces an "outputImage" is allowed. The filter is applied to all children of the SKEffectNode. If the filter is nil, the children of this node is flattened before being drawn as long as the SKEffectNode is enabled.
75        #[unsafe(method(filter))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn filter(&self) -> Option<Retained<CIFilter>>;
78
79        #[cfg(feature = "objc2-core-image")]
80        /// Setter for [`filter`][Self::filter].
81        #[unsafe(method(setFilter:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setFilter(&self, filter: Option<&CIFilter>);
84
85        #[unsafe(method(shouldCenterFilter))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn shouldCenterFilter(&self) -> bool;
88
89        /// Setter for [`shouldCenterFilter`][Self::shouldCenterFilter].
90        #[unsafe(method(setShouldCenterFilter:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setShouldCenterFilter(&self, should_center_filter: bool);
93
94        /// Enable the SKEffectNode.
95        ///
96        /// The SKEffectNode has no effect when appliesEffects is not enabled, this is useful for setting up an effect to use later on. Defaults to YES.
97        #[unsafe(method(shouldEnableEffects))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn shouldEnableEffects(&self) -> bool;
100
101        /// Setter for [`shouldEnableEffects`][Self::shouldEnableEffects].
102        #[unsafe(method(setShouldEnableEffects:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setShouldEnableEffects(&self, should_enable_effects: bool);
105
106        /// Enable the rasterization on the SKEffectNode.
107        ///
108        /// The SKEffectNode's output is rasterized and cached internally. This cache is reused when rendering. When the SKEffectNode's children change, the cache is updated, but changing properties on the CIFilter does *not* cause an update (you must disable rasterization and then re-enable it for the changes to apply). This is more expensive than not rasterizing if the node's children change frequently, only enable this option if you know the children is largely static.
109        #[unsafe(method(shouldRasterize))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn shouldRasterize(&self) -> bool;
112
113        /// Setter for [`shouldRasterize`][Self::shouldRasterize].
114        #[unsafe(method(setShouldRasterize:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setShouldRasterize(&self, should_rasterize: bool);
117
118        /// Sets the blend mode to use when composing the effect with the final framebuffer.
119        ///
120        /// See: SKNode.SKBlendMode
121        #[unsafe(method(blendMode))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn blendMode(&self) -> SKBlendMode;
124
125        /// Setter for [`blendMode`][Self::blendMode].
126        #[unsafe(method(setBlendMode:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setBlendMode(&self, blend_mode: SKBlendMode);
129
130        #[cfg(feature = "SKShader")]
131        #[unsafe(method(shader))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn shader(&self) -> Option<Retained<SKShader>>;
134
135        #[cfg(feature = "SKShader")]
136        /// Setter for [`shader`][Self::shader].
137        #[unsafe(method(setShader:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setShader(&self, shader: Option<&SKShader>);
140
141        #[cfg(feature = "SKAttribute")]
142        /// Optional dictionary of SKAttributeValues
143        /// Attributes can be used with custom SKShaders.
144        #[unsafe(method(attributeValues))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
147
148        #[cfg(feature = "SKAttribute")]
149        /// Setter for [`attributeValues`][Self::attributeValues].
150        ///
151        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
152        #[unsafe(method(setAttributeValues:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setAttributeValues(
155            &self,
156            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
157        );
158
159        #[cfg(feature = "SKAttribute")]
160        #[unsafe(method(valueForAttributeNamed:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn valueForAttributeNamed(
163            &self,
164            key: &NSString,
165        ) -> Option<Retained<SKAttributeValue>>;
166
167        #[cfg(feature = "SKAttribute")]
168        #[unsafe(method(setValue:forAttributeNamed:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
171    );
172}
173
174/// Methods declared on superclass `SKNode`.
175#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
176#[cfg(target_os = "macos")]
177impl SKEffectNode {
178    extern_methods!(
179        #[unsafe(method(init))]
180        #[unsafe(method_family = init)]
181        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
182
183        /// Support coding and decoding via NSKeyedArchiver.
184        ///
185        /// # Safety
186        ///
187        /// `a_decoder` possibly has further requirements.
188        #[unsafe(method(initWithCoder:))]
189        #[unsafe(method_family = init)]
190        pub unsafe fn initWithCoder(
191            this: Allocated<Self>,
192            a_decoder: &NSCoder,
193        ) -> Option<Retained<Self>>;
194
195        #[unsafe(method(node))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
198
199        #[unsafe(method(nodeWithFileNamed:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn nodeWithFileNamed(
202            filename: &NSString,
203            mtm: MainThreadMarker,
204        ) -> Option<Retained<Self>>;
205
206        /// # Safety
207        ///
208        /// `classes` generic probably has further requirements.
209        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
212            filename: &NSString,
213            classes: &NSSet<AnyClass>,
214            mtm: MainThreadMarker,
215        ) -> Result<Retained<Self>, Retained<NSError>>;
216    );
217}
218
219/// Methods declared on superclass `NSObject`.
220#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
221#[cfg(target_os = "macos")]
222impl SKEffectNode {
223    extern_methods!(
224        #[unsafe(method(new))]
225        #[unsafe(method_family = new)]
226        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
227    );
228}