objc2_image_io/generated/
CGImageSource.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/imageio/cgimagesource?language=objc)
16#[doc(alias = "CGImageSourceRef")]
17#[repr(C)]
18pub struct CGImageSource {
19    inner: [u8; 0],
20    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
21}
22
23cf_type!(
24    unsafe impl CGImageSource {}
25);
26#[cfg(feature = "objc2")]
27cf_objc2_type!(
28    unsafe impl RefEncode<"CGImageSource"> for CGImageSource {}
29);
30
31/// [Apple's documentation](https://developer.apple.com/documentation/imageio/cgimagesourcestatus?language=objc)
32// NS_ENUM
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct CGImageSourceStatus(pub i32);
36impl CGImageSourceStatus {
37    #[doc(alias = "kCGImageStatusUnexpectedEOF")]
38    pub const StatusUnexpectedEOF: Self = Self(-5);
39    #[doc(alias = "kCGImageStatusInvalidData")]
40    pub const StatusInvalidData: Self = Self(-4);
41    #[doc(alias = "kCGImageStatusUnknownType")]
42    pub const StatusUnknownType: Self = Self(-3);
43    #[doc(alias = "kCGImageStatusReadingHeader")]
44    pub const StatusReadingHeader: Self = Self(-2);
45    #[doc(alias = "kCGImageStatusIncomplete")]
46    pub const StatusIncomplete: Self = Self(-1);
47    #[doc(alias = "kCGImageStatusComplete")]
48    pub const StatusComplete: Self = Self(0);
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl Encode for CGImageSourceStatus {
53    const ENCODING: Encoding = i32::ENCODING;
54}
55
56#[cfg(feature = "objc2")]
57unsafe impl RefEncode for CGImageSourceStatus {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61extern "C" {
62    /// Keys for the options dictionary when creating a CGImageSourceRef. *
63    ///
64    /// See also [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcetypeidentifierhint?language=objc)
65    pub static kCGImageSourceTypeIdentifierHint: &'static CFString;
66}
67
68extern "C" {
69    /// Keys for the options dictionary of "CGImageSourceCopyPropertiesAtIndex"
70    /// * and "CGImageSourceCreateImageAtIndex". *
71    ///
72    /// See also [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourceshouldcache?language=objc)
73    pub static kCGImageSourceShouldCache: &'static CFString;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourceshouldcacheimmediately?language=objc)
78    pub static kCGImageSourceShouldCacheImmediately: &'static CFString;
79}
80
81extern "C" {
82    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourceshouldallowfloat?language=objc)
83    pub static kCGImageSourceShouldAllowFloat: &'static CFString;
84}
85
86extern "C" {
87    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcecreatethumbnailfromimageifabsent?language=objc)
88    pub static kCGImageSourceCreateThumbnailFromImageIfAbsent: &'static CFString;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcecreatethumbnailfromimagealways?language=objc)
93    pub static kCGImageSourceCreateThumbnailFromImageAlways: &'static CFString;
94}
95
96extern "C" {
97    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcethumbnailmaxpixelsize?language=objc)
98    pub static kCGImageSourceThumbnailMaxPixelSize: &'static CFString;
99}
100
101extern "C" {
102    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcecreatethumbnailwithtransform?language=objc)
103    pub static kCGImageSourceCreateThumbnailWithTransform: &'static CFString;
104}
105
106extern "C" {
107    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcesubsamplefactor?language=objc)
108    pub static kCGImageSourceSubsampleFactor: &'static CFString;
109}
110
111unsafe impl ConcreteType for CGImageSource {
112    #[doc(alias = "CGImageSourceGetTypeID")]
113    #[inline]
114    fn type_id() -> CFTypeID {
115        extern "C-unwind" {
116            fn CGImageSourceGetTypeID() -> CFTypeID;
117        }
118        unsafe { CGImageSourceGetTypeID() }
119    }
120}
121
122impl CGImageSource {
123    #[doc(alias = "CGImageSourceCopyTypeIdentifiers")]
124    #[inline]
125    pub unsafe fn type_identifiers() -> CFRetained<CFArray> {
126        extern "C-unwind" {
127            fn CGImageSourceCopyTypeIdentifiers() -> Option<NonNull<CFArray>>;
128        }
129        let ret = unsafe { CGImageSourceCopyTypeIdentifiers() };
130        let ret =
131            ret.expect("function was marked as returning non-null, but actually returned NULL");
132        unsafe { CFRetained::from_raw(ret) }
133    }
134
135    /// # Safety
136    ///
137    /// `options` generics must be of the correct type.
138    #[doc(alias = "CGImageSourceCreateWithDataProvider")]
139    #[cfg(feature = "objc2-core-graphics")]
140    #[inline]
141    pub unsafe fn with_data_provider(
142        provider: &CGDataProvider,
143        options: Option<&CFDictionary>,
144    ) -> Option<CFRetained<CGImageSource>> {
145        extern "C-unwind" {
146            fn CGImageSourceCreateWithDataProvider(
147                provider: &CGDataProvider,
148                options: Option<&CFDictionary>,
149            ) -> Option<NonNull<CGImageSource>>;
150        }
151        let ret = unsafe { CGImageSourceCreateWithDataProvider(provider, options) };
152        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
153    }
154
155    /// # Safety
156    ///
157    /// `options` generics must be of the correct type.
158    #[doc(alias = "CGImageSourceCreateWithData")]
159    #[inline]
160    pub unsafe fn with_data(
161        data: &CFData,
162        options: Option<&CFDictionary>,
163    ) -> Option<CFRetained<CGImageSource>> {
164        extern "C-unwind" {
165            fn CGImageSourceCreateWithData(
166                data: &CFData,
167                options: Option<&CFDictionary>,
168            ) -> Option<NonNull<CGImageSource>>;
169        }
170        let ret = unsafe { CGImageSourceCreateWithData(data, options) };
171        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
172    }
173
174    /// # Safety
175    ///
176    /// `options` generics must be of the correct type.
177    #[doc(alias = "CGImageSourceCreateWithURL")]
178    #[inline]
179    pub unsafe fn with_url(
180        url: &CFURL,
181        options: Option<&CFDictionary>,
182    ) -> Option<CFRetained<CGImageSource>> {
183        extern "C-unwind" {
184            fn CGImageSourceCreateWithURL(
185                url: &CFURL,
186                options: Option<&CFDictionary>,
187            ) -> Option<NonNull<CGImageSource>>;
188        }
189        let ret = unsafe { CGImageSourceCreateWithURL(url, options) };
190        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
191    }
192
193    #[doc(alias = "CGImageSourceGetType")]
194    #[inline]
195    pub unsafe fn r#type(&self) -> Option<CFRetained<CFString>> {
196        extern "C-unwind" {
197            fn CGImageSourceGetType(isrc: &CGImageSource) -> Option<NonNull<CFString>>;
198        }
199        let ret = unsafe { CGImageSourceGetType(self) };
200        ret.map(|ret| unsafe { CFRetained::retain(ret) })
201    }
202
203    #[doc(alias = "CGImageSourceGetCount")]
204    #[inline]
205    pub unsafe fn count(&self) -> usize {
206        extern "C-unwind" {
207            fn CGImageSourceGetCount(isrc: &CGImageSource) -> usize;
208        }
209        unsafe { CGImageSourceGetCount(self) }
210    }
211
212    /// # Safety
213    ///
214    /// `options` generics must be of the correct type.
215    #[doc(alias = "CGImageSourceCopyProperties")]
216    #[inline]
217    pub unsafe fn properties(
218        &self,
219        options: Option<&CFDictionary>,
220    ) -> Option<CFRetained<CFDictionary>> {
221        extern "C-unwind" {
222            fn CGImageSourceCopyProperties(
223                isrc: &CGImageSource,
224                options: Option<&CFDictionary>,
225            ) -> Option<NonNull<CFDictionary>>;
226        }
227        let ret = unsafe { CGImageSourceCopyProperties(self, options) };
228        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
229    }
230
231    /// # Safety
232    ///
233    /// `options` generics must be of the correct type.
234    #[doc(alias = "CGImageSourceCopyPropertiesAtIndex")]
235    #[inline]
236    pub unsafe fn properties_at_index(
237        &self,
238        index: usize,
239        options: Option<&CFDictionary>,
240    ) -> Option<CFRetained<CFDictionary>> {
241        extern "C-unwind" {
242            fn CGImageSourceCopyPropertiesAtIndex(
243                isrc: &CGImageSource,
244                index: usize,
245                options: Option<&CFDictionary>,
246            ) -> Option<NonNull<CFDictionary>>;
247        }
248        let ret = unsafe { CGImageSourceCopyPropertiesAtIndex(self, index, options) };
249        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
250    }
251
252    /// # Safety
253    ///
254    /// `options` generics must be of the correct type.
255    #[doc(alias = "CGImageSourceCopyMetadataAtIndex")]
256    #[cfg(feature = "CGImageMetadata")]
257    #[inline]
258    pub unsafe fn metadata_at_index(
259        &self,
260        index: usize,
261        options: Option<&CFDictionary>,
262    ) -> Option<CFRetained<CGImageMetadata>> {
263        extern "C-unwind" {
264            fn CGImageSourceCopyMetadataAtIndex(
265                isrc: &CGImageSource,
266                index: usize,
267                options: Option<&CFDictionary>,
268            ) -> Option<NonNull<CGImageMetadata>>;
269        }
270        let ret = unsafe { CGImageSourceCopyMetadataAtIndex(self, index, options) };
271        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
272    }
273
274    /// # Safety
275    ///
276    /// `options` generics must be of the correct type.
277    #[doc(alias = "CGImageSourceCreateImageAtIndex")]
278    #[cfg(feature = "objc2-core-graphics")]
279    #[inline]
280    pub unsafe fn image_at_index(
281        &self,
282        index: usize,
283        options: Option<&CFDictionary>,
284    ) -> Option<CFRetained<CGImage>> {
285        extern "C-unwind" {
286            fn CGImageSourceCreateImageAtIndex(
287                isrc: &CGImageSource,
288                index: usize,
289                options: Option<&CFDictionary>,
290            ) -> Option<NonNull<CGImage>>;
291        }
292        let ret = unsafe { CGImageSourceCreateImageAtIndex(self, index, options) };
293        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
294    }
295
296    #[doc(alias = "CGImageSourceRemoveCacheAtIndex")]
297    #[inline]
298    pub unsafe fn remove_cache_at_index(&self, index: usize) {
299        extern "C-unwind" {
300            fn CGImageSourceRemoveCacheAtIndex(isrc: &CGImageSource, index: usize);
301        }
302        unsafe { CGImageSourceRemoveCacheAtIndex(self, index) }
303    }
304
305    /// # Safety
306    ///
307    /// `options` generics must be of the correct type.
308    #[doc(alias = "CGImageSourceCreateThumbnailAtIndex")]
309    #[cfg(feature = "objc2-core-graphics")]
310    #[inline]
311    pub unsafe fn thumbnail_at_index(
312        &self,
313        index: usize,
314        options: Option<&CFDictionary>,
315    ) -> Option<CFRetained<CGImage>> {
316        extern "C-unwind" {
317            fn CGImageSourceCreateThumbnailAtIndex(
318                isrc: &CGImageSource,
319                index: usize,
320                options: Option<&CFDictionary>,
321            ) -> Option<NonNull<CGImage>>;
322        }
323        let ret = unsafe { CGImageSourceCreateThumbnailAtIndex(self, index, options) };
324        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
325    }
326
327    /// # Safety
328    ///
329    /// `options` generics must be of the correct type.
330    #[doc(alias = "CGImageSourceCreateIncremental")]
331    #[inline]
332    pub unsafe fn new_incremental(options: Option<&CFDictionary>) -> CFRetained<CGImageSource> {
333        extern "C-unwind" {
334            fn CGImageSourceCreateIncremental(
335                options: Option<&CFDictionary>,
336            ) -> Option<NonNull<CGImageSource>>;
337        }
338        let ret = unsafe { CGImageSourceCreateIncremental(options) };
339        let ret =
340            ret.expect("function was marked as returning non-null, but actually returned NULL");
341        unsafe { CFRetained::from_raw(ret) }
342    }
343
344    #[doc(alias = "CGImageSourceUpdateData")]
345    #[inline]
346    pub unsafe fn update_data(&self, data: &CFData, r#final: bool) {
347        extern "C-unwind" {
348            fn CGImageSourceUpdateData(isrc: &CGImageSource, data: &CFData, r#final: bool);
349        }
350        unsafe { CGImageSourceUpdateData(self, data, r#final) }
351    }
352
353    #[doc(alias = "CGImageSourceUpdateDataProvider")]
354    #[cfg(feature = "objc2-core-graphics")]
355    #[inline]
356    pub unsafe fn update_data_provider(&self, provider: &CGDataProvider, r#final: bool) {
357        extern "C-unwind" {
358            fn CGImageSourceUpdateDataProvider(
359                isrc: &CGImageSource,
360                provider: &CGDataProvider,
361                r#final: bool,
362            );
363        }
364        unsafe { CGImageSourceUpdateDataProvider(self, provider, r#final) }
365    }
366
367    #[doc(alias = "CGImageSourceGetStatus")]
368    #[inline]
369    pub unsafe fn status(&self) -> CGImageSourceStatus {
370        extern "C-unwind" {
371            fn CGImageSourceGetStatus(isrc: &CGImageSource) -> CGImageSourceStatus;
372        }
373        unsafe { CGImageSourceGetStatus(self) }
374    }
375
376    #[doc(alias = "CGImageSourceGetStatusAtIndex")]
377    #[inline]
378    pub unsafe fn status_at_index(&self, index: usize) -> CGImageSourceStatus {
379        extern "C-unwind" {
380            fn CGImageSourceGetStatusAtIndex(
381                isrc: &CGImageSource,
382                index: usize,
383            ) -> CGImageSourceStatus;
384        }
385        unsafe { CGImageSourceGetStatusAtIndex(self, index) }
386    }
387
388    #[doc(alias = "CGImageSourceGetPrimaryImageIndex")]
389    #[inline]
390    pub unsafe fn primary_image_index(&self) -> usize {
391        extern "C-unwind" {
392            fn CGImageSourceGetPrimaryImageIndex(isrc: &CGImageSource) -> usize;
393        }
394        unsafe { CGImageSourceGetPrimaryImageIndex(self) }
395    }
396
397    #[doc(alias = "CGImageSourceCopyAuxiliaryDataInfoAtIndex")]
398    #[inline]
399    pub unsafe fn auxiliary_data_info_at_index(
400        &self,
401        index: usize,
402        auxiliary_image_data_type: &CFString,
403    ) -> Option<CFRetained<CFDictionary>> {
404        extern "C-unwind" {
405            fn CGImageSourceCopyAuxiliaryDataInfoAtIndex(
406                isrc: &CGImageSource,
407                index: usize,
408                auxiliary_image_data_type: &CFString,
409            ) -> Option<NonNull<CFDictionary>>;
410        }
411        let ret = unsafe {
412            CGImageSourceCopyAuxiliaryDataInfoAtIndex(self, index, auxiliary_image_data_type)
413        };
414        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
415    }
416}
417
418extern "C" {
419    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcedecoderequest?language=objc)
420    pub static kCGImageSourceDecodeRequest: &'static CFString;
421}
422
423extern "C" {
424    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcedecodetohdr?language=objc)
425    pub static kCGImageSourceDecodeToHDR: &'static CFString;
426}
427
428extern "C" {
429    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcedecodetosdr?language=objc)
430    pub static kCGImageSourceDecodeToSDR: &'static CFString;
431}
432
433extern "C" {
434    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcegenerateimagespecificlumascaling?language=objc)
435    pub static kCGImageSourceGenerateImageSpecificLumaScaling: &'static CFString;
436}
437
438extern "C" {
439    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgimagesourcedecoderequestoptions?language=objc)
440    pub static kCGImageSourceDecodeRequestOptions: &'static CFString;
441}
442
443extern "C" {
444    /// [Apple's documentation](https://developer.apple.com/documentation/imageio/kcgcomputehdrstats?language=objc)
445    pub static kCGComputeHDRStats: &'static CFString;
446}
447
448impl CGImageSource {
449    /// # Safety
450    ///
451    /// `allowable_types` generic must be of the correct type.
452    #[doc(alias = "CGImageSourceSetAllowableTypes")]
453    #[inline]
454    pub unsafe fn set_allowable_types(allowable_types: &CFArray) -> OSStatus {
455        extern "C-unwind" {
456            fn CGImageSourceSetAllowableTypes(allowable_types: &CFArray) -> OSStatus;
457        }
458        unsafe { CGImageSourceSetAllowableTypes(allowable_types) }
459    }
460}
461
462#[deprecated = "renamed to `CGImageSource::type_identifiers`"]
463#[inline]
464pub unsafe extern "C-unwind" fn CGImageSourceCopyTypeIdentifiers() -> CFRetained<CFArray> {
465    extern "C-unwind" {
466        fn CGImageSourceCopyTypeIdentifiers() -> Option<NonNull<CFArray>>;
467    }
468    let ret = unsafe { CGImageSourceCopyTypeIdentifiers() };
469    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
470    unsafe { CFRetained::from_raw(ret) }
471}
472
473#[cfg(feature = "objc2-core-graphics")]
474#[deprecated = "renamed to `CGImageSource::with_data_provider`"]
475#[inline]
476pub unsafe extern "C-unwind" fn CGImageSourceCreateWithDataProvider(
477    provider: &CGDataProvider,
478    options: Option<&CFDictionary>,
479) -> Option<CFRetained<CGImageSource>> {
480    extern "C-unwind" {
481        fn CGImageSourceCreateWithDataProvider(
482            provider: &CGDataProvider,
483            options: Option<&CFDictionary>,
484        ) -> Option<NonNull<CGImageSource>>;
485    }
486    let ret = unsafe { CGImageSourceCreateWithDataProvider(provider, options) };
487    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
488}
489
490#[deprecated = "renamed to `CGImageSource::with_data`"]
491#[inline]
492pub unsafe extern "C-unwind" fn CGImageSourceCreateWithData(
493    data: &CFData,
494    options: Option<&CFDictionary>,
495) -> Option<CFRetained<CGImageSource>> {
496    extern "C-unwind" {
497        fn CGImageSourceCreateWithData(
498            data: &CFData,
499            options: Option<&CFDictionary>,
500        ) -> Option<NonNull<CGImageSource>>;
501    }
502    let ret = unsafe { CGImageSourceCreateWithData(data, options) };
503    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
504}
505
506#[deprecated = "renamed to `CGImageSource::with_url`"]
507#[inline]
508pub unsafe extern "C-unwind" fn CGImageSourceCreateWithURL(
509    url: &CFURL,
510    options: Option<&CFDictionary>,
511) -> Option<CFRetained<CGImageSource>> {
512    extern "C-unwind" {
513        fn CGImageSourceCreateWithURL(
514            url: &CFURL,
515            options: Option<&CFDictionary>,
516        ) -> Option<NonNull<CGImageSource>>;
517    }
518    let ret = unsafe { CGImageSourceCreateWithURL(url, options) };
519    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
520}
521
522#[deprecated = "renamed to `CGImageSource::type`"]
523#[inline]
524pub unsafe extern "C-unwind" fn CGImageSourceGetType(
525    isrc: &CGImageSource,
526) -> Option<CFRetained<CFString>> {
527    extern "C-unwind" {
528        fn CGImageSourceGetType(isrc: &CGImageSource) -> Option<NonNull<CFString>>;
529    }
530    let ret = unsafe { CGImageSourceGetType(isrc) };
531    ret.map(|ret| unsafe { CFRetained::retain(ret) })
532}
533
534extern "C-unwind" {
535    #[deprecated = "renamed to `CGImageSource::count`"]
536    pub fn CGImageSourceGetCount(isrc: &CGImageSource) -> usize;
537}
538
539#[deprecated = "renamed to `CGImageSource::properties`"]
540#[inline]
541pub unsafe extern "C-unwind" fn CGImageSourceCopyProperties(
542    isrc: &CGImageSource,
543    options: Option<&CFDictionary>,
544) -> Option<CFRetained<CFDictionary>> {
545    extern "C-unwind" {
546        fn CGImageSourceCopyProperties(
547            isrc: &CGImageSource,
548            options: Option<&CFDictionary>,
549        ) -> Option<NonNull<CFDictionary>>;
550    }
551    let ret = unsafe { CGImageSourceCopyProperties(isrc, options) };
552    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
553}
554
555#[deprecated = "renamed to `CGImageSource::properties_at_index`"]
556#[inline]
557pub unsafe extern "C-unwind" fn CGImageSourceCopyPropertiesAtIndex(
558    isrc: &CGImageSource,
559    index: usize,
560    options: Option<&CFDictionary>,
561) -> Option<CFRetained<CFDictionary>> {
562    extern "C-unwind" {
563        fn CGImageSourceCopyPropertiesAtIndex(
564            isrc: &CGImageSource,
565            index: usize,
566            options: Option<&CFDictionary>,
567        ) -> Option<NonNull<CFDictionary>>;
568    }
569    let ret = unsafe { CGImageSourceCopyPropertiesAtIndex(isrc, index, options) };
570    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
571}
572
573#[cfg(feature = "CGImageMetadata")]
574#[deprecated = "renamed to `CGImageSource::metadata_at_index`"]
575#[inline]
576pub unsafe extern "C-unwind" fn CGImageSourceCopyMetadataAtIndex(
577    isrc: &CGImageSource,
578    index: usize,
579    options: Option<&CFDictionary>,
580) -> Option<CFRetained<CGImageMetadata>> {
581    extern "C-unwind" {
582        fn CGImageSourceCopyMetadataAtIndex(
583            isrc: &CGImageSource,
584            index: usize,
585            options: Option<&CFDictionary>,
586        ) -> Option<NonNull<CGImageMetadata>>;
587    }
588    let ret = unsafe { CGImageSourceCopyMetadataAtIndex(isrc, index, options) };
589    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
590}
591
592#[cfg(feature = "objc2-core-graphics")]
593#[deprecated = "renamed to `CGImageSource::image_at_index`"]
594#[inline]
595pub unsafe extern "C-unwind" fn CGImageSourceCreateImageAtIndex(
596    isrc: &CGImageSource,
597    index: usize,
598    options: Option<&CFDictionary>,
599) -> Option<CFRetained<CGImage>> {
600    extern "C-unwind" {
601        fn CGImageSourceCreateImageAtIndex(
602            isrc: &CGImageSource,
603            index: usize,
604            options: Option<&CFDictionary>,
605        ) -> Option<NonNull<CGImage>>;
606    }
607    let ret = unsafe { CGImageSourceCreateImageAtIndex(isrc, index, options) };
608    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
609}
610
611extern "C-unwind" {
612    #[deprecated = "renamed to `CGImageSource::remove_cache_at_index`"]
613    pub fn CGImageSourceRemoveCacheAtIndex(isrc: &CGImageSource, index: usize);
614}
615
616#[cfg(feature = "objc2-core-graphics")]
617#[deprecated = "renamed to `CGImageSource::thumbnail_at_index`"]
618#[inline]
619pub unsafe extern "C-unwind" fn CGImageSourceCreateThumbnailAtIndex(
620    isrc: &CGImageSource,
621    index: usize,
622    options: Option<&CFDictionary>,
623) -> Option<CFRetained<CGImage>> {
624    extern "C-unwind" {
625        fn CGImageSourceCreateThumbnailAtIndex(
626            isrc: &CGImageSource,
627            index: usize,
628            options: Option<&CFDictionary>,
629        ) -> Option<NonNull<CGImage>>;
630    }
631    let ret = unsafe { CGImageSourceCreateThumbnailAtIndex(isrc, index, options) };
632    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
633}
634
635#[deprecated = "renamed to `CGImageSource::new_incremental`"]
636#[inline]
637pub unsafe extern "C-unwind" fn CGImageSourceCreateIncremental(
638    options: Option<&CFDictionary>,
639) -> CFRetained<CGImageSource> {
640    extern "C-unwind" {
641        fn CGImageSourceCreateIncremental(
642            options: Option<&CFDictionary>,
643        ) -> Option<NonNull<CGImageSource>>;
644    }
645    let ret = unsafe { CGImageSourceCreateIncremental(options) };
646    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
647    unsafe { CFRetained::from_raw(ret) }
648}
649
650extern "C-unwind" {
651    #[deprecated = "renamed to `CGImageSource::update_data`"]
652    pub fn CGImageSourceUpdateData(isrc: &CGImageSource, data: &CFData, r#final: bool);
653}
654
655extern "C-unwind" {
656    #[cfg(feature = "objc2-core-graphics")]
657    #[deprecated = "renamed to `CGImageSource::update_data_provider`"]
658    pub fn CGImageSourceUpdateDataProvider(
659        isrc: &CGImageSource,
660        provider: &CGDataProvider,
661        r#final: bool,
662    );
663}
664
665extern "C-unwind" {
666    #[deprecated = "renamed to `CGImageSource::status`"]
667    pub fn CGImageSourceGetStatus(isrc: &CGImageSource) -> CGImageSourceStatus;
668}
669
670extern "C-unwind" {
671    #[deprecated = "renamed to `CGImageSource::status_at_index`"]
672    pub fn CGImageSourceGetStatusAtIndex(isrc: &CGImageSource, index: usize)
673        -> CGImageSourceStatus;
674}
675
676extern "C-unwind" {
677    #[deprecated = "renamed to `CGImageSource::primary_image_index`"]
678    pub fn CGImageSourceGetPrimaryImageIndex(isrc: &CGImageSource) -> usize;
679}
680
681#[deprecated = "renamed to `CGImageSource::auxiliary_data_info_at_index`"]
682#[inline]
683pub unsafe extern "C-unwind" fn CGImageSourceCopyAuxiliaryDataInfoAtIndex(
684    isrc: &CGImageSource,
685    index: usize,
686    auxiliary_image_data_type: &CFString,
687) -> Option<CFRetained<CFDictionary>> {
688    extern "C-unwind" {
689        fn CGImageSourceCopyAuxiliaryDataInfoAtIndex(
690            isrc: &CGImageSource,
691            index: usize,
692            auxiliary_image_data_type: &CFString,
693        ) -> Option<NonNull<CFDictionary>>;
694    }
695    let ret = unsafe {
696        CGImageSourceCopyAuxiliaryDataInfoAtIndex(isrc, index, auxiliary_image_data_type)
697    };
698    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
699}
700
701extern "C-unwind" {
702    #[deprecated = "renamed to `CGImageSource::set_allowable_types`"]
703    pub fn CGImageSourceSetAllowableTypes(allowable_types: &CFArray) -> OSStatus;
704}