objc2_io_surface/generated/
IOSurfaceRef.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-core-foundation")]
8use objc2_core_foundation::*;
9
10use crate::*;
11
12extern "C" {
13    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceallocsize?language=objc)
14    #[cfg(feature = "objc2-core-foundation")]
15    pub static kIOSurfaceAllocSize: &'static CFString;
16}
17
18extern "C" {
19    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacewidth?language=objc)
20    #[cfg(feature = "objc2-core-foundation")]
21    pub static kIOSurfaceWidth: &'static CFString;
22}
23
24extern "C" {
25    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceheight?language=objc)
26    #[cfg(feature = "objc2-core-foundation")]
27    pub static kIOSurfaceHeight: &'static CFString;
28}
29
30extern "C" {
31    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacebytesperrow?language=objc)
32    #[cfg(feature = "objc2-core-foundation")]
33    pub static kIOSurfaceBytesPerRow: &'static CFString;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacebytesperelement?language=objc)
38    #[cfg(feature = "objc2-core-foundation")]
39    pub static kIOSurfaceBytesPerElement: &'static CFString;
40}
41
42extern "C" {
43    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceelementwidth?language=objc)
44    #[cfg(feature = "objc2-core-foundation")]
45    pub static kIOSurfaceElementWidth: &'static CFString;
46}
47
48extern "C" {
49    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceelementheight?language=objc)
50    #[cfg(feature = "objc2-core-foundation")]
51    pub static kIOSurfaceElementHeight: &'static CFString;
52}
53
54extern "C" {
55    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceoffset?language=objc)
56    #[cfg(feature = "objc2-core-foundation")]
57    pub static kIOSurfaceOffset: &'static CFString;
58}
59
60extern "C" {
61    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplaneinfo?language=objc)
62    #[cfg(feature = "objc2-core-foundation")]
63    pub static kIOSurfacePlaneInfo: &'static CFString;
64}
65
66extern "C" {
67    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanewidth?language=objc)
68    #[cfg(feature = "objc2-core-foundation")]
69    pub static kIOSurfacePlaneWidth: &'static CFString;
70}
71
72extern "C" {
73    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplaneheight?language=objc)
74    #[cfg(feature = "objc2-core-foundation")]
75    pub static kIOSurfacePlaneHeight: &'static CFString;
76}
77
78extern "C" {
79    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanebytesperrow?language=objc)
80    #[cfg(feature = "objc2-core-foundation")]
81    pub static kIOSurfacePlaneBytesPerRow: &'static CFString;
82}
83
84extern "C" {
85    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplaneoffset?language=objc)
86    #[cfg(feature = "objc2-core-foundation")]
87    pub static kIOSurfacePlaneOffset: &'static CFString;
88}
89
90extern "C" {
91    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanesize?language=objc)
92    #[cfg(feature = "objc2-core-foundation")]
93    pub static kIOSurfacePlaneSize: &'static CFString;
94}
95
96extern "C" {
97    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanebase?language=objc)
98    #[cfg(feature = "objc2-core-foundation")]
99    pub static kIOSurfacePlaneBase: &'static CFString;
100}
101
102extern "C" {
103    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanebitsperelement?language=objc)
104    #[cfg(feature = "objc2-core-foundation")]
105    pub static kIOSurfacePlaneBitsPerElement: &'static CFString;
106}
107
108extern "C" {
109    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanebytesperelement?language=objc)
110    #[cfg(feature = "objc2-core-foundation")]
111    pub static kIOSurfacePlaneBytesPerElement: &'static CFString;
112}
113
114extern "C" {
115    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplaneelementwidth?language=objc)
116    #[cfg(feature = "objc2-core-foundation")]
117    pub static kIOSurfacePlaneElementWidth: &'static CFString;
118}
119
120extern "C" {
121    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplaneelementheight?language=objc)
122    #[cfg(feature = "objc2-core-foundation")]
123    pub static kIOSurfacePlaneElementHeight: &'static CFString;
124}
125
126extern "C" {
127    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacecachemode?language=objc)
128    #[cfg(feature = "objc2-core-foundation")]
129    pub static kIOSurfaceCacheMode: &'static CFString;
130}
131
132extern "C" {
133    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceisglobal?language=objc)
134    #[cfg(feature = "objc2-core-foundation")]
135    pub static kIOSurfaceIsGlobal: &'static CFString;
136}
137
138extern "C" {
139    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacepixelformat?language=objc)
140    #[cfg(feature = "objc2-core-foundation")]
141    pub static kIOSurfacePixelFormat: &'static CFString;
142}
143
144extern "C" {
145    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacepixelsizecastingallowed?language=objc)
146    #[cfg(feature = "objc2-core-foundation")]
147    pub static kIOSurfacePixelSizeCastingAllowed: &'static CFString;
148}
149
150extern "C" {
151    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanecomponentbitdepths?language=objc)
152    #[cfg(feature = "objc2-core-foundation")]
153    pub static kIOSurfacePlaneComponentBitDepths: &'static CFString;
154}
155
156extern "C" {
157    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanecomponentbitoffsets?language=objc)
158    #[cfg(feature = "objc2-core-foundation")]
159    pub static kIOSurfacePlaneComponentBitOffsets: &'static CFString;
160}
161
162extern "C" {
163    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacename?language=objc)
164    #[cfg(feature = "objc2-core-foundation")]
165    pub static kIOSurfaceName: &'static CFString;
166}
167
168/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacecomponentname?language=objc)
169// NS_ENUM
170#[repr(transparent)]
171#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
172pub struct IOSurfaceComponentName(pub i32);
173impl IOSurfaceComponentName {
174    #[doc(alias = "kIOSurfaceComponentNameUnknown")]
175    pub const Unknown: Self = Self(0);
176    #[doc(alias = "kIOSurfaceComponentNameAlpha")]
177    pub const Alpha: Self = Self(1);
178    #[doc(alias = "kIOSurfaceComponentNameRed")]
179    pub const Red: Self = Self(2);
180    #[doc(alias = "kIOSurfaceComponentNameGreen")]
181    pub const Green: Self = Self(3);
182    #[doc(alias = "kIOSurfaceComponentNameBlue")]
183    pub const Blue: Self = Self(4);
184    #[doc(alias = "kIOSurfaceComponentNameLuma")]
185    pub const Luma: Self = Self(5);
186    #[doc(alias = "kIOSurfaceComponentNameChromaRed")]
187    pub const ChromaRed: Self = Self(6);
188    #[doc(alias = "kIOSurfaceComponentNameChromaBlue")]
189    pub const ChromaBlue: Self = Self(7);
190}
191
192#[cfg(feature = "objc2")]
193unsafe impl Encode for IOSurfaceComponentName {
194    const ENCODING: Encoding = i32::ENCODING;
195}
196
197#[cfg(feature = "objc2")]
198unsafe impl RefEncode for IOSurfaceComponentName {
199    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
200}
201
202extern "C" {
203    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanecomponentnames?language=objc)
204    #[cfg(feature = "objc2-core-foundation")]
205    pub static kIOSurfacePlaneComponentNames: &'static CFString;
206}
207
208/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacecomponenttype?language=objc)
209// NS_ENUM
210#[repr(transparent)]
211#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
212pub struct IOSurfaceComponentType(pub i32);
213impl IOSurfaceComponentType {
214    #[doc(alias = "kIOSurfaceComponentTypeUnknown")]
215    pub const Unknown: Self = Self(0);
216    #[doc(alias = "kIOSurfaceComponentTypeUnsignedInteger")]
217    pub const UnsignedInteger: Self = Self(1);
218    #[doc(alias = "kIOSurfaceComponentTypeSignedInteger")]
219    pub const SignedInteger: Self = Self(2);
220    #[doc(alias = "kIOSurfaceComponentTypeFloat")]
221    pub const Float: Self = Self(3);
222    #[doc(alias = "kIOSurfaceComponentTypeSignedNormalized")]
223    pub const SignedNormalized: Self = Self(4);
224}
225
226#[cfg(feature = "objc2")]
227unsafe impl Encode for IOSurfaceComponentType {
228    const ENCODING: Encoding = i32::ENCODING;
229}
230
231#[cfg(feature = "objc2")]
232unsafe impl RefEncode for IOSurfaceComponentType {
233    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
234}
235
236extern "C" {
237    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanecomponenttypes?language=objc)
238    #[cfg(feature = "objc2-core-foundation")]
239    pub static kIOSurfacePlaneComponentTypes: &'static CFString;
240}
241
242/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacecomponentrange?language=objc)
243// NS_ENUM
244#[repr(transparent)]
245#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
246pub struct IOSurfaceComponentRange(pub i32);
247impl IOSurfaceComponentRange {
248    #[doc(alias = "kIOSurfaceComponentRangeUnknown")]
249    pub const Unknown: Self = Self(0);
250    #[doc(alias = "kIOSurfaceComponentRangeFullRange")]
251    pub const FullRange: Self = Self(1);
252    #[doc(alias = "kIOSurfaceComponentRangeVideoRange")]
253    pub const VideoRange: Self = Self(2);
254    #[doc(alias = "kIOSurfaceComponentRangeWideRange")]
255    pub const WideRange: Self = Self(3);
256}
257
258#[cfg(feature = "objc2")]
259unsafe impl Encode for IOSurfaceComponentRange {
260    const ENCODING: Encoding = i32::ENCODING;
261}
262
263#[cfg(feature = "objc2")]
264unsafe impl RefEncode for IOSurfaceComponentRange {
265    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
266}
267
268extern "C" {
269    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceplanecomponentranges?language=objc)
270    #[cfg(feature = "objc2-core-foundation")]
271    pub static kIOSurfacePlaneComponentRanges: &'static CFString;
272}
273
274/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacesubsampling?language=objc)
275// NS_ENUM
276#[repr(transparent)]
277#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
278pub struct IOSurfaceSubsampling(pub i32);
279impl IOSurfaceSubsampling {
280    #[doc(alias = "kIOSurfaceSubsamplingUnknown")]
281    pub const SubsamplingUnknown: Self = Self(0);
282    #[doc(alias = "kIOSurfaceSubsamplingNone")]
283    pub const SubsamplingNone: Self = Self(1);
284    #[doc(alias = "kIOSurfaceSubsampling422")]
285    pub const Subsampling422: Self = Self(2);
286    #[doc(alias = "kIOSurfaceSubsampling420")]
287    pub const Subsampling420: Self = Self(3);
288    #[doc(alias = "kIOSurfaceSubsampling411")]
289    pub const Subsampling411: Self = Self(4);
290}
291
292#[cfg(feature = "objc2")]
293unsafe impl Encode for IOSurfaceSubsampling {
294    const ENCODING: Encoding = i32::ENCODING;
295}
296
297#[cfg(feature = "objc2")]
298unsafe impl RefEncode for IOSurfaceSubsampling {
299    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
300}
301
302extern "C" {
303    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacesubsampling?language=objc)
304    #[cfg(feature = "objc2-core-foundation")]
305    pub static kIOSurfaceSubsampling: &'static CFString;
306}
307
308#[cfg(feature = "objc2-core-foundation")]
309unsafe impl ConcreteType for IOSurfaceRef {
310    #[doc(alias = "IOSurfaceGetTypeID")]
311    #[inline]
312    fn type_id() -> CFTypeID {
313        extern "C-unwind" {
314            fn IOSurfaceGetTypeID() -> CFTypeID;
315        }
316        unsafe { IOSurfaceGetTypeID() }
317    }
318}
319
320impl IOSurfaceRef {
321    #[doc(alias = "IOSurfaceCreate")]
322    #[cfg(feature = "objc2-core-foundation")]
323    #[inline]
324    pub unsafe fn new(properties: &CFDictionary) -> Option<CFRetained<IOSurfaceRef>> {
325        extern "C-unwind" {
326            fn IOSurfaceCreate(properties: &CFDictionary) -> Option<NonNull<IOSurfaceRef>>;
327        }
328        let ret = unsafe { IOSurfaceCreate(properties) };
329        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
330    }
331
332    #[doc(alias = "IOSurfaceLookup")]
333    #[cfg(all(feature = "IOSurfaceTypes", feature = "objc2-core-foundation"))]
334    #[inline]
335    pub fn lookup(csid: IOSurfaceID) -> Option<CFRetained<IOSurfaceRef>> {
336        extern "C-unwind" {
337            fn IOSurfaceLookup(csid: IOSurfaceID) -> Option<NonNull<IOSurfaceRef>>;
338        }
339        let ret = unsafe { IOSurfaceLookup(csid) };
340        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
341    }
342
343    #[doc(alias = "IOSurfaceGetID")]
344    #[cfg(feature = "IOSurfaceTypes")]
345    #[inline]
346    pub fn id(self: &IOSurfaceRef) -> IOSurfaceID {
347        extern "C-unwind" {
348            fn IOSurfaceGetID(buffer: &IOSurfaceRef) -> IOSurfaceID;
349        }
350        unsafe { IOSurfaceGetID(self) }
351    }
352
353    #[doc(alias = "IOSurfaceLock")]
354    #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
355    #[inline]
356    pub unsafe fn lock(
357        self: &IOSurfaceRef,
358        options: IOSurfaceLockOptions,
359        seed: *mut u32,
360    ) -> libc::kern_return_t {
361        extern "C-unwind" {
362            fn IOSurfaceLock(
363                buffer: &IOSurfaceRef,
364                options: IOSurfaceLockOptions,
365                seed: *mut u32,
366            ) -> libc::kern_return_t;
367        }
368        unsafe { IOSurfaceLock(self, options, seed) }
369    }
370
371    #[doc(alias = "IOSurfaceUnlock")]
372    #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
373    #[inline]
374    pub unsafe fn unlock(
375        self: &IOSurfaceRef,
376        options: IOSurfaceLockOptions,
377        seed: *mut u32,
378    ) -> libc::kern_return_t {
379        extern "C-unwind" {
380            fn IOSurfaceUnlock(
381                buffer: &IOSurfaceRef,
382                options: IOSurfaceLockOptions,
383                seed: *mut u32,
384            ) -> libc::kern_return_t;
385        }
386        unsafe { IOSurfaceUnlock(self, options, seed) }
387    }
388
389    #[doc(alias = "IOSurfaceGetAllocSize")]
390    #[inline]
391    pub fn alloc_size(self: &IOSurfaceRef) -> usize {
392        extern "C-unwind" {
393            fn IOSurfaceGetAllocSize(buffer: &IOSurfaceRef) -> usize;
394        }
395        unsafe { IOSurfaceGetAllocSize(self) }
396    }
397
398    #[doc(alias = "IOSurfaceGetWidth")]
399    #[inline]
400    pub fn width(self: &IOSurfaceRef) -> usize {
401        extern "C-unwind" {
402            fn IOSurfaceGetWidth(buffer: &IOSurfaceRef) -> usize;
403        }
404        unsafe { IOSurfaceGetWidth(self) }
405    }
406
407    #[doc(alias = "IOSurfaceGetHeight")]
408    #[inline]
409    pub fn height(self: &IOSurfaceRef) -> usize {
410        extern "C-unwind" {
411            fn IOSurfaceGetHeight(buffer: &IOSurfaceRef) -> usize;
412        }
413        unsafe { IOSurfaceGetHeight(self) }
414    }
415
416    #[doc(alias = "IOSurfaceGetBytesPerElement")]
417    #[inline]
418    pub fn bytes_per_element(self: &IOSurfaceRef) -> usize {
419        extern "C-unwind" {
420            fn IOSurfaceGetBytesPerElement(buffer: &IOSurfaceRef) -> usize;
421        }
422        unsafe { IOSurfaceGetBytesPerElement(self) }
423    }
424
425    #[doc(alias = "IOSurfaceGetBytesPerRow")]
426    #[inline]
427    pub fn bytes_per_row(self: &IOSurfaceRef) -> usize {
428        extern "C-unwind" {
429            fn IOSurfaceGetBytesPerRow(buffer: &IOSurfaceRef) -> usize;
430        }
431        unsafe { IOSurfaceGetBytesPerRow(self) }
432    }
433
434    #[doc(alias = "IOSurfaceGetBaseAddress")]
435    #[inline]
436    pub fn base_address(self: &IOSurfaceRef) -> NonNull<c_void> {
437        extern "C-unwind" {
438            fn IOSurfaceGetBaseAddress(buffer: &IOSurfaceRef) -> Option<NonNull<c_void>>;
439        }
440        let ret = unsafe { IOSurfaceGetBaseAddress(self) };
441        ret.expect("function was marked as returning non-null, but actually returned NULL")
442    }
443
444    #[doc(alias = "IOSurfaceGetElementWidth")]
445    #[inline]
446    pub fn element_width(self: &IOSurfaceRef) -> usize {
447        extern "C-unwind" {
448            fn IOSurfaceGetElementWidth(buffer: &IOSurfaceRef) -> usize;
449        }
450        unsafe { IOSurfaceGetElementWidth(self) }
451    }
452
453    #[doc(alias = "IOSurfaceGetElementHeight")]
454    #[inline]
455    pub fn element_height(self: &IOSurfaceRef) -> usize {
456        extern "C-unwind" {
457            fn IOSurfaceGetElementHeight(buffer: &IOSurfaceRef) -> usize;
458        }
459        unsafe { IOSurfaceGetElementHeight(self) }
460    }
461
462    #[doc(alias = "IOSurfaceGetPixelFormat")]
463    #[inline]
464    pub fn pixel_format(self: &IOSurfaceRef) -> OSType {
465        extern "C-unwind" {
466            fn IOSurfaceGetPixelFormat(buffer: &IOSurfaceRef) -> OSType;
467        }
468        unsafe { IOSurfaceGetPixelFormat(self) }
469    }
470
471    #[doc(alias = "IOSurfaceGetSeed")]
472    #[inline]
473    pub fn seed(self: &IOSurfaceRef) -> u32 {
474        extern "C-unwind" {
475            fn IOSurfaceGetSeed(buffer: &IOSurfaceRef) -> u32;
476        }
477        unsafe { IOSurfaceGetSeed(self) }
478    }
479
480    #[doc(alias = "IOSurfaceGetPlaneCount")]
481    #[inline]
482    pub fn plane_count(self: &IOSurfaceRef) -> usize {
483        extern "C-unwind" {
484            fn IOSurfaceGetPlaneCount(buffer: &IOSurfaceRef) -> usize;
485        }
486        unsafe { IOSurfaceGetPlaneCount(self) }
487    }
488
489    #[doc(alias = "IOSurfaceGetWidthOfPlane")]
490    #[inline]
491    pub fn width_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
492        extern "C-unwind" {
493            fn IOSurfaceGetWidthOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
494        }
495        unsafe { IOSurfaceGetWidthOfPlane(self, plane_index) }
496    }
497
498    #[doc(alias = "IOSurfaceGetHeightOfPlane")]
499    #[inline]
500    pub fn height_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
501        extern "C-unwind" {
502            fn IOSurfaceGetHeightOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
503        }
504        unsafe { IOSurfaceGetHeightOfPlane(self, plane_index) }
505    }
506
507    #[doc(alias = "IOSurfaceGetBytesPerElementOfPlane")]
508    #[inline]
509    pub fn bytes_per_element_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
510        extern "C-unwind" {
511            fn IOSurfaceGetBytesPerElementOfPlane(
512                buffer: &IOSurfaceRef,
513                plane_index: usize,
514            ) -> usize;
515        }
516        unsafe { IOSurfaceGetBytesPerElementOfPlane(self, plane_index) }
517    }
518
519    #[doc(alias = "IOSurfaceGetBytesPerRowOfPlane")]
520    #[inline]
521    pub fn bytes_per_row_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
522        extern "C-unwind" {
523            fn IOSurfaceGetBytesPerRowOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
524        }
525        unsafe { IOSurfaceGetBytesPerRowOfPlane(self, plane_index) }
526    }
527
528    #[doc(alias = "IOSurfaceGetBaseAddressOfPlane")]
529    #[inline]
530    pub fn base_address_of_plane(self: &IOSurfaceRef, plane_index: usize) -> NonNull<c_void> {
531        extern "C-unwind" {
532            fn IOSurfaceGetBaseAddressOfPlane(
533                buffer: &IOSurfaceRef,
534                plane_index: usize,
535            ) -> Option<NonNull<c_void>>;
536        }
537        let ret = unsafe { IOSurfaceGetBaseAddressOfPlane(self, plane_index) };
538        ret.expect("function was marked as returning non-null, but actually returned NULL")
539    }
540
541    #[doc(alias = "IOSurfaceGetElementWidthOfPlane")]
542    #[inline]
543    pub fn element_width_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
544        extern "C-unwind" {
545            fn IOSurfaceGetElementWidthOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
546        }
547        unsafe { IOSurfaceGetElementWidthOfPlane(self, plane_index) }
548    }
549
550    #[doc(alias = "IOSurfaceGetElementHeightOfPlane")]
551    #[inline]
552    pub fn element_height_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
553        extern "C-unwind" {
554            fn IOSurfaceGetElementHeightOfPlane(buffer: &IOSurfaceRef, plane_index: usize)
555                -> usize;
556        }
557        unsafe { IOSurfaceGetElementHeightOfPlane(self, plane_index) }
558    }
559
560    #[doc(alias = "IOSurfaceGetNumberOfComponentsOfPlane")]
561    #[inline]
562    pub fn number_of_components_of_plane(self: &IOSurfaceRef, plane_index: usize) -> usize {
563        extern "C-unwind" {
564            fn IOSurfaceGetNumberOfComponentsOfPlane(
565                buffer: &IOSurfaceRef,
566                plane_index: usize,
567            ) -> usize;
568        }
569        unsafe { IOSurfaceGetNumberOfComponentsOfPlane(self, plane_index) }
570    }
571
572    #[doc(alias = "IOSurfaceGetNameOfComponentOfPlane")]
573    #[inline]
574    pub fn name_of_component_of_plane(
575        self: &IOSurfaceRef,
576        plane_index: usize,
577        component_index: usize,
578    ) -> IOSurfaceComponentName {
579        extern "C-unwind" {
580            fn IOSurfaceGetNameOfComponentOfPlane(
581                buffer: &IOSurfaceRef,
582                plane_index: usize,
583                component_index: usize,
584            ) -> IOSurfaceComponentName;
585        }
586        unsafe { IOSurfaceGetNameOfComponentOfPlane(self, plane_index, component_index) }
587    }
588
589    #[doc(alias = "IOSurfaceGetTypeOfComponentOfPlane")]
590    #[inline]
591    pub fn type_of_component_of_plane(
592        self: &IOSurfaceRef,
593        plane_index: usize,
594        component_index: usize,
595    ) -> IOSurfaceComponentType {
596        extern "C-unwind" {
597            fn IOSurfaceGetTypeOfComponentOfPlane(
598                buffer: &IOSurfaceRef,
599                plane_index: usize,
600                component_index: usize,
601            ) -> IOSurfaceComponentType;
602        }
603        unsafe { IOSurfaceGetTypeOfComponentOfPlane(self, plane_index, component_index) }
604    }
605
606    #[doc(alias = "IOSurfaceGetRangeOfComponentOfPlane")]
607    #[inline]
608    pub fn range_of_component_of_plane(
609        self: &IOSurfaceRef,
610        plane_index: usize,
611        component_index: usize,
612    ) -> IOSurfaceComponentRange {
613        extern "C-unwind" {
614            fn IOSurfaceGetRangeOfComponentOfPlane(
615                buffer: &IOSurfaceRef,
616                plane_index: usize,
617                component_index: usize,
618            ) -> IOSurfaceComponentRange;
619        }
620        unsafe { IOSurfaceGetRangeOfComponentOfPlane(self, plane_index, component_index) }
621    }
622
623    #[doc(alias = "IOSurfaceGetBitDepthOfComponentOfPlane")]
624    #[inline]
625    pub fn bit_depth_of_component_of_plane(
626        self: &IOSurfaceRef,
627        plane_index: usize,
628        component_index: usize,
629    ) -> usize {
630        extern "C-unwind" {
631            fn IOSurfaceGetBitDepthOfComponentOfPlane(
632                buffer: &IOSurfaceRef,
633                plane_index: usize,
634                component_index: usize,
635            ) -> usize;
636        }
637        unsafe { IOSurfaceGetBitDepthOfComponentOfPlane(self, plane_index, component_index) }
638    }
639
640    #[doc(alias = "IOSurfaceGetBitOffsetOfComponentOfPlane")]
641    #[inline]
642    pub fn bit_offset_of_component_of_plane(
643        self: &IOSurfaceRef,
644        plane_index: usize,
645        component_index: usize,
646    ) -> usize {
647        extern "C-unwind" {
648            fn IOSurfaceGetBitOffsetOfComponentOfPlane(
649                buffer: &IOSurfaceRef,
650                plane_index: usize,
651                component_index: usize,
652            ) -> usize;
653        }
654        unsafe { IOSurfaceGetBitOffsetOfComponentOfPlane(self, plane_index, component_index) }
655    }
656
657    #[doc(alias = "IOSurfaceGetSubsampling")]
658    #[inline]
659    pub fn subsampling(self: &IOSurfaceRef) -> IOSurfaceSubsampling {
660        extern "C-unwind" {
661            fn IOSurfaceGetSubsampling(buffer: &IOSurfaceRef) -> IOSurfaceSubsampling;
662        }
663        unsafe { IOSurfaceGetSubsampling(self) }
664    }
665}
666
667extern "C" {
668    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacecolorspace?language=objc)
669    #[cfg(feature = "objc2-core-foundation")]
670    pub static kIOSurfaceColorSpace: &'static CFString;
671}
672
673extern "C" {
674    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfaceiccprofile?language=objc)
675    #[cfg(feature = "objc2-core-foundation")]
676    pub static kIOSurfaceICCProfile: &'static CFString;
677}
678
679extern "C" {
680    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/kiosurfacecontentheadroom?language=objc)
681    #[cfg(feature = "objc2-core-foundation")]
682    pub static kIOSurfaceContentHeadroom: &'static CFString;
683}
684
685impl IOSurfaceRef {
686    #[doc(alias = "IOSurfaceSetValue")]
687    #[cfg(feature = "objc2-core-foundation")]
688    #[inline]
689    pub unsafe fn set_value(self: &IOSurfaceRef, key: &CFString, value: &CFType) {
690        extern "C-unwind" {
691            fn IOSurfaceSetValue(buffer: &IOSurfaceRef, key: &CFString, value: &CFType);
692        }
693        unsafe { IOSurfaceSetValue(self, key, value) }
694    }
695
696    #[doc(alias = "IOSurfaceCopyValue")]
697    #[cfg(feature = "objc2-core-foundation")]
698    #[inline]
699    pub fn value(self: &IOSurfaceRef, key: &CFString) -> Option<CFRetained<CFType>> {
700        extern "C-unwind" {
701            fn IOSurfaceCopyValue(buffer: &IOSurfaceRef, key: &CFString)
702                -> Option<NonNull<CFType>>;
703        }
704        let ret = unsafe { IOSurfaceCopyValue(self, key) };
705        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
706    }
707
708    #[doc(alias = "IOSurfaceRemoveValue")]
709    #[cfg(feature = "objc2-core-foundation")]
710    #[inline]
711    pub fn remove_value(self: &IOSurfaceRef, key: &CFString) {
712        extern "C-unwind" {
713            fn IOSurfaceRemoveValue(buffer: &IOSurfaceRef, key: &CFString);
714        }
715        unsafe { IOSurfaceRemoveValue(self, key) }
716    }
717
718    #[doc(alias = "IOSurfaceSetValues")]
719    #[cfg(feature = "objc2-core-foundation")]
720    #[inline]
721    pub unsafe fn set_values(self: &IOSurfaceRef, keys_and_values: &CFDictionary) {
722        extern "C-unwind" {
723            fn IOSurfaceSetValues(buffer: &IOSurfaceRef, keys_and_values: &CFDictionary);
724        }
725        unsafe { IOSurfaceSetValues(self, keys_and_values) }
726    }
727
728    #[doc(alias = "IOSurfaceCopyAllValues")]
729    #[cfg(feature = "objc2-core-foundation")]
730    #[inline]
731    pub fn all_values(self: &IOSurfaceRef) -> Option<CFRetained<CFDictionary>> {
732        extern "C-unwind" {
733            fn IOSurfaceCopyAllValues(buffer: &IOSurfaceRef) -> Option<NonNull<CFDictionary>>;
734        }
735        let ret = unsafe { IOSurfaceCopyAllValues(self) };
736        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
737    }
738
739    #[doc(alias = "IOSurfaceRemoveAllValues")]
740    #[inline]
741    pub fn remove_all_values(self: &IOSurfaceRef) {
742        extern "C-unwind" {
743            fn IOSurfaceRemoveAllValues(buffer: &IOSurfaceRef);
744        }
745        unsafe { IOSurfaceRemoveAllValues(self) }
746    }
747
748    #[doc(alias = "IOSurfaceCreateMachPort")]
749    #[cfg(feature = "libc")]
750    #[inline]
751    pub fn create_mach_port(self: &IOSurfaceRef) -> libc::mach_port_t {
752        extern "C-unwind" {
753            fn IOSurfaceCreateMachPort(buffer: &IOSurfaceRef) -> libc::mach_port_t;
754        }
755        unsafe { IOSurfaceCreateMachPort(self) }
756    }
757
758    #[doc(alias = "IOSurfaceLookupFromMachPort")]
759    #[cfg(all(feature = "libc", feature = "objc2-core-foundation"))]
760    #[inline]
761    pub fn lookup_from_mach_port(port: libc::mach_port_t) -> Option<CFRetained<IOSurfaceRef>> {
762        extern "C-unwind" {
763            fn IOSurfaceLookupFromMachPort(
764                port: libc::mach_port_t,
765            ) -> Option<NonNull<IOSurfaceRef>>;
766        }
767        let ret = unsafe { IOSurfaceLookupFromMachPort(port) };
768        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
769    }
770
771    #[doc(alias = "IOSurfaceGetPropertyMaximum")]
772    #[cfg(feature = "objc2-core-foundation")]
773    #[inline]
774    pub fn property_maximum(property: &CFString) -> usize {
775        extern "C-unwind" {
776            fn IOSurfaceGetPropertyMaximum(property: &CFString) -> usize;
777        }
778        unsafe { IOSurfaceGetPropertyMaximum(property) }
779    }
780
781    #[doc(alias = "IOSurfaceGetPropertyAlignment")]
782    #[cfg(feature = "objc2-core-foundation")]
783    #[inline]
784    pub fn property_alignment(property: &CFString) -> usize {
785        extern "C-unwind" {
786            fn IOSurfaceGetPropertyAlignment(property: &CFString) -> usize;
787        }
788        unsafe { IOSurfaceGetPropertyAlignment(property) }
789    }
790
791    #[doc(alias = "IOSurfaceAlignProperty")]
792    #[cfg(feature = "objc2-core-foundation")]
793    #[inline]
794    pub fn align_property(property: &CFString, value: usize) -> usize {
795        extern "C-unwind" {
796            fn IOSurfaceAlignProperty(property: &CFString, value: usize) -> usize;
797        }
798        unsafe { IOSurfaceAlignProperty(property, value) }
799    }
800
801    #[doc(alias = "IOSurfaceIncrementUseCount")]
802    #[inline]
803    pub fn increment_use_count(self: &IOSurfaceRef) {
804        extern "C-unwind" {
805            fn IOSurfaceIncrementUseCount(buffer: &IOSurfaceRef);
806        }
807        unsafe { IOSurfaceIncrementUseCount(self) }
808    }
809
810    #[doc(alias = "IOSurfaceDecrementUseCount")]
811    #[inline]
812    pub fn decrement_use_count(self: &IOSurfaceRef) {
813        extern "C-unwind" {
814            fn IOSurfaceDecrementUseCount(buffer: &IOSurfaceRef);
815        }
816        unsafe { IOSurfaceDecrementUseCount(self) }
817    }
818
819    #[doc(alias = "IOSurfaceGetUseCount")]
820    #[inline]
821    pub fn use_count(self: &IOSurfaceRef) -> i32 {
822        extern "C-unwind" {
823            fn IOSurfaceGetUseCount(buffer: &IOSurfaceRef) -> i32;
824        }
825        unsafe { IOSurfaceGetUseCount(self) }
826    }
827
828    #[doc(alias = "IOSurfaceIsInUse")]
829    #[inline]
830    pub fn is_in_use(self: &IOSurfaceRef) -> bool {
831        extern "C-unwind" {
832            fn IOSurfaceIsInUse(buffer: &IOSurfaceRef) -> Boolean;
833        }
834        let ret = unsafe { IOSurfaceIsInUse(self) };
835        ret != 0
836    }
837
838    #[doc(alias = "IOSurfaceAllowsPixelSizeCasting")]
839    #[inline]
840    pub fn allows_pixel_size_casting(self: &IOSurfaceRef) -> bool {
841        extern "C-unwind" {
842            fn IOSurfaceAllowsPixelSizeCasting(buffer: &IOSurfaceRef) -> Boolean;
843        }
844        let ret = unsafe { IOSurfaceAllowsPixelSizeCasting(self) };
845        ret != 0
846    }
847
848    #[doc(alias = "IOSurfaceSetPurgeable")]
849    #[cfg(feature = "libc")]
850    #[inline]
851    pub unsafe fn set_purgeable(
852        self: &IOSurfaceRef,
853        new_state: u32,
854        old_state: *mut u32,
855    ) -> libc::kern_return_t {
856        extern "C-unwind" {
857            fn IOSurfaceSetPurgeable(
858                buffer: &IOSurfaceRef,
859                new_state: u32,
860                old_state: *mut u32,
861            ) -> libc::kern_return_t;
862        }
863        unsafe { IOSurfaceSetPurgeable(self, new_state, old_state) }
864    }
865}
866
867/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacememoryledgertags?language=objc)
868// NS_ENUM
869#[repr(transparent)]
870#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
871pub struct IOSurfaceMemoryLedgerTags(pub c_int);
872impl IOSurfaceMemoryLedgerTags {
873    #[doc(alias = "kIOSurfaceMemoryLedgerTagDefault")]
874    pub const Default: Self = Self(0x00000001);
875    #[doc(alias = "kIOSurfaceMemoryLedgerTagNetwork")]
876    pub const Network: Self = Self(0x00000002);
877    #[doc(alias = "kIOSurfaceMemoryLedgerTagMedia")]
878    pub const Media: Self = Self(0x00000003);
879    #[doc(alias = "kIOSurfaceMemoryLedgerTagGraphics")]
880    pub const Graphics: Self = Self(0x00000004);
881    #[doc(alias = "kIOSurfaceMemoryLedgerTagNeural")]
882    pub const Neural: Self = Self(0x00000005);
883}
884
885#[cfg(feature = "objc2")]
886unsafe impl Encode for IOSurfaceMemoryLedgerTags {
887    const ENCODING: Encoding = c_int::ENCODING;
888}
889
890#[cfg(feature = "objc2")]
891unsafe impl RefEncode for IOSurfaceMemoryLedgerTags {
892    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
893}
894
895/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacememoryledgerflags?language=objc)
896// NS_OPTIONS
897#[repr(transparent)]
898#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
899pub struct IOSurfaceMemoryLedgerFlags(pub u32);
900bitflags::bitflags! {
901    impl IOSurfaceMemoryLedgerFlags: u32 {
902        #[doc(alias = "kIOSurfaceMemoryLedgerFlagNoFootprint")]
903        const NoFootprint = 1<<0;
904    }
905}
906
907#[cfg(feature = "objc2")]
908unsafe impl Encode for IOSurfaceMemoryLedgerFlags {
909    const ENCODING: Encoding = u32::ENCODING;
910}
911
912#[cfg(feature = "objc2")]
913unsafe impl RefEncode for IOSurfaceMemoryLedgerFlags {
914    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
915}
916
917#[cfg(feature = "objc2-core-foundation")]
918#[deprecated = "renamed to `IOSurfaceRef::new`"]
919#[inline]
920pub unsafe extern "C-unwind" fn IOSurfaceCreate(
921    properties: &CFDictionary,
922) -> Option<CFRetained<IOSurfaceRef>> {
923    extern "C-unwind" {
924        fn IOSurfaceCreate(properties: &CFDictionary) -> Option<NonNull<IOSurfaceRef>>;
925    }
926    let ret = unsafe { IOSurfaceCreate(properties) };
927    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
928}
929
930#[cfg(all(feature = "IOSurfaceTypes", feature = "objc2-core-foundation"))]
931#[deprecated = "renamed to `IOSurfaceRef::lookup`"]
932#[inline]
933pub extern "C-unwind" fn IOSurfaceLookup(csid: IOSurfaceID) -> Option<CFRetained<IOSurfaceRef>> {
934    extern "C-unwind" {
935        fn IOSurfaceLookup(csid: IOSurfaceID) -> Option<NonNull<IOSurfaceRef>>;
936    }
937    let ret = unsafe { IOSurfaceLookup(csid) };
938    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
939}
940
941#[cfg(feature = "IOSurfaceTypes")]
942#[deprecated = "renamed to `IOSurfaceRef::id`"]
943#[inline]
944pub extern "C-unwind" fn IOSurfaceGetID(buffer: &IOSurfaceRef) -> IOSurfaceID {
945    extern "C-unwind" {
946        fn IOSurfaceGetID(buffer: &IOSurfaceRef) -> IOSurfaceID;
947    }
948    unsafe { IOSurfaceGetID(buffer) }
949}
950
951extern "C-unwind" {
952    #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
953    #[deprecated = "renamed to `IOSurfaceRef::lock`"]
954    pub fn IOSurfaceLock(
955        buffer: &IOSurfaceRef,
956        options: IOSurfaceLockOptions,
957        seed: *mut u32,
958    ) -> libc::kern_return_t;
959}
960
961extern "C-unwind" {
962    #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
963    #[deprecated = "renamed to `IOSurfaceRef::unlock`"]
964    pub fn IOSurfaceUnlock(
965        buffer: &IOSurfaceRef,
966        options: IOSurfaceLockOptions,
967        seed: *mut u32,
968    ) -> libc::kern_return_t;
969}
970
971#[deprecated = "renamed to `IOSurfaceRef::alloc_size`"]
972#[inline]
973pub extern "C-unwind" fn IOSurfaceGetAllocSize(buffer: &IOSurfaceRef) -> usize {
974    extern "C-unwind" {
975        fn IOSurfaceGetAllocSize(buffer: &IOSurfaceRef) -> usize;
976    }
977    unsafe { IOSurfaceGetAllocSize(buffer) }
978}
979
980#[deprecated = "renamed to `IOSurfaceRef::width`"]
981#[inline]
982pub extern "C-unwind" fn IOSurfaceGetWidth(buffer: &IOSurfaceRef) -> usize {
983    extern "C-unwind" {
984        fn IOSurfaceGetWidth(buffer: &IOSurfaceRef) -> usize;
985    }
986    unsafe { IOSurfaceGetWidth(buffer) }
987}
988
989#[deprecated = "renamed to `IOSurfaceRef::height`"]
990#[inline]
991pub extern "C-unwind" fn IOSurfaceGetHeight(buffer: &IOSurfaceRef) -> usize {
992    extern "C-unwind" {
993        fn IOSurfaceGetHeight(buffer: &IOSurfaceRef) -> usize;
994    }
995    unsafe { IOSurfaceGetHeight(buffer) }
996}
997
998#[deprecated = "renamed to `IOSurfaceRef::bytes_per_element`"]
999#[inline]
1000pub extern "C-unwind" fn IOSurfaceGetBytesPerElement(buffer: &IOSurfaceRef) -> usize {
1001    extern "C-unwind" {
1002        fn IOSurfaceGetBytesPerElement(buffer: &IOSurfaceRef) -> usize;
1003    }
1004    unsafe { IOSurfaceGetBytesPerElement(buffer) }
1005}
1006
1007#[deprecated = "renamed to `IOSurfaceRef::bytes_per_row`"]
1008#[inline]
1009pub extern "C-unwind" fn IOSurfaceGetBytesPerRow(buffer: &IOSurfaceRef) -> usize {
1010    extern "C-unwind" {
1011        fn IOSurfaceGetBytesPerRow(buffer: &IOSurfaceRef) -> usize;
1012    }
1013    unsafe { IOSurfaceGetBytesPerRow(buffer) }
1014}
1015
1016#[deprecated = "renamed to `IOSurfaceRef::base_address`"]
1017#[inline]
1018pub extern "C-unwind" fn IOSurfaceGetBaseAddress(buffer: &IOSurfaceRef) -> NonNull<c_void> {
1019    extern "C-unwind" {
1020        fn IOSurfaceGetBaseAddress(buffer: &IOSurfaceRef) -> Option<NonNull<c_void>>;
1021    }
1022    let ret = unsafe { IOSurfaceGetBaseAddress(buffer) };
1023    ret.expect("function was marked as returning non-null, but actually returned NULL")
1024}
1025
1026#[deprecated = "renamed to `IOSurfaceRef::element_width`"]
1027#[inline]
1028pub extern "C-unwind" fn IOSurfaceGetElementWidth(buffer: &IOSurfaceRef) -> usize {
1029    extern "C-unwind" {
1030        fn IOSurfaceGetElementWidth(buffer: &IOSurfaceRef) -> usize;
1031    }
1032    unsafe { IOSurfaceGetElementWidth(buffer) }
1033}
1034
1035#[deprecated = "renamed to `IOSurfaceRef::element_height`"]
1036#[inline]
1037pub extern "C-unwind" fn IOSurfaceGetElementHeight(buffer: &IOSurfaceRef) -> usize {
1038    extern "C-unwind" {
1039        fn IOSurfaceGetElementHeight(buffer: &IOSurfaceRef) -> usize;
1040    }
1041    unsafe { IOSurfaceGetElementHeight(buffer) }
1042}
1043
1044#[deprecated = "renamed to `IOSurfaceRef::pixel_format`"]
1045#[inline]
1046pub extern "C-unwind" fn IOSurfaceGetPixelFormat(buffer: &IOSurfaceRef) -> OSType {
1047    extern "C-unwind" {
1048        fn IOSurfaceGetPixelFormat(buffer: &IOSurfaceRef) -> OSType;
1049    }
1050    unsafe { IOSurfaceGetPixelFormat(buffer) }
1051}
1052
1053#[deprecated = "renamed to `IOSurfaceRef::seed`"]
1054#[inline]
1055pub extern "C-unwind" fn IOSurfaceGetSeed(buffer: &IOSurfaceRef) -> u32 {
1056    extern "C-unwind" {
1057        fn IOSurfaceGetSeed(buffer: &IOSurfaceRef) -> u32;
1058    }
1059    unsafe { IOSurfaceGetSeed(buffer) }
1060}
1061
1062#[deprecated = "renamed to `IOSurfaceRef::plane_count`"]
1063#[inline]
1064pub extern "C-unwind" fn IOSurfaceGetPlaneCount(buffer: &IOSurfaceRef) -> usize {
1065    extern "C-unwind" {
1066        fn IOSurfaceGetPlaneCount(buffer: &IOSurfaceRef) -> usize;
1067    }
1068    unsafe { IOSurfaceGetPlaneCount(buffer) }
1069}
1070
1071#[deprecated = "renamed to `IOSurfaceRef::width_of_plane`"]
1072#[inline]
1073pub extern "C-unwind" fn IOSurfaceGetWidthOfPlane(
1074    buffer: &IOSurfaceRef,
1075    plane_index: usize,
1076) -> usize {
1077    extern "C-unwind" {
1078        fn IOSurfaceGetWidthOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
1079    }
1080    unsafe { IOSurfaceGetWidthOfPlane(buffer, plane_index) }
1081}
1082
1083#[deprecated = "renamed to `IOSurfaceRef::height_of_plane`"]
1084#[inline]
1085pub extern "C-unwind" fn IOSurfaceGetHeightOfPlane(
1086    buffer: &IOSurfaceRef,
1087    plane_index: usize,
1088) -> usize {
1089    extern "C-unwind" {
1090        fn IOSurfaceGetHeightOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
1091    }
1092    unsafe { IOSurfaceGetHeightOfPlane(buffer, plane_index) }
1093}
1094
1095#[deprecated = "renamed to `IOSurfaceRef::bytes_per_element_of_plane`"]
1096#[inline]
1097pub extern "C-unwind" fn IOSurfaceGetBytesPerElementOfPlane(
1098    buffer: &IOSurfaceRef,
1099    plane_index: usize,
1100) -> usize {
1101    extern "C-unwind" {
1102        fn IOSurfaceGetBytesPerElementOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
1103    }
1104    unsafe { IOSurfaceGetBytesPerElementOfPlane(buffer, plane_index) }
1105}
1106
1107#[deprecated = "renamed to `IOSurfaceRef::bytes_per_row_of_plane`"]
1108#[inline]
1109pub extern "C-unwind" fn IOSurfaceGetBytesPerRowOfPlane(
1110    buffer: &IOSurfaceRef,
1111    plane_index: usize,
1112) -> usize {
1113    extern "C-unwind" {
1114        fn IOSurfaceGetBytesPerRowOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
1115    }
1116    unsafe { IOSurfaceGetBytesPerRowOfPlane(buffer, plane_index) }
1117}
1118
1119#[deprecated = "renamed to `IOSurfaceRef::base_address_of_plane`"]
1120#[inline]
1121pub extern "C-unwind" fn IOSurfaceGetBaseAddressOfPlane(
1122    buffer: &IOSurfaceRef,
1123    plane_index: usize,
1124) -> NonNull<c_void> {
1125    extern "C-unwind" {
1126        fn IOSurfaceGetBaseAddressOfPlane(
1127            buffer: &IOSurfaceRef,
1128            plane_index: usize,
1129        ) -> Option<NonNull<c_void>>;
1130    }
1131    let ret = unsafe { IOSurfaceGetBaseAddressOfPlane(buffer, plane_index) };
1132    ret.expect("function was marked as returning non-null, but actually returned NULL")
1133}
1134
1135#[deprecated = "renamed to `IOSurfaceRef::element_width_of_plane`"]
1136#[inline]
1137pub extern "C-unwind" fn IOSurfaceGetElementWidthOfPlane(
1138    buffer: &IOSurfaceRef,
1139    plane_index: usize,
1140) -> usize {
1141    extern "C-unwind" {
1142        fn IOSurfaceGetElementWidthOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
1143    }
1144    unsafe { IOSurfaceGetElementWidthOfPlane(buffer, plane_index) }
1145}
1146
1147#[deprecated = "renamed to `IOSurfaceRef::element_height_of_plane`"]
1148#[inline]
1149pub extern "C-unwind" fn IOSurfaceGetElementHeightOfPlane(
1150    buffer: &IOSurfaceRef,
1151    plane_index: usize,
1152) -> usize {
1153    extern "C-unwind" {
1154        fn IOSurfaceGetElementHeightOfPlane(buffer: &IOSurfaceRef, plane_index: usize) -> usize;
1155    }
1156    unsafe { IOSurfaceGetElementHeightOfPlane(buffer, plane_index) }
1157}
1158
1159#[deprecated = "renamed to `IOSurfaceRef::number_of_components_of_plane`"]
1160#[inline]
1161pub extern "C-unwind" fn IOSurfaceGetNumberOfComponentsOfPlane(
1162    buffer: &IOSurfaceRef,
1163    plane_index: usize,
1164) -> usize {
1165    extern "C-unwind" {
1166        fn IOSurfaceGetNumberOfComponentsOfPlane(
1167            buffer: &IOSurfaceRef,
1168            plane_index: usize,
1169        ) -> usize;
1170    }
1171    unsafe { IOSurfaceGetNumberOfComponentsOfPlane(buffer, plane_index) }
1172}
1173
1174#[deprecated = "renamed to `IOSurfaceRef::name_of_component_of_plane`"]
1175#[inline]
1176pub extern "C-unwind" fn IOSurfaceGetNameOfComponentOfPlane(
1177    buffer: &IOSurfaceRef,
1178    plane_index: usize,
1179    component_index: usize,
1180) -> IOSurfaceComponentName {
1181    extern "C-unwind" {
1182        fn IOSurfaceGetNameOfComponentOfPlane(
1183            buffer: &IOSurfaceRef,
1184            plane_index: usize,
1185            component_index: usize,
1186        ) -> IOSurfaceComponentName;
1187    }
1188    unsafe { IOSurfaceGetNameOfComponentOfPlane(buffer, plane_index, component_index) }
1189}
1190
1191#[deprecated = "renamed to `IOSurfaceRef::type_of_component_of_plane`"]
1192#[inline]
1193pub extern "C-unwind" fn IOSurfaceGetTypeOfComponentOfPlane(
1194    buffer: &IOSurfaceRef,
1195    plane_index: usize,
1196    component_index: usize,
1197) -> IOSurfaceComponentType {
1198    extern "C-unwind" {
1199        fn IOSurfaceGetTypeOfComponentOfPlane(
1200            buffer: &IOSurfaceRef,
1201            plane_index: usize,
1202            component_index: usize,
1203        ) -> IOSurfaceComponentType;
1204    }
1205    unsafe { IOSurfaceGetTypeOfComponentOfPlane(buffer, plane_index, component_index) }
1206}
1207
1208#[deprecated = "renamed to `IOSurfaceRef::range_of_component_of_plane`"]
1209#[inline]
1210pub extern "C-unwind" fn IOSurfaceGetRangeOfComponentOfPlane(
1211    buffer: &IOSurfaceRef,
1212    plane_index: usize,
1213    component_index: usize,
1214) -> IOSurfaceComponentRange {
1215    extern "C-unwind" {
1216        fn IOSurfaceGetRangeOfComponentOfPlane(
1217            buffer: &IOSurfaceRef,
1218            plane_index: usize,
1219            component_index: usize,
1220        ) -> IOSurfaceComponentRange;
1221    }
1222    unsafe { IOSurfaceGetRangeOfComponentOfPlane(buffer, plane_index, component_index) }
1223}
1224
1225#[deprecated = "renamed to `IOSurfaceRef::bit_depth_of_component_of_plane`"]
1226#[inline]
1227pub extern "C-unwind" fn IOSurfaceGetBitDepthOfComponentOfPlane(
1228    buffer: &IOSurfaceRef,
1229    plane_index: usize,
1230    component_index: usize,
1231) -> usize {
1232    extern "C-unwind" {
1233        fn IOSurfaceGetBitDepthOfComponentOfPlane(
1234            buffer: &IOSurfaceRef,
1235            plane_index: usize,
1236            component_index: usize,
1237        ) -> usize;
1238    }
1239    unsafe { IOSurfaceGetBitDepthOfComponentOfPlane(buffer, plane_index, component_index) }
1240}
1241
1242#[deprecated = "renamed to `IOSurfaceRef::bit_offset_of_component_of_plane`"]
1243#[inline]
1244pub extern "C-unwind" fn IOSurfaceGetBitOffsetOfComponentOfPlane(
1245    buffer: &IOSurfaceRef,
1246    plane_index: usize,
1247    component_index: usize,
1248) -> usize {
1249    extern "C-unwind" {
1250        fn IOSurfaceGetBitOffsetOfComponentOfPlane(
1251            buffer: &IOSurfaceRef,
1252            plane_index: usize,
1253            component_index: usize,
1254        ) -> usize;
1255    }
1256    unsafe { IOSurfaceGetBitOffsetOfComponentOfPlane(buffer, plane_index, component_index) }
1257}
1258
1259#[deprecated = "renamed to `IOSurfaceRef::subsampling`"]
1260#[inline]
1261pub extern "C-unwind" fn IOSurfaceGetSubsampling(buffer: &IOSurfaceRef) -> IOSurfaceSubsampling {
1262    extern "C-unwind" {
1263        fn IOSurfaceGetSubsampling(buffer: &IOSurfaceRef) -> IOSurfaceSubsampling;
1264    }
1265    unsafe { IOSurfaceGetSubsampling(buffer) }
1266}
1267
1268extern "C-unwind" {
1269    #[cfg(feature = "objc2-core-foundation")]
1270    #[deprecated = "renamed to `IOSurfaceRef::set_value`"]
1271    pub fn IOSurfaceSetValue(buffer: &IOSurfaceRef, key: &CFString, value: &CFType);
1272}
1273
1274#[cfg(feature = "objc2-core-foundation")]
1275#[deprecated = "renamed to `IOSurfaceRef::value`"]
1276#[inline]
1277pub extern "C-unwind" fn IOSurfaceCopyValue(
1278    buffer: &IOSurfaceRef,
1279    key: &CFString,
1280) -> Option<CFRetained<CFType>> {
1281    extern "C-unwind" {
1282        fn IOSurfaceCopyValue(buffer: &IOSurfaceRef, key: &CFString) -> Option<NonNull<CFType>>;
1283    }
1284    let ret = unsafe { IOSurfaceCopyValue(buffer, key) };
1285    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1286}
1287
1288#[cfg(feature = "objc2-core-foundation")]
1289#[deprecated = "renamed to `IOSurfaceRef::remove_value`"]
1290#[inline]
1291pub extern "C-unwind" fn IOSurfaceRemoveValue(buffer: &IOSurfaceRef, key: &CFString) {
1292    extern "C-unwind" {
1293        fn IOSurfaceRemoveValue(buffer: &IOSurfaceRef, key: &CFString);
1294    }
1295    unsafe { IOSurfaceRemoveValue(buffer, key) }
1296}
1297
1298extern "C-unwind" {
1299    #[cfg(feature = "objc2-core-foundation")]
1300    #[deprecated = "renamed to `IOSurfaceRef::set_values`"]
1301    pub fn IOSurfaceSetValues(buffer: &IOSurfaceRef, keys_and_values: &CFDictionary);
1302}
1303
1304#[cfg(feature = "objc2-core-foundation")]
1305#[deprecated = "renamed to `IOSurfaceRef::all_values`"]
1306#[inline]
1307pub extern "C-unwind" fn IOSurfaceCopyAllValues(
1308    buffer: &IOSurfaceRef,
1309) -> Option<CFRetained<CFDictionary>> {
1310    extern "C-unwind" {
1311        fn IOSurfaceCopyAllValues(buffer: &IOSurfaceRef) -> Option<NonNull<CFDictionary>>;
1312    }
1313    let ret = unsafe { IOSurfaceCopyAllValues(buffer) };
1314    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1315}
1316
1317#[deprecated = "renamed to `IOSurfaceRef::remove_all_values`"]
1318#[inline]
1319pub extern "C-unwind" fn IOSurfaceRemoveAllValues(buffer: &IOSurfaceRef) {
1320    extern "C-unwind" {
1321        fn IOSurfaceRemoveAllValues(buffer: &IOSurfaceRef);
1322    }
1323    unsafe { IOSurfaceRemoveAllValues(buffer) }
1324}
1325
1326#[cfg(feature = "libc")]
1327#[deprecated = "renamed to `IOSurfaceRef::create_mach_port`"]
1328#[inline]
1329pub extern "C-unwind" fn IOSurfaceCreateMachPort(buffer: &IOSurfaceRef) -> libc::mach_port_t {
1330    extern "C-unwind" {
1331        fn IOSurfaceCreateMachPort(buffer: &IOSurfaceRef) -> libc::mach_port_t;
1332    }
1333    unsafe { IOSurfaceCreateMachPort(buffer) }
1334}
1335
1336#[cfg(all(feature = "libc", feature = "objc2-core-foundation"))]
1337#[deprecated = "renamed to `IOSurfaceRef::lookup_from_mach_port`"]
1338#[inline]
1339pub extern "C-unwind" fn IOSurfaceLookupFromMachPort(
1340    port: libc::mach_port_t,
1341) -> Option<CFRetained<IOSurfaceRef>> {
1342    extern "C-unwind" {
1343        fn IOSurfaceLookupFromMachPort(port: libc::mach_port_t) -> Option<NonNull<IOSurfaceRef>>;
1344    }
1345    let ret = unsafe { IOSurfaceLookupFromMachPort(port) };
1346    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1347}
1348
1349#[cfg(feature = "objc2-core-foundation")]
1350#[deprecated = "renamed to `IOSurfaceRef::property_maximum`"]
1351#[inline]
1352pub extern "C-unwind" fn IOSurfaceGetPropertyMaximum(property: &CFString) -> usize {
1353    extern "C-unwind" {
1354        fn IOSurfaceGetPropertyMaximum(property: &CFString) -> usize;
1355    }
1356    unsafe { IOSurfaceGetPropertyMaximum(property) }
1357}
1358
1359#[cfg(feature = "objc2-core-foundation")]
1360#[deprecated = "renamed to `IOSurfaceRef::property_alignment`"]
1361#[inline]
1362pub extern "C-unwind" fn IOSurfaceGetPropertyAlignment(property: &CFString) -> usize {
1363    extern "C-unwind" {
1364        fn IOSurfaceGetPropertyAlignment(property: &CFString) -> usize;
1365    }
1366    unsafe { IOSurfaceGetPropertyAlignment(property) }
1367}
1368
1369#[cfg(feature = "objc2-core-foundation")]
1370#[deprecated = "renamed to `IOSurfaceRef::align_property`"]
1371#[inline]
1372pub extern "C-unwind" fn IOSurfaceAlignProperty(property: &CFString, value: usize) -> usize {
1373    extern "C-unwind" {
1374        fn IOSurfaceAlignProperty(property: &CFString, value: usize) -> usize;
1375    }
1376    unsafe { IOSurfaceAlignProperty(property, value) }
1377}
1378
1379#[deprecated = "renamed to `IOSurfaceRef::increment_use_count`"]
1380#[inline]
1381pub extern "C-unwind" fn IOSurfaceIncrementUseCount(buffer: &IOSurfaceRef) {
1382    extern "C-unwind" {
1383        fn IOSurfaceIncrementUseCount(buffer: &IOSurfaceRef);
1384    }
1385    unsafe { IOSurfaceIncrementUseCount(buffer) }
1386}
1387
1388#[deprecated = "renamed to `IOSurfaceRef::decrement_use_count`"]
1389#[inline]
1390pub extern "C-unwind" fn IOSurfaceDecrementUseCount(buffer: &IOSurfaceRef) {
1391    extern "C-unwind" {
1392        fn IOSurfaceDecrementUseCount(buffer: &IOSurfaceRef);
1393    }
1394    unsafe { IOSurfaceDecrementUseCount(buffer) }
1395}
1396
1397#[deprecated = "renamed to `IOSurfaceRef::use_count`"]
1398#[inline]
1399pub extern "C-unwind" fn IOSurfaceGetUseCount(buffer: &IOSurfaceRef) -> i32 {
1400    extern "C-unwind" {
1401        fn IOSurfaceGetUseCount(buffer: &IOSurfaceRef) -> i32;
1402    }
1403    unsafe { IOSurfaceGetUseCount(buffer) }
1404}
1405
1406#[deprecated = "renamed to `IOSurfaceRef::is_in_use`"]
1407#[inline]
1408pub extern "C-unwind" fn IOSurfaceIsInUse(buffer: &IOSurfaceRef) -> bool {
1409    extern "C-unwind" {
1410        fn IOSurfaceIsInUse(buffer: &IOSurfaceRef) -> Boolean;
1411    }
1412    let ret = unsafe { IOSurfaceIsInUse(buffer) };
1413    ret != 0
1414}
1415
1416#[deprecated = "renamed to `IOSurfaceRef::allows_pixel_size_casting`"]
1417#[inline]
1418pub extern "C-unwind" fn IOSurfaceAllowsPixelSizeCasting(buffer: &IOSurfaceRef) -> bool {
1419    extern "C-unwind" {
1420        fn IOSurfaceAllowsPixelSizeCasting(buffer: &IOSurfaceRef) -> Boolean;
1421    }
1422    let ret = unsafe { IOSurfaceAllowsPixelSizeCasting(buffer) };
1423    ret != 0
1424}
1425
1426extern "C-unwind" {
1427    #[cfg(feature = "libc")]
1428    #[deprecated = "renamed to `IOSurfaceRef::set_purgeable`"]
1429    pub fn IOSurfaceSetPurgeable(
1430        buffer: &IOSurfaceRef,
1431        new_state: u32,
1432        old_state: *mut u32,
1433    ) -> libc::kern_return_t;
1434}