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