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        #[unsafe(method(setAttributeValues:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setAttributeValues(
153            &self,
154            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
155        );
156
157        #[cfg(feature = "SKAttribute")]
158        #[unsafe(method(valueForAttributeNamed:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn valueForAttributeNamed(
161            &self,
162            key: &NSString,
163        ) -> Option<Retained<SKAttributeValue>>;
164
165        #[cfg(feature = "SKAttribute")]
166        #[unsafe(method(setValue:forAttributeNamed:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
169    );
170}
171
172/// Methods declared on superclass `SKNode`.
173#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
174#[cfg(target_os = "macos")]
175impl SKEffectNode {
176    extern_methods!(
177        #[unsafe(method(init))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
180
181        /// Support coding and decoding via NSKeyedArchiver.
182        #[unsafe(method(initWithCoder:))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn initWithCoder(
185            this: Allocated<Self>,
186            a_decoder: &NSCoder,
187        ) -> Option<Retained<Self>>;
188
189        #[unsafe(method(node))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
192
193        #[unsafe(method(nodeWithFileNamed:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn nodeWithFileNamed(
196            filename: &NSString,
197            mtm: MainThreadMarker,
198        ) -> Option<Retained<Self>>;
199
200        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
203            filename: &NSString,
204            classes: &NSSet<AnyClass>,
205            mtm: MainThreadMarker,
206        ) -> Result<Retained<Self>, Retained<NSError>>;
207    );
208}
209
210/// Methods declared on superclass `NSObject`.
211#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
212#[cfg(target_os = "macos")]
213impl SKEffectNode {
214    extern_methods!(
215        #[unsafe(method(new))]
216        #[unsafe(method_family = new)]
217        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
218    );
219}