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")]
29unsafe impl NSCoding for SKEffectNode {}
30
31#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
32#[cfg(target_os = "macos")]
33unsafe impl NSCopying for SKEffectNode {}
34
35#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
36#[cfg(target_os = "macos")]
37unsafe impl CopyingHelper for SKEffectNode {
38    type Result = Self;
39}
40
41#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
42#[cfg(target_os = "macos")]
43unsafe impl NSObjectProtocol for SKEffectNode {}
44
45#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
46#[cfg(target_os = "macos")]
47unsafe impl NSSecureCoding for SKEffectNode {}
48
49#[cfg(all(
50    feature = "SKNode",
51    feature = "SKWarpGeometry",
52    feature = "objc2-app-kit"
53))]
54#[cfg(target_os = "macos")]
55unsafe impl SKWarpable for SKEffectNode {}
56
57#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
58#[cfg(target_os = "macos")]
59impl SKEffectNode {
60    extern_methods!(
61        #[cfg(feature = "objc2-core-image")]
62        /// A CIFilter to be used as an effect
63        ///
64        /// 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.
65        #[unsafe(method(filter))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn filter(&self) -> Option<Retained<CIFilter>>;
68
69        #[cfg(feature = "objc2-core-image")]
70        /// Setter for [`filter`][Self::filter].
71        #[unsafe(method(setFilter:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn setFilter(&self, filter: Option<&CIFilter>);
74
75        #[unsafe(method(shouldCenterFilter))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn shouldCenterFilter(&self) -> bool;
78
79        /// Setter for [`shouldCenterFilter`][Self::shouldCenterFilter].
80        #[unsafe(method(setShouldCenterFilter:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setShouldCenterFilter(&self, should_center_filter: bool);
83
84        /// Enable the SKEffectNode.
85        ///
86        /// 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.
87        #[unsafe(method(shouldEnableEffects))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn shouldEnableEffects(&self) -> bool;
90
91        /// Setter for [`shouldEnableEffects`][Self::shouldEnableEffects].
92        #[unsafe(method(setShouldEnableEffects:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn setShouldEnableEffects(&self, should_enable_effects: bool);
95
96        /// Enable the rasterization on the SKEffectNode.
97        ///
98        /// 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.
99        #[unsafe(method(shouldRasterize))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn shouldRasterize(&self) -> bool;
102
103        /// Setter for [`shouldRasterize`][Self::shouldRasterize].
104        #[unsafe(method(setShouldRasterize:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setShouldRasterize(&self, should_rasterize: bool);
107
108        /// Sets the blend mode to use when composing the effect with the final framebuffer.
109        ///
110        /// See: SKNode.SKBlendMode
111        #[unsafe(method(blendMode))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn blendMode(&self) -> SKBlendMode;
114
115        /// Setter for [`blendMode`][Self::blendMode].
116        #[unsafe(method(setBlendMode:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setBlendMode(&self, blend_mode: SKBlendMode);
119
120        #[cfg(feature = "SKShader")]
121        #[unsafe(method(shader))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn shader(&self) -> Option<Retained<SKShader>>;
124
125        #[cfg(feature = "SKShader")]
126        /// Setter for [`shader`][Self::shader].
127        #[unsafe(method(setShader:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setShader(&self, shader: Option<&SKShader>);
130
131        #[cfg(feature = "SKAttribute")]
132        /// Optional dictionary of SKAttributeValues
133        /// Attributes can be used with custom SKShaders.
134        #[unsafe(method(attributeValues))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
137
138        #[cfg(feature = "SKAttribute")]
139        /// Setter for [`attributeValues`][Self::attributeValues].
140        #[unsafe(method(setAttributeValues:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setAttributeValues(
143            &self,
144            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
145        );
146
147        #[cfg(feature = "SKAttribute")]
148        #[unsafe(method(valueForAttributeNamed:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn valueForAttributeNamed(
151            &self,
152            key: &NSString,
153        ) -> Option<Retained<SKAttributeValue>>;
154
155        #[cfg(feature = "SKAttribute")]
156        #[unsafe(method(setValue:forAttributeNamed:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
159    );
160}
161
162/// Methods declared on superclass `SKNode`.
163#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
164#[cfg(target_os = "macos")]
165impl SKEffectNode {
166    extern_methods!(
167        #[unsafe(method(init))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
170
171        /// Support coding and decoding via NSKeyedArchiver.
172        #[unsafe(method(initWithCoder:))]
173        #[unsafe(method_family = init)]
174        pub unsafe fn initWithCoder(
175            this: Allocated<Self>,
176            a_decoder: &NSCoder,
177        ) -> Option<Retained<Self>>;
178
179        #[unsafe(method(node))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
182
183        #[unsafe(method(nodeWithFileNamed:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn nodeWithFileNamed(
186            filename: &NSString,
187            mtm: MainThreadMarker,
188        ) -> Option<Retained<Self>>;
189
190        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
193            filename: &NSString,
194            classes: &NSSet<AnyClass>,
195            mtm: MainThreadMarker,
196        ) -> Result<Retained<Self>, Retained<NSError>>;
197    );
198}
199
200/// Methods declared on superclass `NSObject`.
201#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
202#[cfg(target_os = "macos")]
203impl SKEffectNode {
204    extern_methods!(
205        #[unsafe(method(new))]
206        #[unsafe(method_family = new)]
207        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
208    );
209}