objc2_image_io/generated/
CGImageDestination.rs1use 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#[repr(C)]
17pub struct CGImageDestination {
18 inner: [u8; 0],
19 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22cf_type!(
23 unsafe impl CGImageDestination {}
24);
25#[cfg(feature = "objc2")]
26cf_objc2_type!(
27 unsafe impl RefEncode<"CGImageDestination"> for CGImageDestination {}
28);
29
30extern "C" {
31 pub static kCGImageDestinationLossyCompressionQuality: &'static CFString;
37}
38
39extern "C" {
40 pub static kCGImageDestinationBackgroundColor: &'static CFString;
42}
43
44extern "C" {
45 pub static kCGImageDestinationImageMaxPixelSize: &'static CFString;
47}
48
49extern "C" {
50 pub static kCGImageDestinationEmbedThumbnail: &'static CFString;
52}
53
54extern "C" {
55 pub static kCGImageDestinationOptimizeColorForSharing: &'static CFString;
57}
58
59unsafe impl ConcreteType for CGImageDestination {
60 #[doc(alias = "CGImageDestinationGetTypeID")]
61 #[inline]
62 fn type_id() -> CFTypeID {
63 extern "C-unwind" {
64 fn CGImageDestinationGetTypeID() -> CFTypeID;
65 }
66 unsafe { CGImageDestinationGetTypeID() }
67 }
68}
69
70impl CGImageDestination {
71 #[doc(alias = "CGImageDestinationCopyTypeIdentifiers")]
72 #[inline]
73 pub unsafe fn type_identifiers() -> CFRetained<CFArray> {
74 extern "C-unwind" {
75 fn CGImageDestinationCopyTypeIdentifiers() -> Option<NonNull<CFArray>>;
76 }
77 let ret = unsafe { CGImageDestinationCopyTypeIdentifiers() };
78 let ret =
79 ret.expect("function was marked as returning non-null, but actually returned NULL");
80 unsafe { CFRetained::from_raw(ret) }
81 }
82
83 #[doc(alias = "CGImageDestinationCreateWithDataConsumer")]
84 #[cfg(feature = "objc2-core-graphics")]
85 #[inline]
86 pub unsafe fn with_data_consumer(
87 consumer: &CGDataConsumer,
88 r#type: &CFString,
89 count: usize,
90 options: Option<&CFDictionary>,
91 ) -> Option<CFRetained<CGImageDestination>> {
92 extern "C-unwind" {
93 fn CGImageDestinationCreateWithDataConsumer(
94 consumer: &CGDataConsumer,
95 r#type: &CFString,
96 count: usize,
97 options: Option<&CFDictionary>,
98 ) -> Option<NonNull<CGImageDestination>>;
99 }
100 let ret =
101 unsafe { CGImageDestinationCreateWithDataConsumer(consumer, r#type, count, options) };
102 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
103 }
104
105 #[doc(alias = "CGImageDestinationCreateWithData")]
106 #[inline]
107 pub unsafe fn with_data(
108 data: &CFMutableData,
109 r#type: &CFString,
110 count: usize,
111 options: Option<&CFDictionary>,
112 ) -> Option<CFRetained<CGImageDestination>> {
113 extern "C-unwind" {
114 fn CGImageDestinationCreateWithData(
115 data: &CFMutableData,
116 r#type: &CFString,
117 count: usize,
118 options: Option<&CFDictionary>,
119 ) -> Option<NonNull<CGImageDestination>>;
120 }
121 let ret = unsafe { CGImageDestinationCreateWithData(data, r#type, count, options) };
122 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
123 }
124
125 #[doc(alias = "CGImageDestinationCreateWithURL")]
126 #[inline]
127 pub unsafe fn with_url(
128 url: &CFURL,
129 r#type: &CFString,
130 count: usize,
131 options: Option<&CFDictionary>,
132 ) -> Option<CFRetained<CGImageDestination>> {
133 extern "C-unwind" {
134 fn CGImageDestinationCreateWithURL(
135 url: &CFURL,
136 r#type: &CFString,
137 count: usize,
138 options: Option<&CFDictionary>,
139 ) -> Option<NonNull<CGImageDestination>>;
140 }
141 let ret = unsafe { CGImageDestinationCreateWithURL(url, r#type, count, options) };
142 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
143 }
144
145 #[doc(alias = "CGImageDestinationSetProperties")]
146 #[inline]
147 pub unsafe fn set_properties(self: &CGImageDestination, properties: Option<&CFDictionary>) {
148 extern "C-unwind" {
149 fn CGImageDestinationSetProperties(
150 idst: &CGImageDestination,
151 properties: Option<&CFDictionary>,
152 );
153 }
154 unsafe { CGImageDestinationSetProperties(self, properties) }
155 }
156
157 #[doc(alias = "CGImageDestinationAddImage")]
158 #[cfg(feature = "objc2-core-graphics")]
159 #[inline]
160 pub unsafe fn add_image(
161 self: &CGImageDestination,
162 image: &CGImage,
163 properties: Option<&CFDictionary>,
164 ) {
165 extern "C-unwind" {
166 fn CGImageDestinationAddImage(
167 idst: &CGImageDestination,
168 image: &CGImage,
169 properties: Option<&CFDictionary>,
170 );
171 }
172 unsafe { CGImageDestinationAddImage(self, image, properties) }
173 }
174
175 #[doc(alias = "CGImageDestinationAddImageFromSource")]
176 #[cfg(feature = "CGImageSource")]
177 #[inline]
178 pub unsafe fn add_image_from_source(
179 self: &CGImageDestination,
180 isrc: &CGImageSource,
181 index: usize,
182 properties: Option<&CFDictionary>,
183 ) {
184 extern "C-unwind" {
185 fn CGImageDestinationAddImageFromSource(
186 idst: &CGImageDestination,
187 isrc: &CGImageSource,
188 index: usize,
189 properties: Option<&CFDictionary>,
190 );
191 }
192 unsafe { CGImageDestinationAddImageFromSource(self, isrc, index, properties) }
193 }
194
195 #[doc(alias = "CGImageDestinationFinalize")]
196 #[inline]
197 pub unsafe fn finalize(self: &CGImageDestination) -> bool {
198 extern "C-unwind" {
199 fn CGImageDestinationFinalize(idst: &CGImageDestination) -> bool;
200 }
201 unsafe { CGImageDestinationFinalize(self) }
202 }
203
204 #[doc(alias = "CGImageDestinationAddImageAndMetadata")]
205 #[cfg(all(feature = "CGImageMetadata", feature = "objc2-core-graphics"))]
206 #[inline]
207 pub unsafe fn add_image_and_metadata(
208 self: &CGImageDestination,
209 image: &CGImage,
210 metadata: Option<&CGImageMetadata>,
211 options: Option<&CFDictionary>,
212 ) {
213 extern "C-unwind" {
214 fn CGImageDestinationAddImageAndMetadata(
215 idst: &CGImageDestination,
216 image: &CGImage,
217 metadata: Option<&CGImageMetadata>,
218 options: Option<&CFDictionary>,
219 );
220 }
221 unsafe { CGImageDestinationAddImageAndMetadata(self, image, metadata, options) }
222 }
223}
224
225extern "C" {
226 pub static kCGImageDestinationPreserveGainMap: &'static CFString;
228}
229
230extern "C" {
231 pub static kCGImageDestinationMetadata: &'static CFString;
236}
237
238extern "C" {
239 pub static kCGImageDestinationMergeMetadata: &'static CFString;
241}
242
243extern "C" {
244 pub static kCGImageMetadataShouldExcludeXMP: &'static CFString;
246}
247
248extern "C" {
249 pub static kCGImageMetadataShouldExcludeGPS: &'static CFString;
251}
252
253extern "C" {
254 pub static kCGImageDestinationDateTime: &'static CFString;
256}
257
258extern "C" {
259 pub static kCGImageDestinationOrientation: &'static CFString;
261}
262
263impl CGImageDestination {
264 #[doc(alias = "CGImageDestinationCopyImageSource")]
265 #[cfg(feature = "CGImageSource")]
266 #[inline]
267 pub unsafe fn copy_image_source(
268 self: &CGImageDestination,
269 isrc: &CGImageSource,
270 options: Option<&CFDictionary>,
271 err: *mut *mut CFError,
272 ) -> bool {
273 extern "C-unwind" {
274 fn CGImageDestinationCopyImageSource(
275 idst: &CGImageDestination,
276 isrc: &CGImageSource,
277 options: Option<&CFDictionary>,
278 err: *mut *mut CFError,
279 ) -> bool;
280 }
281 unsafe { CGImageDestinationCopyImageSource(self, isrc, options, err) }
282 }
283
284 #[doc(alias = "CGImageDestinationAddAuxiliaryDataInfo")]
285 #[inline]
286 pub unsafe fn add_auxiliary_data_info(
287 self: &CGImageDestination,
288 auxiliary_image_data_type: &CFString,
289 auxiliary_data_info_dictionary: &CFDictionary,
290 ) {
291 extern "C-unwind" {
292 fn CGImageDestinationAddAuxiliaryDataInfo(
293 idst: &CGImageDestination,
294 auxiliary_image_data_type: &CFString,
295 auxiliary_data_info_dictionary: &CFDictionary,
296 );
297 }
298 unsafe {
299 CGImageDestinationAddAuxiliaryDataInfo(
300 self,
301 auxiliary_image_data_type,
302 auxiliary_data_info_dictionary,
303 )
304 }
305 }
306}
307
308extern "C" {
309 pub static kCGImageDestinationEncodeRequest: &'static CFString;
311}
312
313extern "C" {
314 pub static kCGImageDestinationEncodeToSDR: &'static CFString;
316}
317
318extern "C" {
319 pub static kCGImageDestinationEncodeToISOHDR: &'static CFString;
321}
322
323extern "C" {
324 pub static kCGImageDestinationEncodeToISOGainmap: &'static CFString;
326}
327
328extern "C" {
329 pub static kCGImageDestinationEncodeRequestOptions: &'static CFString;
331}
332
333extern "C" {
334 pub static kCGImageDestinationEncodeBaseIsSDR: &'static CFString;
336}
337
338extern "C" {
339 pub static kCGImageDestinationEncodeTonemapMode: &'static CFString;
341}
342
343#[deprecated = "renamed to `CGImageDestination::type_identifiers`"]
344#[inline]
345pub unsafe extern "C-unwind" fn CGImageDestinationCopyTypeIdentifiers() -> CFRetained<CFArray> {
346 extern "C-unwind" {
347 fn CGImageDestinationCopyTypeIdentifiers() -> Option<NonNull<CFArray>>;
348 }
349 let ret = unsafe { CGImageDestinationCopyTypeIdentifiers() };
350 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
351 unsafe { CFRetained::from_raw(ret) }
352}
353
354#[cfg(feature = "objc2-core-graphics")]
355#[deprecated = "renamed to `CGImageDestination::with_data_consumer`"]
356#[inline]
357pub unsafe extern "C-unwind" fn CGImageDestinationCreateWithDataConsumer(
358 consumer: &CGDataConsumer,
359 r#type: &CFString,
360 count: usize,
361 options: Option<&CFDictionary>,
362) -> Option<CFRetained<CGImageDestination>> {
363 extern "C-unwind" {
364 fn CGImageDestinationCreateWithDataConsumer(
365 consumer: &CGDataConsumer,
366 r#type: &CFString,
367 count: usize,
368 options: Option<&CFDictionary>,
369 ) -> Option<NonNull<CGImageDestination>>;
370 }
371 let ret = unsafe { CGImageDestinationCreateWithDataConsumer(consumer, r#type, count, options) };
372 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
373}
374
375#[deprecated = "renamed to `CGImageDestination::with_data`"]
376#[inline]
377pub unsafe extern "C-unwind" fn CGImageDestinationCreateWithData(
378 data: &CFMutableData,
379 r#type: &CFString,
380 count: usize,
381 options: Option<&CFDictionary>,
382) -> Option<CFRetained<CGImageDestination>> {
383 extern "C-unwind" {
384 fn CGImageDestinationCreateWithData(
385 data: &CFMutableData,
386 r#type: &CFString,
387 count: usize,
388 options: Option<&CFDictionary>,
389 ) -> Option<NonNull<CGImageDestination>>;
390 }
391 let ret = unsafe { CGImageDestinationCreateWithData(data, r#type, count, options) };
392 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
393}
394
395#[deprecated = "renamed to `CGImageDestination::with_url`"]
396#[inline]
397pub unsafe extern "C-unwind" fn CGImageDestinationCreateWithURL(
398 url: &CFURL,
399 r#type: &CFString,
400 count: usize,
401 options: Option<&CFDictionary>,
402) -> Option<CFRetained<CGImageDestination>> {
403 extern "C-unwind" {
404 fn CGImageDestinationCreateWithURL(
405 url: &CFURL,
406 r#type: &CFString,
407 count: usize,
408 options: Option<&CFDictionary>,
409 ) -> Option<NonNull<CGImageDestination>>;
410 }
411 let ret = unsafe { CGImageDestinationCreateWithURL(url, r#type, count, options) };
412 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
413}
414
415extern "C-unwind" {
416 #[deprecated = "renamed to `CGImageDestination::set_properties`"]
417 pub fn CGImageDestinationSetProperties(
418 idst: &CGImageDestination,
419 properties: Option<&CFDictionary>,
420 );
421}
422
423extern "C-unwind" {
424 #[cfg(feature = "objc2-core-graphics")]
425 #[deprecated = "renamed to `CGImageDestination::add_image`"]
426 pub fn CGImageDestinationAddImage(
427 idst: &CGImageDestination,
428 image: &CGImage,
429 properties: Option<&CFDictionary>,
430 );
431}
432
433extern "C-unwind" {
434 #[cfg(feature = "CGImageSource")]
435 #[deprecated = "renamed to `CGImageDestination::add_image_from_source`"]
436 pub fn CGImageDestinationAddImageFromSource(
437 idst: &CGImageDestination,
438 isrc: &CGImageSource,
439 index: usize,
440 properties: Option<&CFDictionary>,
441 );
442}
443
444extern "C-unwind" {
445 #[deprecated = "renamed to `CGImageDestination::finalize`"]
446 pub fn CGImageDestinationFinalize(idst: &CGImageDestination) -> bool;
447}
448
449extern "C-unwind" {
450 #[cfg(all(feature = "CGImageMetadata", feature = "objc2-core-graphics"))]
451 #[deprecated = "renamed to `CGImageDestination::add_image_and_metadata`"]
452 pub fn CGImageDestinationAddImageAndMetadata(
453 idst: &CGImageDestination,
454 image: &CGImage,
455 metadata: Option<&CGImageMetadata>,
456 options: Option<&CFDictionary>,
457 );
458}
459
460extern "C-unwind" {
461 #[cfg(feature = "CGImageSource")]
462 #[deprecated = "renamed to `CGImageDestination::copy_image_source`"]
463 pub fn CGImageDestinationCopyImageSource(
464 idst: &CGImageDestination,
465 isrc: &CGImageSource,
466 options: Option<&CFDictionary>,
467 err: *mut *mut CFError,
468 ) -> bool;
469}
470
471extern "C-unwind" {
472 #[deprecated = "renamed to `CGImageDestination::add_auxiliary_data_info`"]
473 pub fn CGImageDestinationAddAuxiliaryDataInfo(
474 idst: &CGImageDestination,
475 auxiliary_image_data_type: &CFString,
476 auxiliary_data_info_dictionary: &CFDictionary,
477 );
478}