objc2_sprite_kit/generated/
SKTexture.rs1use 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::*;
13#[cfg(feature = "objc2-core-image")]
14#[cfg(not(target_os = "watchos"))]
15use objc2_core_image::*;
16use objc2_foundation::*;
17
18use crate::*;
19
20#[repr(transparent)]
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
24pub struct SKTextureFilteringMode(pub NSInteger);
25impl SKTextureFilteringMode {
26 #[doc(alias = "SKTextureFilteringNearest")]
27 pub const Nearest: Self = Self(0);
28 #[doc(alias = "SKTextureFilteringLinear")]
29 pub const Linear: Self = Self(1);
30}
31
32unsafe impl Encode for SKTextureFilteringMode {
33 const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for SKTextureFilteringMode {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41 #[unsafe(super(NSObject))]
45 #[derive(Debug, PartialEq, Eq, Hash)]
46 pub struct SKTexture;
47);
48
49extern_conformance!(
50 unsafe impl NSCoding for SKTexture {}
51);
52
53extern_conformance!(
54 unsafe impl NSCopying for SKTexture {}
55);
56
57unsafe impl CopyingHelper for SKTexture {
58 type Result = Self;
59}
60
61extern_conformance!(
62 unsafe impl NSObjectProtocol for SKTexture {}
63);
64
65extern_conformance!(
66 unsafe impl NSSecureCoding for SKTexture {}
67);
68
69impl SKTexture {
70 extern_methods!(
71 #[unsafe(method(textureWithImageNamed:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn textureWithImageNamed(name: &NSString) -> Retained<Self>;
78
79 #[cfg(feature = "objc2-core-foundation")]
80 #[unsafe(method(textureWithRect:inTexture:))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn textureWithRect_inTexture(
89 rect: CGRect,
90 texture: &SKTexture,
91 ) -> Retained<Self>;
92
93 #[cfg(feature = "objc2-core-foundation")]
94 #[unsafe(method(textureVectorNoiseWithSmoothness:size:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn textureVectorNoiseWithSmoothness_size(
104 smoothness: CGFloat,
105 size: CGSize,
106 ) -> Retained<Self>;
107
108 #[cfg(feature = "objc2-core-foundation")]
109 #[unsafe(method(textureNoiseWithSmoothness:size:grayscale:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn textureNoiseWithSmoothness_size_grayscale(
120 smoothness: CGFloat,
121 size: CGSize,
122 grayscale: bool,
123 ) -> Retained<Self>;
124
125 #[cfg(feature = "objc2-core-graphics")]
126 #[unsafe(method(textureWithCGImage:))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn textureWithCGImage(image: &CGImage) -> Retained<Self>;
133
134 #[cfg(feature = "objc2-app-kit")]
135 #[cfg(target_os = "macos")]
136 #[unsafe(method(textureWithImage:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn textureWithImage(image: &NSImage) -> Retained<Self>;
139
140 #[cfg(feature = "objc2-core-foundation")]
141 #[unsafe(method(textureWithData:size:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn textureWithData_size(pixel_data: &NSData, size: CGSize) -> Retained<Self>;
150
151 #[cfg(feature = "objc2-core-foundation")]
152 #[unsafe(method(textureWithData:size:flipped:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn textureWithData_size_flipped(
155 pixel_data: &NSData,
156 size: CGSize,
157 flipped: bool,
158 ) -> Retained<Self>;
159
160 #[cfg(feature = "objc2-core-foundation")]
161 #[unsafe(method(textureWithData:size:rowLength:alignment:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn textureWithData_size_rowLength_alignment(
174 pixel_data: &NSData,
175 size: CGSize,
176 row_length: c_uint,
177 alignment: c_uint,
178 ) -> Retained<Self>;
179
180 #[cfg(feature = "objc2-core-image")]
181 #[cfg(not(target_os = "watchos"))]
182 #[unsafe(method(textureByApplyingCIFilter:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn textureByApplyingCIFilter(&self, filter: &CIFilter) -> Retained<Self>;
189
190 #[unsafe(method(textureByGeneratingNormalMap))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn textureByGeneratingNormalMap(&self) -> Retained<Self>;
194
195 #[cfg(feature = "objc2-core-foundation")]
196 #[unsafe(method(textureByGeneratingNormalMapWithSmoothness:contrast:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn textureByGeneratingNormalMapWithSmoothness_contrast(
205 &self,
206 smoothness: CGFloat,
207 contrast: CGFloat,
208 ) -> Retained<Self>;
209
210 #[cfg(feature = "objc2-core-foundation")]
211 #[unsafe(method(textureRect))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn textureRect(&self) -> CGRect;
215
216 #[cfg(feature = "objc2-core-foundation")]
217 #[unsafe(method(size))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn size(&self) -> CGSize;
221
222 #[unsafe(method(filteringMode))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn filteringMode(&self) -> SKTextureFilteringMode;
226
227 #[unsafe(method(setFilteringMode:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn setFilteringMode(&self, filtering_mode: SKTextureFilteringMode);
231
232 #[unsafe(method(usesMipmaps))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn usesMipmaps(&self) -> bool;
236
237 #[unsafe(method(setUsesMipmaps:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setUsesMipmaps(&self, uses_mipmaps: bool);
241
242 #[cfg(feature = "objc2-core-graphics")]
243 #[unsafe(method(CGImage))]
245 #[unsafe(method_family = copy)]
247 pub unsafe fn CGImage(&self) -> Retained<CGImage>;
248
249 #[cfg(feature = "block2")]
250 #[unsafe(method(preloadTextures:withCompletionHandler:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn preloadTextures_withCompletionHandler(
259 textures: &NSArray<SKTexture>,
260 completion_handler: &block2::DynBlock<dyn Fn()>,
261 );
262
263 #[cfg(feature = "block2")]
264 #[unsafe(method(preloadWithCompletionHandler:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn preloadWithCompletionHandler(
268 &self,
269 completion_handler: &block2::DynBlock<dyn Fn()>,
270 );
271 );
272}
273
274impl SKTexture {
276 extern_methods!(
277 #[unsafe(method(init))]
278 #[unsafe(method_family = init)]
279 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
280
281 #[unsafe(method(new))]
282 #[unsafe(method_family = new)]
283 pub unsafe fn new() -> Retained<Self>;
284 );
285}