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