1use 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
11use crate::*;
12
13#[doc(alias = "CGImageRef")]
15#[repr(C)]
16pub struct CGImage {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 unsafe impl CGImage {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"CGImage"> for CGImage {}
27);
28
29#[repr(transparent)]
32#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33pub struct CGImageAlphaInfo(pub u32);
34impl CGImageAlphaInfo {
35 #[doc(alias = "kCGImageAlphaNone")]
36 pub const None: Self = Self(0);
37 #[doc(alias = "kCGImageAlphaPremultipliedLast")]
38 pub const PremultipliedLast: Self = Self(1);
39 #[doc(alias = "kCGImageAlphaPremultipliedFirst")]
40 pub const PremultipliedFirst: Self = Self(2);
41 #[doc(alias = "kCGImageAlphaLast")]
42 pub const Last: Self = Self(3);
43 #[doc(alias = "kCGImageAlphaFirst")]
44 pub const First: Self = Self(4);
45 #[doc(alias = "kCGImageAlphaNoneSkipLast")]
46 pub const NoneSkipLast: Self = Self(5);
47 #[doc(alias = "kCGImageAlphaNoneSkipFirst")]
48 pub const NoneSkipFirst: Self = Self(6);
49 #[doc(alias = "kCGImageAlphaOnly")]
50 pub const Only: Self = Self(7);
51}
52
53#[cfg(feature = "objc2")]
54unsafe impl Encode for CGImageAlphaInfo {
55 const ENCODING: Encoding = u32::ENCODING;
56}
57
58#[cfg(feature = "objc2")]
59unsafe impl RefEncode for CGImageAlphaInfo {
60 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct CGImageComponentInfo(pub u32);
68impl CGImageComponentInfo {
69 #[doc(alias = "kCGImageComponentInteger")]
70 pub const Integer: Self = Self(0 << 8);
71 #[doc(alias = "kCGImageComponentFloat")]
72 pub const Float: Self = Self(1 << 8);
73}
74
75#[cfg(feature = "objc2")]
76unsafe impl Encode for CGImageComponentInfo {
77 const ENCODING: Encoding = u32::ENCODING;
78}
79
80#[cfg(feature = "objc2")]
81unsafe impl RefEncode for CGImageComponentInfo {
82 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
83}
84
85#[repr(transparent)]
88#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
89pub struct CGImageByteOrderInfo(pub u32);
90impl CGImageByteOrderInfo {
91 #[doc(alias = "kCGImageByteOrderMask")]
92 #[deprecated]
93 pub const OrderMask: Self = Self(0x7000);
94 #[doc(alias = "kCGImageByteOrderDefault")]
95 pub const OrderDefault: Self = Self(0 << 12);
96 #[doc(alias = "kCGImageByteOrder16Little")]
97 pub const Order16Little: Self = Self(1 << 12);
98 #[doc(alias = "kCGImageByteOrder32Little")]
99 pub const Order32Little: Self = Self(2 << 12);
100 #[doc(alias = "kCGImageByteOrder16Big")]
101 pub const Order16Big: Self = Self(3 << 12);
102 #[doc(alias = "kCGImageByteOrder32Big")]
103 pub const Order32Big: Self = Self(4 << 12);
104}
105
106#[cfg(feature = "objc2")]
107unsafe impl Encode for CGImageByteOrderInfo {
108 const ENCODING: Encoding = u32::ENCODING;
109}
110
111#[cfg(feature = "objc2")]
112unsafe impl RefEncode for CGImageByteOrderInfo {
113 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
114}
115
116#[repr(transparent)]
119#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
120pub struct CGImagePixelFormatInfo(pub u32);
121impl CGImagePixelFormatInfo {
122 #[doc(alias = "kCGImagePixelFormatMask")]
123 #[deprecated]
124 pub const Mask: Self = Self(0xF0000);
125 #[doc(alias = "kCGImagePixelFormatPacked")]
126 pub const Packed: Self = Self(0 << 16);
127 #[doc(alias = "kCGImagePixelFormatRGB555")]
128 pub const RGB555: Self = Self(1 << 16);
129 #[doc(alias = "kCGImagePixelFormatRGB565")]
130 pub const RGB565: Self = Self(2 << 16);
131 #[doc(alias = "kCGImagePixelFormatRGB101010")]
132 pub const RGB101010: Self = Self(3 << 16);
133 #[doc(alias = "kCGImagePixelFormatRGBCIF10")]
134 pub const RGBCIF10: Self = Self(4 << 16);
135}
136
137#[cfg(feature = "objc2")]
138unsafe impl Encode for CGImagePixelFormatInfo {
139 const ENCODING: Encoding = u32::ENCODING;
140}
141
142#[cfg(feature = "objc2")]
143unsafe impl RefEncode for CGImagePixelFormatInfo {
144 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
145}
146
147#[repr(transparent)]
150#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
151pub struct CGBitmapInfo(pub u32);
152bitflags::bitflags! {
153 impl CGBitmapInfo: u32 {
154 #[doc(alias = "kCGBitmapAlphaInfoMask")]
155 const AlphaInfoMask = 0x1F;
156 #[doc(alias = "kCGBitmapComponentInfoMask")]
157 const ComponentInfoMask = 0xF00;
158 #[doc(alias = "kCGBitmapByteOrderInfoMask")]
159 const ByteOrderInfoMask = 0x7000;
160 #[doc(alias = "kCGBitmapPixelFormatInfoMask")]
161 const PixelFormatInfoMask = 0xF0000;
162 #[doc(alias = "kCGBitmapFloatInfoMask")]
163#[deprecated]
164 const FloatInfoMask = CGBitmapInfo::ComponentInfoMask.0;
165 #[doc(alias = "kCGBitmapByteOrderMask")]
166#[deprecated]
167 const ByteOrderMask = CGBitmapInfo::ByteOrderInfoMask.0;
168 #[doc(alias = "kCGBitmapFloatComponents")]
169#[deprecated]
170 const FloatComponents = CGImageComponentInfo::Float.0;
171 #[doc(alias = "kCGBitmapByteOrderDefault")]
172#[deprecated]
173 const ByteOrderDefault = CGImageByteOrderInfo::OrderDefault.0;
174 #[doc(alias = "kCGBitmapByteOrder16Little")]
175#[deprecated]
176 const ByteOrder16Little = CGImageByteOrderInfo::Order16Little.0;
177 #[doc(alias = "kCGBitmapByteOrder32Little")]
178#[deprecated]
179 const ByteOrder32Little = CGImageByteOrderInfo::Order32Little.0;
180 #[doc(alias = "kCGBitmapByteOrder16Big")]
181#[deprecated]
182 const ByteOrder16Big = CGImageByteOrderInfo::Order16Big.0;
183 #[doc(alias = "kCGBitmapByteOrder32Big")]
184#[deprecated]
185 const ByteOrder32Big = CGImageByteOrderInfo::Order32Big.0;
186 }
187}
188
189#[cfg(feature = "objc2")]
190unsafe impl Encode for CGBitmapInfo {
191 const ENCODING: Encoding = u32::ENCODING;
192}
193
194#[cfg(feature = "objc2")]
195unsafe impl RefEncode for CGBitmapInfo {
196 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
197}
198
199impl CGBitmapInfo {
200 }
202
203unsafe impl ConcreteType for CGImage {
204 #[doc(alias = "CGImageGetTypeID")]
205 #[inline]
206 fn type_id() -> CFTypeID {
207 extern "C-unwind" {
208 fn CGImageGetTypeID() -> CFTypeID;
209 }
210 unsafe { CGImageGetTypeID() }
211 }
212}
213
214impl CGImage {
215 #[doc(alias = "CGImageCreate")]
219 #[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
220 #[inline]
221 pub unsafe fn new(
222 width: usize,
223 height: usize,
224 bits_per_component: usize,
225 bits_per_pixel: usize,
226 bytes_per_row: usize,
227 space: Option<&CGColorSpace>,
228 bitmap_info: CGBitmapInfo,
229 provider: Option<&CGDataProvider>,
230 decode: *const CGFloat,
231 should_interpolate: bool,
232 intent: CGColorRenderingIntent,
233 ) -> Option<CFRetained<CGImage>> {
234 extern "C-unwind" {
235 fn CGImageCreate(
236 width: usize,
237 height: usize,
238 bits_per_component: usize,
239 bits_per_pixel: usize,
240 bytes_per_row: usize,
241 space: Option<&CGColorSpace>,
242 bitmap_info: CGBitmapInfo,
243 provider: Option<&CGDataProvider>,
244 decode: *const CGFloat,
245 should_interpolate: bool,
246 intent: CGColorRenderingIntent,
247 ) -> Option<NonNull<CGImage>>;
248 }
249 let ret = unsafe {
250 CGImageCreate(
251 width,
252 height,
253 bits_per_component,
254 bits_per_pixel,
255 bytes_per_row,
256 space,
257 bitmap_info,
258 provider,
259 decode,
260 should_interpolate,
261 intent,
262 )
263 };
264 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
265 }
266
267 #[doc(alias = "CGImageMaskCreate")]
271 #[cfg(feature = "CGDataProvider")]
272 #[inline]
273 pub unsafe fn mask_create(
274 width: usize,
275 height: usize,
276 bits_per_component: usize,
277 bits_per_pixel: usize,
278 bytes_per_row: usize,
279 provider: Option<&CGDataProvider>,
280 decode: *const CGFloat,
281 should_interpolate: bool,
282 ) -> Option<CFRetained<CGImage>> {
283 extern "C-unwind" {
284 fn CGImageMaskCreate(
285 width: usize,
286 height: usize,
287 bits_per_component: usize,
288 bits_per_pixel: usize,
289 bytes_per_row: usize,
290 provider: Option<&CGDataProvider>,
291 decode: *const CGFloat,
292 should_interpolate: bool,
293 ) -> Option<NonNull<CGImage>>;
294 }
295 let ret = unsafe {
296 CGImageMaskCreate(
297 width,
298 height,
299 bits_per_component,
300 bits_per_pixel,
301 bytes_per_row,
302 provider,
303 decode,
304 should_interpolate,
305 )
306 };
307 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
308 }
309
310 #[doc(alias = "CGImageCreateCopy")]
311 #[inline]
312 pub fn new_copy(image: Option<&CGImage>) -> Option<CFRetained<CGImage>> {
313 extern "C-unwind" {
314 fn CGImageCreateCopy(image: Option<&CGImage>) -> Option<NonNull<CGImage>>;
315 }
316 let ret = unsafe { CGImageCreateCopy(image) };
317 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
318 }
319
320 #[doc(alias = "CGImageCreateWithJPEGDataProvider")]
324 #[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
325 #[inline]
326 pub unsafe fn with_jpeg_data_provider(
327 source: Option<&CGDataProvider>,
328 decode: *const CGFloat,
329 should_interpolate: bool,
330 intent: CGColorRenderingIntent,
331 ) -> Option<CFRetained<CGImage>> {
332 extern "C-unwind" {
333 fn CGImageCreateWithJPEGDataProvider(
334 source: Option<&CGDataProvider>,
335 decode: *const CGFloat,
336 should_interpolate: bool,
337 intent: CGColorRenderingIntent,
338 ) -> Option<NonNull<CGImage>>;
339 }
340 let ret = unsafe {
341 CGImageCreateWithJPEGDataProvider(source, decode, should_interpolate, intent)
342 };
343 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
344 }
345
346 #[doc(alias = "CGImageCreateWithPNGDataProvider")]
350 #[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
351 #[inline]
352 pub unsafe fn with_png_data_provider(
353 source: Option<&CGDataProvider>,
354 decode: *const CGFloat,
355 should_interpolate: bool,
356 intent: CGColorRenderingIntent,
357 ) -> Option<CFRetained<CGImage>> {
358 extern "C-unwind" {
359 fn CGImageCreateWithPNGDataProvider(
360 source: Option<&CGDataProvider>,
361 decode: *const CGFloat,
362 should_interpolate: bool,
363 intent: CGColorRenderingIntent,
364 ) -> Option<NonNull<CGImage>>;
365 }
366 let ret =
367 unsafe { CGImageCreateWithPNGDataProvider(source, decode, should_interpolate, intent) };
368 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
369 }
370
371 #[doc(alias = "CGImageCreateWithImageInRect")]
372 #[inline]
373 pub fn with_image_in_rect(
374 image: Option<&CGImage>,
375 rect: CGRect,
376 ) -> Option<CFRetained<CGImage>> {
377 extern "C-unwind" {
378 fn CGImageCreateWithImageInRect(
379 image: Option<&CGImage>,
380 rect: CGRect,
381 ) -> Option<NonNull<CGImage>>;
382 }
383 let ret = unsafe { CGImageCreateWithImageInRect(image, rect) };
384 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
385 }
386
387 #[doc(alias = "CGImageCreateWithMask")]
388 #[inline]
389 pub fn with_mask(
390 image: Option<&CGImage>,
391 mask: Option<&CGImage>,
392 ) -> Option<CFRetained<CGImage>> {
393 extern "C-unwind" {
394 fn CGImageCreateWithMask(
395 image: Option<&CGImage>,
396 mask: Option<&CGImage>,
397 ) -> Option<NonNull<CGImage>>;
398 }
399 let ret = unsafe { CGImageCreateWithMask(image, mask) };
400 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
401 }
402
403 #[doc(alias = "CGImageCreateWithMaskingColors")]
407 #[inline]
408 pub unsafe fn with_masking_colors(
409 image: Option<&CGImage>,
410 components: *const CGFloat,
411 ) -> Option<CFRetained<CGImage>> {
412 extern "C-unwind" {
413 fn CGImageCreateWithMaskingColors(
414 image: Option<&CGImage>,
415 components: *const CGFloat,
416 ) -> Option<NonNull<CGImage>>;
417 }
418 let ret = unsafe { CGImageCreateWithMaskingColors(image, components) };
419 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
420 }
421
422 #[doc(alias = "CGImageCreateCopyWithColorSpace")]
423 #[cfg(feature = "CGColorSpace")]
424 #[inline]
425 pub fn new_copy_with_color_space(
426 image: Option<&CGImage>,
427 space: Option<&CGColorSpace>,
428 ) -> Option<CFRetained<CGImage>> {
429 extern "C-unwind" {
430 fn CGImageCreateCopyWithColorSpace(
431 image: Option<&CGImage>,
432 space: Option<&CGColorSpace>,
433 ) -> Option<NonNull<CGImage>>;
434 }
435 let ret = unsafe { CGImageCreateCopyWithColorSpace(image, space) };
436 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
437 }
438
439 #[doc(alias = "CGImageCreateWithContentHeadroom")]
443 #[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
444 #[inline]
445 pub unsafe fn with_content_headroom(
446 headroom: c_float,
447 width: usize,
448 height: usize,
449 bits_per_component: usize,
450 bits_per_pixel: usize,
451 bytes_per_row: usize,
452 space: Option<&CGColorSpace>,
453 bitmap_info: CGBitmapInfo,
454 provider: Option<&CGDataProvider>,
455 decode: *const CGFloat,
456 should_interpolate: bool,
457 intent: CGColorRenderingIntent,
458 ) -> Option<CFRetained<CGImage>> {
459 extern "C-unwind" {
460 fn CGImageCreateWithContentHeadroom(
461 headroom: c_float,
462 width: usize,
463 height: usize,
464 bits_per_component: usize,
465 bits_per_pixel: usize,
466 bytes_per_row: usize,
467 space: Option<&CGColorSpace>,
468 bitmap_info: CGBitmapInfo,
469 provider: Option<&CGDataProvider>,
470 decode: *const CGFloat,
471 should_interpolate: bool,
472 intent: CGColorRenderingIntent,
473 ) -> Option<NonNull<CGImage>>;
474 }
475 let ret = unsafe {
476 CGImageCreateWithContentHeadroom(
477 headroom,
478 width,
479 height,
480 bits_per_component,
481 bits_per_pixel,
482 bytes_per_row,
483 space,
484 bitmap_info,
485 provider,
486 decode,
487 should_interpolate,
488 intent,
489 )
490 };
491 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
492 }
493
494 #[doc(alias = "CGImageCreateCopyWithContentHeadroom")]
495 #[inline]
496 pub fn new_copy_with_content_headroom(
497 headroom: c_float,
498 image: Option<&CGImage>,
499 ) -> Option<CFRetained<CGImage>> {
500 extern "C-unwind" {
501 fn CGImageCreateCopyWithContentHeadroom(
502 headroom: c_float,
503 image: Option<&CGImage>,
504 ) -> Option<NonNull<CGImage>>;
505 }
506 let ret = unsafe { CGImageCreateCopyWithContentHeadroom(headroom, image) };
507 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
508 }
509}
510
511extern "C" {
512 pub static kCGDefaultHDRImageContentHeadroom: c_float;
514}
515
516impl CGImage {
517 #[doc(alias = "CGImageGetContentHeadroom")]
518 #[inline]
519 pub fn content_headroom(image: Option<&CGImage>) -> c_float {
520 extern "C-unwind" {
521 fn CGImageGetContentHeadroom(image: Option<&CGImage>) -> c_float;
522 }
523 unsafe { CGImageGetContentHeadroom(image) }
524 }
525
526 #[doc(alias = "CGImageCalculateContentHeadroom")]
527 #[inline]
528 pub fn calculate_content_headroom(image: Option<&CGImage>) -> c_float {
529 extern "C-unwind" {
530 fn CGImageCalculateContentHeadroom(image: Option<&CGImage>) -> c_float;
531 }
532 unsafe { CGImageCalculateContentHeadroom(image) }
533 }
534
535 #[doc(alias = "CGImageGetContentAverageLightLevel")]
536 #[inline]
537 pub fn content_average_light_level(image: Option<&CGImage>) -> c_float {
538 extern "C-unwind" {
539 fn CGImageGetContentAverageLightLevel(image: Option<&CGImage>) -> c_float;
540 }
541 unsafe { CGImageGetContentAverageLightLevel(image) }
542 }
543
544 #[doc(alias = "CGImageCalculateContentAverageLightLevel")]
545 #[inline]
546 pub fn calculate_content_average_light_level(image: Option<&CGImage>) -> c_float {
547 extern "C-unwind" {
548 fn CGImageCalculateContentAverageLightLevel(image: Option<&CGImage>) -> c_float;
549 }
550 unsafe { CGImageCalculateContentAverageLightLevel(image) }
551 }
552
553 #[doc(alias = "CGImageCreateCopyWithContentAverageLightLevel")]
554 #[inline]
555 pub fn new_copy_with_content_average_light_level(
556 image: Option<&CGImage>,
557 avll: c_float,
558 ) -> Option<CFRetained<CGImage>> {
559 extern "C-unwind" {
560 fn CGImageCreateCopyWithContentAverageLightLevel(
561 image: Option<&CGImage>,
562 avll: c_float,
563 ) -> Option<NonNull<CGImage>>;
564 }
565 let ret = unsafe { CGImageCreateCopyWithContentAverageLightLevel(image, avll) };
566 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
567 }
568
569 #[doc(alias = "CGImageCreateCopyWithCalculatedHDRStats")]
570 #[inline]
571 pub fn new_copy_with_calculated_hdr_stats(
572 image: Option<&CGImage>,
573 ) -> Option<CFRetained<CGImage>> {
574 extern "C-unwind" {
575 fn CGImageCreateCopyWithCalculatedHDRStats(
576 image: Option<&CGImage>,
577 ) -> Option<NonNull<CGImage>>;
578 }
579 let ret = unsafe { CGImageCreateCopyWithCalculatedHDRStats(image) };
580 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
581 }
582
583 #[doc(alias = "CGImageIsMask")]
584 #[inline]
585 pub fn is_mask(image: Option<&CGImage>) -> bool {
586 extern "C-unwind" {
587 fn CGImageIsMask(image: Option<&CGImage>) -> bool;
588 }
589 unsafe { CGImageIsMask(image) }
590 }
591
592 #[doc(alias = "CGImageGetWidth")]
593 #[inline]
594 pub fn width(image: Option<&CGImage>) -> usize {
595 extern "C-unwind" {
596 fn CGImageGetWidth(image: Option<&CGImage>) -> usize;
597 }
598 unsafe { CGImageGetWidth(image) }
599 }
600
601 #[doc(alias = "CGImageGetHeight")]
602 #[inline]
603 pub fn height(image: Option<&CGImage>) -> usize {
604 extern "C-unwind" {
605 fn CGImageGetHeight(image: Option<&CGImage>) -> usize;
606 }
607 unsafe { CGImageGetHeight(image) }
608 }
609
610 #[doc(alias = "CGImageGetBitsPerComponent")]
611 #[inline]
612 pub fn bits_per_component(image: Option<&CGImage>) -> usize {
613 extern "C-unwind" {
614 fn CGImageGetBitsPerComponent(image: Option<&CGImage>) -> usize;
615 }
616 unsafe { CGImageGetBitsPerComponent(image) }
617 }
618
619 #[doc(alias = "CGImageGetBitsPerPixel")]
620 #[inline]
621 pub fn bits_per_pixel(image: Option<&CGImage>) -> usize {
622 extern "C-unwind" {
623 fn CGImageGetBitsPerPixel(image: Option<&CGImage>) -> usize;
624 }
625 unsafe { CGImageGetBitsPerPixel(image) }
626 }
627
628 #[doc(alias = "CGImageGetBytesPerRow")]
629 #[inline]
630 pub fn bytes_per_row(image: Option<&CGImage>) -> usize {
631 extern "C-unwind" {
632 fn CGImageGetBytesPerRow(image: Option<&CGImage>) -> usize;
633 }
634 unsafe { CGImageGetBytesPerRow(image) }
635 }
636
637 #[doc(alias = "CGImageGetColorSpace")]
638 #[cfg(feature = "CGColorSpace")]
639 #[inline]
640 pub fn color_space(image: Option<&CGImage>) -> Option<CFRetained<CGColorSpace>> {
641 extern "C-unwind" {
642 fn CGImageGetColorSpace(image: Option<&CGImage>) -> Option<NonNull<CGColorSpace>>;
643 }
644 let ret = unsafe { CGImageGetColorSpace(image) };
645 ret.map(|ret| unsafe { CFRetained::retain(ret) })
646 }
647
648 #[doc(alias = "CGImageGetAlphaInfo")]
649 #[inline]
650 pub fn alpha_info(image: Option<&CGImage>) -> CGImageAlphaInfo {
651 extern "C-unwind" {
652 fn CGImageGetAlphaInfo(image: Option<&CGImage>) -> CGImageAlphaInfo;
653 }
654 unsafe { CGImageGetAlphaInfo(image) }
655 }
656
657 #[doc(alias = "CGImageGetDataProvider")]
658 #[cfg(feature = "CGDataProvider")]
659 #[inline]
660 pub fn data_provider(image: Option<&CGImage>) -> Option<CFRetained<CGDataProvider>> {
661 extern "C-unwind" {
662 fn CGImageGetDataProvider(image: Option<&CGImage>) -> Option<NonNull<CGDataProvider>>;
663 }
664 let ret = unsafe { CGImageGetDataProvider(image) };
665 ret.map(|ret| unsafe { CFRetained::retain(ret) })
666 }
667
668 #[doc(alias = "CGImageGetDecode")]
669 #[inline]
670 pub fn decode(image: Option<&CGImage>) -> *const CGFloat {
671 extern "C-unwind" {
672 fn CGImageGetDecode(image: Option<&CGImage>) -> *const CGFloat;
673 }
674 unsafe { CGImageGetDecode(image) }
675 }
676
677 #[doc(alias = "CGImageGetShouldInterpolate")]
678 #[inline]
679 pub fn should_interpolate(image: Option<&CGImage>) -> bool {
680 extern "C-unwind" {
681 fn CGImageGetShouldInterpolate(image: Option<&CGImage>) -> bool;
682 }
683 unsafe { CGImageGetShouldInterpolate(image) }
684 }
685
686 #[doc(alias = "CGImageGetRenderingIntent")]
687 #[cfg(feature = "CGColorSpace")]
688 #[inline]
689 pub fn rendering_intent(image: Option<&CGImage>) -> CGColorRenderingIntent {
690 extern "C-unwind" {
691 fn CGImageGetRenderingIntent(image: Option<&CGImage>) -> CGColorRenderingIntent;
692 }
693 unsafe { CGImageGetRenderingIntent(image) }
694 }
695
696 #[doc(alias = "CGImageGetBitmapInfo")]
697 #[inline]
698 pub fn bitmap_info(image: Option<&CGImage>) -> CGBitmapInfo {
699 extern "C-unwind" {
700 fn CGImageGetBitmapInfo(image: Option<&CGImage>) -> CGBitmapInfo;
701 }
702 unsafe { CGImageGetBitmapInfo(image) }
703 }
704
705 #[doc(alias = "CGImageGetByteOrderInfo")]
706 #[inline]
707 pub fn byte_order_info(image: Option<&CGImage>) -> CGImageByteOrderInfo {
708 extern "C-unwind" {
709 fn CGImageGetByteOrderInfo(image: Option<&CGImage>) -> CGImageByteOrderInfo;
710 }
711 unsafe { CGImageGetByteOrderInfo(image) }
712 }
713
714 #[doc(alias = "CGImageGetPixelFormatInfo")]
715 #[inline]
716 pub fn pixel_format_info(image: Option<&CGImage>) -> CGImagePixelFormatInfo {
717 extern "C-unwind" {
718 fn CGImageGetPixelFormatInfo(image: Option<&CGImage>) -> CGImagePixelFormatInfo;
719 }
720 unsafe { CGImageGetPixelFormatInfo(image) }
721 }
722
723 #[doc(alias = "CGImageShouldToneMap")]
724 #[inline]
725 pub fn should_tone_map(image: Option<&CGImage>) -> bool {
726 extern "C-unwind" {
727 fn CGImageShouldToneMap(image: Option<&CGImage>) -> bool;
728 }
729 unsafe { CGImageShouldToneMap(image) }
730 }
731
732 #[doc(alias = "CGImageContainsImageSpecificToneMappingMetadata")]
733 #[inline]
734 pub fn contains_image_specific_tone_mapping_metadata(image: Option<&CGImage>) -> bool {
735 extern "C-unwind" {
736 fn CGImageContainsImageSpecificToneMappingMetadata(image: Option<&CGImage>) -> bool;
737 }
738 unsafe { CGImageContainsImageSpecificToneMappingMetadata(image) }
739 }
740
741 #[doc(alias = "CGImageGetUTType")]
742 #[inline]
743 pub fn ut_type(image: Option<&CGImage>) -> Option<CFRetained<CFString>> {
744 extern "C-unwind" {
745 fn CGImageGetUTType(image: Option<&CGImage>) -> Option<NonNull<CFString>>;
746 }
747 let ret = unsafe { CGImageGetUTType(image) };
748 ret.map(|ret| unsafe { CFRetained::retain(ret) })
749 }
750}
751
752#[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
753#[deprecated = "renamed to `CGImage::new`"]
754#[inline]
755pub unsafe extern "C-unwind" fn CGImageCreate(
756 width: usize,
757 height: usize,
758 bits_per_component: usize,
759 bits_per_pixel: usize,
760 bytes_per_row: usize,
761 space: Option<&CGColorSpace>,
762 bitmap_info: CGBitmapInfo,
763 provider: Option<&CGDataProvider>,
764 decode: *const CGFloat,
765 should_interpolate: bool,
766 intent: CGColorRenderingIntent,
767) -> Option<CFRetained<CGImage>> {
768 extern "C-unwind" {
769 fn CGImageCreate(
770 width: usize,
771 height: usize,
772 bits_per_component: usize,
773 bits_per_pixel: usize,
774 bytes_per_row: usize,
775 space: Option<&CGColorSpace>,
776 bitmap_info: CGBitmapInfo,
777 provider: Option<&CGDataProvider>,
778 decode: *const CGFloat,
779 should_interpolate: bool,
780 intent: CGColorRenderingIntent,
781 ) -> Option<NonNull<CGImage>>;
782 }
783 let ret = unsafe {
784 CGImageCreate(
785 width,
786 height,
787 bits_per_component,
788 bits_per_pixel,
789 bytes_per_row,
790 space,
791 bitmap_info,
792 provider,
793 decode,
794 should_interpolate,
795 intent,
796 )
797 };
798 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
799}
800
801#[cfg(feature = "CGDataProvider")]
802#[deprecated = "renamed to `CGImage::mask_create`"]
803#[inline]
804pub unsafe extern "C-unwind" fn CGImageMaskCreate(
805 width: usize,
806 height: usize,
807 bits_per_component: usize,
808 bits_per_pixel: usize,
809 bytes_per_row: usize,
810 provider: Option<&CGDataProvider>,
811 decode: *const CGFloat,
812 should_interpolate: bool,
813) -> Option<CFRetained<CGImage>> {
814 extern "C-unwind" {
815 fn CGImageMaskCreate(
816 width: usize,
817 height: usize,
818 bits_per_component: usize,
819 bits_per_pixel: usize,
820 bytes_per_row: usize,
821 provider: Option<&CGDataProvider>,
822 decode: *const CGFloat,
823 should_interpolate: bool,
824 ) -> Option<NonNull<CGImage>>;
825 }
826 let ret = unsafe {
827 CGImageMaskCreate(
828 width,
829 height,
830 bits_per_component,
831 bits_per_pixel,
832 bytes_per_row,
833 provider,
834 decode,
835 should_interpolate,
836 )
837 };
838 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
839}
840
841#[deprecated = "renamed to `CGImage::new_copy`"]
842#[inline]
843pub extern "C-unwind" fn CGImageCreateCopy(image: Option<&CGImage>) -> Option<CFRetained<CGImage>> {
844 extern "C-unwind" {
845 fn CGImageCreateCopy(image: Option<&CGImage>) -> Option<NonNull<CGImage>>;
846 }
847 let ret = unsafe { CGImageCreateCopy(image) };
848 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
849}
850
851#[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
852#[deprecated = "renamed to `CGImage::with_jpeg_data_provider`"]
853#[inline]
854pub unsafe extern "C-unwind" fn CGImageCreateWithJPEGDataProvider(
855 source: Option<&CGDataProvider>,
856 decode: *const CGFloat,
857 should_interpolate: bool,
858 intent: CGColorRenderingIntent,
859) -> Option<CFRetained<CGImage>> {
860 extern "C-unwind" {
861 fn CGImageCreateWithJPEGDataProvider(
862 source: Option<&CGDataProvider>,
863 decode: *const CGFloat,
864 should_interpolate: bool,
865 intent: CGColorRenderingIntent,
866 ) -> Option<NonNull<CGImage>>;
867 }
868 let ret =
869 unsafe { CGImageCreateWithJPEGDataProvider(source, decode, should_interpolate, intent) };
870 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
871}
872
873#[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
874#[deprecated = "renamed to `CGImage::with_png_data_provider`"]
875#[inline]
876pub unsafe extern "C-unwind" fn CGImageCreateWithPNGDataProvider(
877 source: Option<&CGDataProvider>,
878 decode: *const CGFloat,
879 should_interpolate: bool,
880 intent: CGColorRenderingIntent,
881) -> Option<CFRetained<CGImage>> {
882 extern "C-unwind" {
883 fn CGImageCreateWithPNGDataProvider(
884 source: Option<&CGDataProvider>,
885 decode: *const CGFloat,
886 should_interpolate: bool,
887 intent: CGColorRenderingIntent,
888 ) -> Option<NonNull<CGImage>>;
889 }
890 let ret =
891 unsafe { CGImageCreateWithPNGDataProvider(source, decode, should_interpolate, intent) };
892 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
893}
894
895#[deprecated = "renamed to `CGImage::with_image_in_rect`"]
896#[inline]
897pub extern "C-unwind" fn CGImageCreateWithImageInRect(
898 image: Option<&CGImage>,
899 rect: CGRect,
900) -> Option<CFRetained<CGImage>> {
901 extern "C-unwind" {
902 fn CGImageCreateWithImageInRect(
903 image: Option<&CGImage>,
904 rect: CGRect,
905 ) -> Option<NonNull<CGImage>>;
906 }
907 let ret = unsafe { CGImageCreateWithImageInRect(image, rect) };
908 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
909}
910
911#[deprecated = "renamed to `CGImage::with_mask`"]
912#[inline]
913pub extern "C-unwind" fn CGImageCreateWithMask(
914 image: Option<&CGImage>,
915 mask: Option<&CGImage>,
916) -> Option<CFRetained<CGImage>> {
917 extern "C-unwind" {
918 fn CGImageCreateWithMask(
919 image: Option<&CGImage>,
920 mask: Option<&CGImage>,
921 ) -> Option<NonNull<CGImage>>;
922 }
923 let ret = unsafe { CGImageCreateWithMask(image, mask) };
924 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
925}
926
927#[deprecated = "renamed to `CGImage::with_masking_colors`"]
928#[inline]
929pub unsafe extern "C-unwind" fn CGImageCreateWithMaskingColors(
930 image: Option<&CGImage>,
931 components: *const CGFloat,
932) -> Option<CFRetained<CGImage>> {
933 extern "C-unwind" {
934 fn CGImageCreateWithMaskingColors(
935 image: Option<&CGImage>,
936 components: *const CGFloat,
937 ) -> Option<NonNull<CGImage>>;
938 }
939 let ret = unsafe { CGImageCreateWithMaskingColors(image, components) };
940 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
941}
942
943#[cfg(feature = "CGColorSpace")]
944#[deprecated = "renamed to `CGImage::new_copy_with_color_space`"]
945#[inline]
946pub extern "C-unwind" fn CGImageCreateCopyWithColorSpace(
947 image: Option<&CGImage>,
948 space: Option<&CGColorSpace>,
949) -> Option<CFRetained<CGImage>> {
950 extern "C-unwind" {
951 fn CGImageCreateCopyWithColorSpace(
952 image: Option<&CGImage>,
953 space: Option<&CGColorSpace>,
954 ) -> Option<NonNull<CGImage>>;
955 }
956 let ret = unsafe { CGImageCreateCopyWithColorSpace(image, space) };
957 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
958}
959
960#[cfg(all(feature = "CGColorSpace", feature = "CGDataProvider"))]
961#[deprecated = "renamed to `CGImage::with_content_headroom`"]
962#[inline]
963pub unsafe extern "C-unwind" fn CGImageCreateWithContentHeadroom(
964 headroom: c_float,
965 width: usize,
966 height: usize,
967 bits_per_component: usize,
968 bits_per_pixel: usize,
969 bytes_per_row: usize,
970 space: Option<&CGColorSpace>,
971 bitmap_info: CGBitmapInfo,
972 provider: Option<&CGDataProvider>,
973 decode: *const CGFloat,
974 should_interpolate: bool,
975 intent: CGColorRenderingIntent,
976) -> Option<CFRetained<CGImage>> {
977 extern "C-unwind" {
978 fn CGImageCreateWithContentHeadroom(
979 headroom: c_float,
980 width: usize,
981 height: usize,
982 bits_per_component: usize,
983 bits_per_pixel: usize,
984 bytes_per_row: usize,
985 space: Option<&CGColorSpace>,
986 bitmap_info: CGBitmapInfo,
987 provider: Option<&CGDataProvider>,
988 decode: *const CGFloat,
989 should_interpolate: bool,
990 intent: CGColorRenderingIntent,
991 ) -> Option<NonNull<CGImage>>;
992 }
993 let ret = unsafe {
994 CGImageCreateWithContentHeadroom(
995 headroom,
996 width,
997 height,
998 bits_per_component,
999 bits_per_pixel,
1000 bytes_per_row,
1001 space,
1002 bitmap_info,
1003 provider,
1004 decode,
1005 should_interpolate,
1006 intent,
1007 )
1008 };
1009 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1010}
1011
1012#[deprecated = "renamed to `CGImage::new_copy_with_content_headroom`"]
1013#[inline]
1014pub extern "C-unwind" fn CGImageCreateCopyWithContentHeadroom(
1015 headroom: c_float,
1016 image: Option<&CGImage>,
1017) -> Option<CFRetained<CGImage>> {
1018 extern "C-unwind" {
1019 fn CGImageCreateCopyWithContentHeadroom(
1020 headroom: c_float,
1021 image: Option<&CGImage>,
1022 ) -> Option<NonNull<CGImage>>;
1023 }
1024 let ret = unsafe { CGImageCreateCopyWithContentHeadroom(headroom, image) };
1025 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1026}
1027
1028#[deprecated = "renamed to `CGImage::content_headroom`"]
1029#[inline]
1030pub extern "C-unwind" fn CGImageGetContentHeadroom(image: Option<&CGImage>) -> c_float {
1031 extern "C-unwind" {
1032 fn CGImageGetContentHeadroom(image: Option<&CGImage>) -> c_float;
1033 }
1034 unsafe { CGImageGetContentHeadroom(image) }
1035}
1036
1037#[deprecated = "renamed to `CGImage::calculate_content_headroom`"]
1038#[inline]
1039pub extern "C-unwind" fn CGImageCalculateContentHeadroom(image: Option<&CGImage>) -> c_float {
1040 extern "C-unwind" {
1041 fn CGImageCalculateContentHeadroom(image: Option<&CGImage>) -> c_float;
1042 }
1043 unsafe { CGImageCalculateContentHeadroom(image) }
1044}
1045
1046#[deprecated = "renamed to `CGImage::content_average_light_level`"]
1047#[inline]
1048pub extern "C-unwind" fn CGImageGetContentAverageLightLevel(image: Option<&CGImage>) -> c_float {
1049 extern "C-unwind" {
1050 fn CGImageGetContentAverageLightLevel(image: Option<&CGImage>) -> c_float;
1051 }
1052 unsafe { CGImageGetContentAverageLightLevel(image) }
1053}
1054
1055#[deprecated = "renamed to `CGImage::calculate_content_average_light_level`"]
1056#[inline]
1057pub extern "C-unwind" fn CGImageCalculateContentAverageLightLevel(
1058 image: Option<&CGImage>,
1059) -> c_float {
1060 extern "C-unwind" {
1061 fn CGImageCalculateContentAverageLightLevel(image: Option<&CGImage>) -> c_float;
1062 }
1063 unsafe { CGImageCalculateContentAverageLightLevel(image) }
1064}
1065
1066#[deprecated = "renamed to `CGImage::new_copy_with_content_average_light_level`"]
1067#[inline]
1068pub extern "C-unwind" fn CGImageCreateCopyWithContentAverageLightLevel(
1069 image: Option<&CGImage>,
1070 avll: c_float,
1071) -> Option<CFRetained<CGImage>> {
1072 extern "C-unwind" {
1073 fn CGImageCreateCopyWithContentAverageLightLevel(
1074 image: Option<&CGImage>,
1075 avll: c_float,
1076 ) -> Option<NonNull<CGImage>>;
1077 }
1078 let ret = unsafe { CGImageCreateCopyWithContentAverageLightLevel(image, avll) };
1079 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1080}
1081
1082#[deprecated = "renamed to `CGImage::new_copy_with_calculated_hdr_stats`"]
1083#[inline]
1084pub extern "C-unwind" fn CGImageCreateCopyWithCalculatedHDRStats(
1085 image: Option<&CGImage>,
1086) -> Option<CFRetained<CGImage>> {
1087 extern "C-unwind" {
1088 fn CGImageCreateCopyWithCalculatedHDRStats(
1089 image: Option<&CGImage>,
1090 ) -> Option<NonNull<CGImage>>;
1091 }
1092 let ret = unsafe { CGImageCreateCopyWithCalculatedHDRStats(image) };
1093 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1094}
1095
1096#[deprecated = "renamed to `CGImage::is_mask`"]
1097#[inline]
1098pub extern "C-unwind" fn CGImageIsMask(image: Option<&CGImage>) -> bool {
1099 extern "C-unwind" {
1100 fn CGImageIsMask(image: Option<&CGImage>) -> bool;
1101 }
1102 unsafe { CGImageIsMask(image) }
1103}
1104
1105#[deprecated = "renamed to `CGImage::width`"]
1106#[inline]
1107pub extern "C-unwind" fn CGImageGetWidth(image: Option<&CGImage>) -> usize {
1108 extern "C-unwind" {
1109 fn CGImageGetWidth(image: Option<&CGImage>) -> usize;
1110 }
1111 unsafe { CGImageGetWidth(image) }
1112}
1113
1114#[deprecated = "renamed to `CGImage::height`"]
1115#[inline]
1116pub extern "C-unwind" fn CGImageGetHeight(image: Option<&CGImage>) -> usize {
1117 extern "C-unwind" {
1118 fn CGImageGetHeight(image: Option<&CGImage>) -> usize;
1119 }
1120 unsafe { CGImageGetHeight(image) }
1121}
1122
1123#[deprecated = "renamed to `CGImage::bits_per_component`"]
1124#[inline]
1125pub extern "C-unwind" fn CGImageGetBitsPerComponent(image: Option<&CGImage>) -> usize {
1126 extern "C-unwind" {
1127 fn CGImageGetBitsPerComponent(image: Option<&CGImage>) -> usize;
1128 }
1129 unsafe { CGImageGetBitsPerComponent(image) }
1130}
1131
1132#[deprecated = "renamed to `CGImage::bits_per_pixel`"]
1133#[inline]
1134pub extern "C-unwind" fn CGImageGetBitsPerPixel(image: Option<&CGImage>) -> usize {
1135 extern "C-unwind" {
1136 fn CGImageGetBitsPerPixel(image: Option<&CGImage>) -> usize;
1137 }
1138 unsafe { CGImageGetBitsPerPixel(image) }
1139}
1140
1141#[deprecated = "renamed to `CGImage::bytes_per_row`"]
1142#[inline]
1143pub extern "C-unwind" fn CGImageGetBytesPerRow(image: Option<&CGImage>) -> usize {
1144 extern "C-unwind" {
1145 fn CGImageGetBytesPerRow(image: Option<&CGImage>) -> usize;
1146 }
1147 unsafe { CGImageGetBytesPerRow(image) }
1148}
1149
1150#[cfg(feature = "CGColorSpace")]
1151#[deprecated = "renamed to `CGImage::color_space`"]
1152#[inline]
1153pub extern "C-unwind" fn CGImageGetColorSpace(
1154 image: Option<&CGImage>,
1155) -> Option<CFRetained<CGColorSpace>> {
1156 extern "C-unwind" {
1157 fn CGImageGetColorSpace(image: Option<&CGImage>) -> Option<NonNull<CGColorSpace>>;
1158 }
1159 let ret = unsafe { CGImageGetColorSpace(image) };
1160 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1161}
1162
1163#[deprecated = "renamed to `CGImage::alpha_info`"]
1164#[inline]
1165pub extern "C-unwind" fn CGImageGetAlphaInfo(image: Option<&CGImage>) -> CGImageAlphaInfo {
1166 extern "C-unwind" {
1167 fn CGImageGetAlphaInfo(image: Option<&CGImage>) -> CGImageAlphaInfo;
1168 }
1169 unsafe { CGImageGetAlphaInfo(image) }
1170}
1171
1172#[cfg(feature = "CGDataProvider")]
1173#[deprecated = "renamed to `CGImage::data_provider`"]
1174#[inline]
1175pub extern "C-unwind" fn CGImageGetDataProvider(
1176 image: Option<&CGImage>,
1177) -> Option<CFRetained<CGDataProvider>> {
1178 extern "C-unwind" {
1179 fn CGImageGetDataProvider(image: Option<&CGImage>) -> Option<NonNull<CGDataProvider>>;
1180 }
1181 let ret = unsafe { CGImageGetDataProvider(image) };
1182 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1183}
1184
1185#[deprecated = "renamed to `CGImage::decode`"]
1186#[inline]
1187pub extern "C-unwind" fn CGImageGetDecode(image: Option<&CGImage>) -> *const CGFloat {
1188 extern "C-unwind" {
1189 fn CGImageGetDecode(image: Option<&CGImage>) -> *const CGFloat;
1190 }
1191 unsafe { CGImageGetDecode(image) }
1192}
1193
1194#[deprecated = "renamed to `CGImage::should_interpolate`"]
1195#[inline]
1196pub extern "C-unwind" fn CGImageGetShouldInterpolate(image: Option<&CGImage>) -> bool {
1197 extern "C-unwind" {
1198 fn CGImageGetShouldInterpolate(image: Option<&CGImage>) -> bool;
1199 }
1200 unsafe { CGImageGetShouldInterpolate(image) }
1201}
1202
1203#[cfg(feature = "CGColorSpace")]
1204#[deprecated = "renamed to `CGImage::rendering_intent`"]
1205#[inline]
1206pub extern "C-unwind" fn CGImageGetRenderingIntent(
1207 image: Option<&CGImage>,
1208) -> CGColorRenderingIntent {
1209 extern "C-unwind" {
1210 fn CGImageGetRenderingIntent(image: Option<&CGImage>) -> CGColorRenderingIntent;
1211 }
1212 unsafe { CGImageGetRenderingIntent(image) }
1213}
1214
1215#[deprecated = "renamed to `CGImage::bitmap_info`"]
1216#[inline]
1217pub extern "C-unwind" fn CGImageGetBitmapInfo(image: Option<&CGImage>) -> CGBitmapInfo {
1218 extern "C-unwind" {
1219 fn CGImageGetBitmapInfo(image: Option<&CGImage>) -> CGBitmapInfo;
1220 }
1221 unsafe { CGImageGetBitmapInfo(image) }
1222}
1223
1224#[deprecated = "renamed to `CGImage::byte_order_info`"]
1225#[inline]
1226pub extern "C-unwind" fn CGImageGetByteOrderInfo(image: Option<&CGImage>) -> CGImageByteOrderInfo {
1227 extern "C-unwind" {
1228 fn CGImageGetByteOrderInfo(image: Option<&CGImage>) -> CGImageByteOrderInfo;
1229 }
1230 unsafe { CGImageGetByteOrderInfo(image) }
1231}
1232
1233#[deprecated = "renamed to `CGImage::pixel_format_info`"]
1234#[inline]
1235pub extern "C-unwind" fn CGImageGetPixelFormatInfo(
1236 image: Option<&CGImage>,
1237) -> CGImagePixelFormatInfo {
1238 extern "C-unwind" {
1239 fn CGImageGetPixelFormatInfo(image: Option<&CGImage>) -> CGImagePixelFormatInfo;
1240 }
1241 unsafe { CGImageGetPixelFormatInfo(image) }
1242}
1243
1244#[deprecated = "renamed to `CGImage::should_tone_map`"]
1245#[inline]
1246pub extern "C-unwind" fn CGImageShouldToneMap(image: Option<&CGImage>) -> bool {
1247 extern "C-unwind" {
1248 fn CGImageShouldToneMap(image: Option<&CGImage>) -> bool;
1249 }
1250 unsafe { CGImageShouldToneMap(image) }
1251}
1252
1253#[deprecated = "renamed to `CGImage::contains_image_specific_tone_mapping_metadata`"]
1254#[inline]
1255pub extern "C-unwind" fn CGImageContainsImageSpecificToneMappingMetadata(
1256 image: Option<&CGImage>,
1257) -> bool {
1258 extern "C-unwind" {
1259 fn CGImageContainsImageSpecificToneMappingMetadata(image: Option<&CGImage>) -> bool;
1260 }
1261 unsafe { CGImageContainsImageSpecificToneMappingMetadata(image) }
1262}
1263
1264#[deprecated = "renamed to `CGImage::ut_type`"]
1265#[inline]
1266pub extern "C-unwind" fn CGImageGetUTType(image: Option<&CGImage>) -> Option<CFRetained<CFString>> {
1267 extern "C-unwind" {
1268 fn CGImageGetUTType(image: Option<&CGImage>) -> Option<NonNull<CFString>>;
1269 }
1270 let ret = unsafe { CGImageGetUTType(image) };
1271 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1272}