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