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
155unsafe impl Send for IOSurface {}
156
157unsafe impl Sync for IOSurface {}
158
159#[cfg(feature = "objc2-foundation")]
160extern_conformance!(
161 unsafe impl NSCoding for IOSurface {}
162);
163
164extern_conformance!(
165 unsafe impl NSObjectProtocol for IOSurface {}
166);
167
168#[cfg(feature = "objc2-foundation")]
169extern_conformance!(
170 unsafe impl NSSecureCoding for IOSurface {}
171);
172
173impl IOSurface {
174 extern_methods!(
175 #[cfg(feature = "objc2-foundation")]
176 #[unsafe(method(initWithProperties:))]
177 #[unsafe(method_family = init)]
178 pub fn initWithProperties(
179 this: Allocated<Self>,
180 properties: &NSDictionary<IOSurfacePropertyKey, AnyObject>,
181 ) -> Option<Retained<Self>>;
182
183 #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
184 #[unsafe(method(lockWithOptions:seed:))]
185 #[unsafe(method_family = none)]
186 pub fn lockWithOptions_seed(
187 &self,
188 options: IOSurfaceLockOptions,
189 seed: *mut u32,
190 ) -> libc::kern_return_t;
191
192 #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
193 #[unsafe(method(unlockWithOptions:seed:))]
194 #[unsafe(method_family = none)]
195 pub fn unlockWithOptions_seed(
196 &self,
197 options: IOSurfaceLockOptions,
198 seed: *mut u32,
199 ) -> libc::kern_return_t;
200
201 #[unsafe(method(allocationSize))]
202 #[unsafe(method_family = none)]
203 pub fn allocationSize(&self) -> NSInteger;
204
205 #[unsafe(method(width))]
206 #[unsafe(method_family = none)]
207 pub fn width(&self) -> NSInteger;
208
209 #[unsafe(method(height))]
210 #[unsafe(method_family = none)]
211 pub fn height(&self) -> NSInteger;
212
213 #[unsafe(method(baseAddress))]
214 #[unsafe(method_family = none)]
215 pub fn baseAddress(&self) -> NonNull<c_void>;
216
217 #[unsafe(method(pixelFormat))]
218 #[unsafe(method_family = none)]
219 pub fn pixelFormat(&self) -> OSType;
220
221 #[unsafe(method(bytesPerRow))]
222 #[unsafe(method_family = none)]
223 pub fn bytesPerRow(&self) -> NSInteger;
224
225 #[unsafe(method(bytesPerElement))]
226 #[unsafe(method_family = none)]
227 pub fn bytesPerElement(&self) -> NSInteger;
228
229 #[unsafe(method(elementWidth))]
230 #[unsafe(method_family = none)]
231 pub fn elementWidth(&self) -> NSInteger;
232
233 #[unsafe(method(elementHeight))]
234 #[unsafe(method_family = none)]
235 pub fn elementHeight(&self) -> NSInteger;
236
237 #[unsafe(method(surfaceID))]
238 #[unsafe(method_family = none)]
239 pub fn surfaceID(&self) -> u32;
240
241 #[unsafe(method(seed))]
242 #[unsafe(method_family = none)]
243 pub fn seed(&self) -> u32;
244
245 #[unsafe(method(planeCount))]
246 #[unsafe(method_family = none)]
247 pub fn planeCount(&self) -> NSUInteger;
248
249 #[unsafe(method(widthOfPlaneAtIndex:))]
250 #[unsafe(method_family = none)]
251 pub fn widthOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
252
253 #[unsafe(method(heightOfPlaneAtIndex:))]
254 #[unsafe(method_family = none)]
255 pub fn heightOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
256
257 #[unsafe(method(bytesPerRowOfPlaneAtIndex:))]
258 #[unsafe(method_family = none)]
259 pub fn bytesPerRowOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
260
261 #[unsafe(method(bytesPerElementOfPlaneAtIndex:))]
262 #[unsafe(method_family = none)]
263 pub fn bytesPerElementOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
264
265 #[unsafe(method(elementWidthOfPlaneAtIndex:))]
266 #[unsafe(method_family = none)]
267 pub fn elementWidthOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
268
269 #[unsafe(method(elementHeightOfPlaneAtIndex:))]
270 #[unsafe(method_family = none)]
271 pub fn elementHeightOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;
272
273 #[unsafe(method(baseAddressOfPlaneAtIndex:))]
274 #[unsafe(method_family = none)]
275 pub fn baseAddressOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NonNull<c_void>;
276
277 #[cfg(feature = "objc2-foundation")]
278 #[unsafe(method(setAttachment:forKey:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn setAttachment_forKey(&self, an_object: &AnyObject, key: &NSString);
284
285 #[cfg(feature = "objc2-foundation")]
286 #[unsafe(method(attachmentForKey:))]
287 #[unsafe(method_family = none)]
288 pub fn attachmentForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
289
290 #[cfg(feature = "objc2-foundation")]
291 #[unsafe(method(removeAttachmentForKey:))]
292 #[unsafe(method_family = none)]
293 pub fn removeAttachmentForKey(&self, key: &NSString);
294
295 #[cfg(feature = "objc2-foundation")]
296 #[unsafe(method(setAllAttachments:))]
297 #[unsafe(method_family = none)]
298 pub fn setAllAttachments(&self, dict: &NSDictionary<NSString, AnyObject>);
299
300 #[cfg(feature = "objc2-foundation")]
301 #[unsafe(method(allAttachments))]
302 #[unsafe(method_family = none)]
303 pub fn allAttachments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
304
305 #[unsafe(method(removeAllAttachments))]
306 #[unsafe(method_family = none)]
307 pub fn removeAllAttachments(&self);
308
309 #[unsafe(method(isInUse))]
310 #[unsafe(method_family = none)]
311 pub fn isInUse(&self) -> bool;
312
313 #[unsafe(method(incrementUseCount))]
314 #[unsafe(method_family = none)]
315 pub fn incrementUseCount(&self);
316
317 #[unsafe(method(decrementUseCount))]
318 #[unsafe(method_family = none)]
319 pub fn decrementUseCount(&self);
320
321 #[unsafe(method(localUseCount))]
322 #[unsafe(method_family = none)]
323 pub fn localUseCount(&self) -> i32;
324
325 #[unsafe(method(allowsPixelSizeCasting))]
326 #[unsafe(method_family = none)]
327 pub fn allowsPixelSizeCasting(&self) -> bool;
328
329 #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
330 #[unsafe(method(setPurgeable:oldState:))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn setPurgeable_oldState(
336 &self,
337 new_state: IOSurfacePurgeabilityState,
338 old_state: *mut IOSurfacePurgeabilityState,
339 ) -> libc::kern_return_t;
340 );
341}
342
343impl IOSurface {
345 extern_methods!(
346 #[unsafe(method(init))]
347 #[unsafe(method_family = init)]
348 pub fn init(this: Allocated<Self>) -> Retained<Self>;
349
350 #[unsafe(method(new))]
351 #[unsafe(method_family = new)]
352 pub fn new() -> Retained<Self>;
353 );
354}
355
356impl DefaultRetained for IOSurface {
357 #[inline]
358 fn default_retained() -> Retained<Self> {
359 Self::new()
360 }
361}
362
363extern "C" {
364 #[cfg(feature = "objc2-foundation")]
366 #[deprecated]
367 pub static IOSurfacePropertyAllocSizeKey: &'static IOSurfacePropertyKey;
368}
369
370