objc2_io_surface/generated/
ObjC.rs1use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-foundation")]
8use objc2_foundation::*;
9
10use crate::*;
11
12#[cfg(feature = "objc2-foundation")]
15pub type IOSurfacePropertyKey = NSString;
16
17extern "C" {
18 #[cfg(feature = "objc2-foundation")]
20 pub static IOSurfacePropertyKeyAllocSize: &'static IOSurfacePropertyKey;
21}
22
23extern "C" {
24 #[cfg(feature = "objc2-foundation")]
26 pub static IOSurfacePropertyKeyWidth: &'static IOSurfacePropertyKey;
27}
28
29extern "C" {
30 #[cfg(feature = "objc2-foundation")]
32 pub static IOSurfacePropertyKeyHeight: &'static IOSurfacePropertyKey;
33}
34
35extern "C" {
36 #[cfg(feature = "objc2-foundation")]
38 pub static IOSurfacePropertyKeyBytesPerRow: &'static IOSurfacePropertyKey;
39}
40
41extern "C" {
42 #[cfg(feature = "objc2-foundation")]
44 pub static IOSurfacePropertyKeyBytesPerElement: &'static IOSurfacePropertyKey;
45}
46
47extern "C" {
48 #[cfg(feature = "objc2-foundation")]
50 pub static IOSurfacePropertyKeyElementWidth: &'static IOSurfacePropertyKey;
51}
52
53extern "C" {
54 #[cfg(feature = "objc2-foundation")]
56 pub static IOSurfacePropertyKeyElementHeight: &'static IOSurfacePropertyKey;
57}
58
59extern "C" {
60 #[cfg(feature = "objc2-foundation")]
62 pub static IOSurfacePropertyKeyOffset: &'static IOSurfacePropertyKey;
63}
64
65extern "C" {
66 #[cfg(feature = "objc2-foundation")]
68 pub static IOSurfacePropertyKeyPlaneInfo: &'static IOSurfacePropertyKey;
69}
70
71extern "C" {
72 #[cfg(feature = "objc2-foundation")]
74 pub static IOSurfacePropertyKeyPlaneWidth: &'static IOSurfacePropertyKey;
75}
76
77extern "C" {
78 #[cfg(feature = "objc2-foundation")]
80 pub static IOSurfacePropertyKeyPlaneHeight: &'static IOSurfacePropertyKey;
81}
82
83extern "C" {
84 #[cfg(feature = "objc2-foundation")]
86 pub static IOSurfacePropertyKeyPlaneBytesPerRow: &'static IOSurfacePropertyKey;
87}
88
89extern "C" {
90 #[cfg(feature = "objc2-foundation")]
92 pub static IOSurfacePropertyKeyPlaneOffset: &'static IOSurfacePropertyKey;
93}
94
95extern "C" {
96 #[cfg(feature = "objc2-foundation")]
98 pub static IOSurfacePropertyKeyPlaneSize: &'static IOSurfacePropertyKey;
99}
100
101extern "C" {
102 #[cfg(feature = "objc2-foundation")]
104 pub static IOSurfacePropertyKeyPlaneBase: &'static IOSurfacePropertyKey;
105}
106
107extern "C" {
108 #[cfg(feature = "objc2-foundation")]
110 pub static IOSurfacePropertyKeyPlaneBytesPerElement: &'static IOSurfacePropertyKey;
111}
112
113extern "C" {
114 #[cfg(feature = "objc2-foundation")]
116 pub static IOSurfacePropertyKeyPlaneElementWidth: &'static IOSurfacePropertyKey;
117}
118
119extern "C" {
120 #[cfg(feature = "objc2-foundation")]
122 pub static IOSurfacePropertyKeyPlaneElementHeight: &'static IOSurfacePropertyKey;
123}
124
125extern "C" {
126 #[cfg(feature = "objc2-foundation")]
128 pub static IOSurfacePropertyKeyCacheMode: &'static IOSurfacePropertyKey;
129}
130
131extern "C" {
132 #[cfg(feature = "objc2-foundation")]
134 pub static IOSurfacePropertyKeyPixelFormat: &'static IOSurfacePropertyKey;
135}
136
137extern "C" {
138 #[cfg(feature = "objc2-foundation")]
140 pub static IOSurfacePropertyKeyPixelSizeCastingAllowed: &'static IOSurfacePropertyKey;
141}
142
143extern "C" {
144 #[cfg(feature = "objc2-foundation")]
146 pub static IOSurfacePropertyKeyName: &'static IOSurfacePropertyKey;
147}
148
149#[cfg(feature = "objc2")]
150extern_class!(
151 #[unsafe(super(NSObject))]
153 #[derive(Debug, PartialEq, Eq, Hash)]
154 #[cfg(feature = "objc2")]
155 pub struct IOSurface;
156);
157
158#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
159unsafe impl NSCoding for IOSurface {}
160
161#[cfg(feature = "objc2")]
162unsafe impl NSObjectProtocol for IOSurface {}
163
164#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
165unsafe impl NSSecureCoding for IOSurface {}
166
167#[cfg(feature = "objc2")]
168impl IOSurface {
169 extern_methods!(
170 #[cfg(feature = "objc2-foundation")]
171 #[unsafe(method(initWithProperties:))]
172 #[unsafe(method_family = init)]
173 pub unsafe fn initWithProperties(
174 this: Allocated<Self>,
175 properties: &NSDictionary<IOSurfacePropertyKey, AnyObject>,
176 ) -> Option<Retained<Self>>;
177
178 #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
179 #[unsafe(method(lockWithOptions:seed:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn lockWithOptions_seed(
182 &self,
183 options: IOSurfaceLockOptions,
184 seed: *mut u32,
185 ) -> libc::kern_return_t;
186
187 #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
188 #[unsafe(method(unlockWithOptions:seed:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn unlockWithOptions_seed(
191 &self,
192 options: IOSurfaceLockOptions,
193 seed: *mut u32,
194 ) -> libc::kern_return_t;
195
196 #[unsafe(method(allocationSize))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn allocationSize(&self) -> NSInteger;
199
200 #[unsafe(method(width))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn width(&self) -> NSInteger;
203
204 #[unsafe(method(height))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn height(&self) -> NSInteger;
207
208 #[unsafe(method(baseAddress))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn baseAddress(&self) -> NonNull<c_void>;
211
212 #[unsafe(method(pixelFormat))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn pixelFormat(&self) -> OSType;
215
216 #[unsafe(method(bytesPerRow))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn bytesPerRow(&self) -> NSInteger;
219
220 #[unsafe(method(bytesPerElement))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn bytesPerElement(&self) -> NSInteger;
223
224 #[unsafe(method(elementWidth))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn elementWidth(&self) -> NSInteger;
227
228 #[unsafe(method(elementHeight))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn elementHeight(&self) -> NSInteger;
231
232 #[unsafe(method(surfaceID))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn surfaceID(&self) -> u32;
235
236 #[unsafe(method(seed))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn seed(&self) -> u32;
239
240 #[unsafe(method(planeCount))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn planeCount(&self) -> NSUInteger;
243
244 #[unsafe(method(widthOfPlaneAtIndex:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn widthOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
247
248 #[unsafe(method(heightOfPlaneAtIndex:))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn heightOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
251
252 #[unsafe(method(bytesPerRowOfPlaneAtIndex:))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn bytesPerRowOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
255
256 #[unsafe(method(bytesPerElementOfPlaneAtIndex:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn bytesPerElementOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
259
260 #[unsafe(method(elementWidthOfPlaneAtIndex:))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn elementWidthOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
263
264 #[unsafe(method(elementHeightOfPlaneAtIndex:))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn elementHeightOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
267
268 #[unsafe(method(baseAddressOfPlaneAtIndex:))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn baseAddressOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NonNull<c_void>;
271
272 #[cfg(feature = "objc2-foundation")]
273 #[unsafe(method(setAttachment:forKey:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn setAttachment_forKey(&self, an_object: &AnyObject, key: &NSString);
276
277 #[cfg(feature = "objc2-foundation")]
278 #[unsafe(method(attachmentForKey:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn attachmentForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
281
282 #[cfg(feature = "objc2-foundation")]
283 #[unsafe(method(removeAttachmentForKey:))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn removeAttachmentForKey(&self, key: &NSString);
286
287 #[cfg(feature = "objc2-foundation")]
288 #[unsafe(method(setAllAttachments:))]
289 #[unsafe(method_family = none)]
290 pub unsafe fn setAllAttachments(&self, dict: &NSDictionary<NSString, AnyObject>);
291
292 #[cfg(feature = "objc2-foundation")]
293 #[unsafe(method(allAttachments))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn allAttachments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
296
297 #[unsafe(method(removeAllAttachments))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn removeAllAttachments(&self);
300
301 #[unsafe(method(isInUse))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn isInUse(&self) -> bool;
304
305 #[unsafe(method(incrementUseCount))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn incrementUseCount(&self);
308
309 #[unsafe(method(decrementUseCount))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn decrementUseCount(&self);
312
313 #[unsafe(method(localUseCount))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn localUseCount(&self) -> i32;
316
317 #[unsafe(method(allowsPixelSizeCasting))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn allowsPixelSizeCasting(&self) -> bool;
320
321 #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
322 #[unsafe(method(setPurgeable:oldState:))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn setPurgeable_oldState(
325 &self,
326 new_state: IOSurfacePurgeabilityState,
327 old_state: *mut IOSurfacePurgeabilityState,
328 ) -> libc::kern_return_t;
329 );
330}
331
332#[cfg(feature = "objc2")]
334impl IOSurface {
335 extern_methods!(
336 #[unsafe(method(init))]
337 #[unsafe(method_family = init)]
338 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
339
340 #[unsafe(method(new))]
341 #[unsafe(method_family = new)]
342 pub unsafe fn new() -> Retained<Self>;
343 );
344}
345
346extern "C" {
347 #[cfg(feature = "objc2-foundation")]
349 pub static IOSurfacePropertyAllocSizeKey: &'static IOSurfacePropertyKey;
350}