objc2_sprite_kit/generated/
SKMutableTexture.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    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skmutabletexture?language=objc)
19    #[unsafe(super(SKTexture, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(feature = "SKTexture")]
22    pub struct SKMutableTexture;
23);
24
25#[cfg(feature = "SKTexture")]
26unsafe impl NSCoding for SKMutableTexture {}
27
28#[cfg(feature = "SKTexture")]
29unsafe impl NSCopying for SKMutableTexture {}
30
31#[cfg(feature = "SKTexture")]
32unsafe impl CopyingHelper for SKMutableTexture {
33    type Result = Self;
34}
35
36#[cfg(feature = "SKTexture")]
37unsafe impl NSObjectProtocol for SKMutableTexture {}
38
39#[cfg(feature = "SKTexture")]
40unsafe impl NSSecureCoding for SKMutableTexture {}
41
42#[cfg(feature = "SKTexture")]
43impl SKMutableTexture {
44    extern_methods!(
45        #[cfg(feature = "objc2-core-foundation")]
46        /// Create a mutable texture with a specfic size.
47        ///
48        ///
49        /// Parameter `size`: the dimension to use when creating the given texture.
50        #[unsafe(method(initWithSize:))]
51        #[unsafe(method_family = init)]
52        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
53
54        #[cfg(feature = "objc2-core-foundation")]
55        #[unsafe(method(mutableTextureWithSize:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn mutableTextureWithSize(size: CGSize) -> Retained<Self>;
58
59        #[cfg(feature = "objc2-core-foundation")]
60        /// Create a mutable texture with a specfic size and type.
61        ///
62        ///
63        /// Parameter `size`: the dimension to use when creating the given texture.
64        ///
65        /// Parameter `format`: the CoreVideo format type.  supported types include 'RGBA', 'RGhA', and 'RGfA' for byte, half-float, and float components.
66        #[unsafe(method(initWithSize:pixelFormat:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithSize_pixelFormat(
69            this: Allocated<Self>,
70            size: CGSize,
71            format: c_int,
72        ) -> Retained<Self>;
73
74        #[cfg(feature = "block2")]
75        /// Modify the created mutable texture.
76        #[unsafe(method(modifyPixelDataWithBlock:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn modifyPixelDataWithBlock(
79            &self,
80            block: &block2::Block<dyn Fn(*mut c_void, usize)>,
81        );
82    );
83}
84
85/// Methods declared on superclass `SKTexture`.
86#[cfg(feature = "SKTexture")]
87impl SKMutableTexture {
88    extern_methods!(
89        /// Create a texture from an image file. Behaves similar to imageNamed: in UIImage or NSImage
90        ///
91        ///
92        /// Parameter `name`: the name or path of the image to load.
93        #[unsafe(method(textureWithImageNamed:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn textureWithImageNamed(name: &NSString) -> Retained<Self>;
96
97        #[cfg(feature = "objc2-core-foundation")]
98        /// Create a texture that is a subrect of an existing texture. See textureRect property for details.
99        ///
100        ///
101        /// Parameter `rect`: the source rectangle to use in creating a logical copy of the given texture.
102        ///
103        /// Parameter `texture`: the existing texture to reference in the copy.
104        #[unsafe(method(textureWithRect:inTexture:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn textureWithRect_inTexture(
107            rect: CGRect,
108            texture: &SKTexture,
109        ) -> Retained<Self>;
110
111        #[cfg(feature = "objc2-core-foundation")]
112        /// Create a texture containing directional noise. The RGBA values in this
113        /// texture can be used as a normal map or as direction possibly with length. XYZ are a three dimensional direction, and A is a magnitude.
114        ///
115        ///
116        /// Parameter `size`: the size of the resulting texture.
117        ///
118        /// Parameter `smoothness`: how similar neighboring pixels are. A value of zero is like static, one is smooth.
119        #[unsafe(method(textureVectorNoiseWithSmoothness:size:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn textureVectorNoiseWithSmoothness_size(
122            smoothness: CGFloat,
123            size: CGSize,
124        ) -> Retained<Self>;
125
126        #[cfg(feature = "objc2-core-foundation")]
127        /// Create a texture containing colored noise. The noise texture is tileable with itself.
128        ///
129        ///
130        /// Parameter `size`: the size of the resulting texture.
131        ///
132        /// Parameter `smoothness`: how similar neighboring pixels are. A value of zero is like static, one is smooth.
133        ///
134        /// Parameter `grayscale`: if YES, RGB and A will all be the same. If no, RGB and A will all be different. A is not pre-multiplied, because the intent is that if you read a texel in a shader, all four values will be exactly the same value if grayscale, or four different, uncorrelated values if not grayscale.
135        #[unsafe(method(textureNoiseWithSmoothness:size:grayscale:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn textureNoiseWithSmoothness_size_grayscale(
138            smoothness: CGFloat,
139            size: CGSize,
140            grayscale: bool,
141        ) -> Retained<Self>;
142
143        #[cfg(feature = "objc2-core-graphics")]
144        /// Create a texture from a CGImageRef.
145        ///
146        ///
147        /// Parameter `image`: the CGImageRef to create the texture from
148        #[unsafe(method(textureWithCGImage:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn textureWithCGImage(image: &CGImage) -> Retained<Self>;
151
152        #[cfg(feature = "objc2-app-kit")]
153        #[cfg(target_os = "macos")]
154        #[unsafe(method(textureWithImage:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn textureWithImage(image: &NSImage) -> Retained<Self>;
157
158        #[cfg(feature = "objc2-core-foundation")]
159        /// Create new texture with bitmap RGBA data in unsigned bytes. Data is copied once, additional changes to the data does not affect the texture. All pixel data is assumed to be premultiplied alpha.
160        ///
161        ///
162        /// Parameter `pixelData`: the pixelData to read in creating the texture.
163        ///
164        /// Parameter `size`: the dimensions of the pixelData given.
165        #[unsafe(method(textureWithData:size:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn textureWithData_size(pixel_data: &NSData, size: CGSize) -> Retained<Self>;
168
169        #[cfg(feature = "objc2-core-foundation")]
170        #[unsafe(method(textureWithData:size:flipped:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn textureWithData_size_flipped(
173            pixel_data: &NSData,
174            size: CGSize,
175            flipped: bool,
176        ) -> Retained<Self>;
177
178        #[cfg(feature = "objc2-core-foundation")]
179        /// Create new texture with bitmap RGBA data in unsigned bytes using a custom row length and row alignment. Data is copied once, additional changes to the data does not affect the texture. All pixel data is assumed to be premultiplied alpha.
180        ///
181        ///
182        /// Parameter `pixelData`: the data to use
183        ///
184        /// Parameter `size`: the size in texels
185        ///
186        /// Parameter `rowLength`: the length of each row in pixels (allows byte row pitches greater than the width for aligned data)
187        ///
188        /// Parameter `alignment`: the byte alignment of the data, provide 0 for tightly packed data.
189        #[unsafe(method(textureWithData:size:rowLength:alignment:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn textureWithData_size_rowLength_alignment(
192            pixel_data: &NSData,
193            size: CGSize,
194            row_length: c_uint,
195            alignment: c_uint,
196        ) -> Retained<Self>;
197    );
198}
199
200/// Methods declared on superclass `NSObject`.
201#[cfg(feature = "SKTexture")]
202impl SKMutableTexture {
203    extern_methods!(
204        #[unsafe(method(init))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
207
208        #[unsafe(method(new))]
209        #[unsafe(method_family = new)]
210        pub unsafe fn new() -> Retained<Self>;
211    );
212}