use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use crate::*;
#[doc(alias = "CGImageDestinationRef")]
#[repr(C)]
pub struct CGImageDestination {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CGImageDestination {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"CGImageDestination"> for CGImageDestination {}
);
extern "C" {
pub static kCGImageDestinationLossyCompressionQuality: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationBackgroundColor: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationImageMaxPixelSize: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEmbedThumbnail: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationOptimizeColorForSharing: &'static CFString;
}
unsafe impl ConcreteType for CGImageDestination {
#[doc(alias = "CGImageDestinationGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CGImageDestinationGetTypeID() -> CFTypeID;
}
unsafe { CGImageDestinationGetTypeID() }
}
}
impl CGImageDestination {
#[doc(alias = "CGImageDestinationCopyTypeIdentifiers")]
#[inline]
pub unsafe fn type_identifiers() -> CFRetained<CFArray> {
extern "C-unwind" {
fn CGImageDestinationCopyTypeIdentifiers() -> Option<NonNull<CFArray>>;
}
let ret = unsafe { CGImageDestinationCopyTypeIdentifiers() };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "CGImageDestinationCreateWithDataConsumer")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn with_data_consumer(
consumer: &CGDataConsumer,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CGImageDestination>> {
extern "C-unwind" {
fn CGImageDestinationCreateWithDataConsumer(
consumer: &CGDataConsumer,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<NonNull<CGImageDestination>>;
}
let ret =
unsafe { CGImageDestinationCreateWithDataConsumer(consumer, r#type, count, options) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CGImageDestinationCreateWithData")]
#[inline]
pub unsafe fn with_data(
data: &CFMutableData,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CGImageDestination>> {
extern "C-unwind" {
fn CGImageDestinationCreateWithData(
data: &CFMutableData,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<NonNull<CGImageDestination>>;
}
let ret = unsafe { CGImageDestinationCreateWithData(data, r#type, count, options) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CGImageDestinationCreateWithURL")]
#[inline]
pub unsafe fn with_url(
url: &CFURL,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CGImageDestination>> {
extern "C-unwind" {
fn CGImageDestinationCreateWithURL(
url: &CFURL,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<NonNull<CGImageDestination>>;
}
let ret = unsafe { CGImageDestinationCreateWithURL(url, r#type, count, options) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CGImageDestinationSetProperties")]
#[inline]
pub unsafe fn set_properties(&self, properties: Option<&CFDictionary>) {
extern "C-unwind" {
fn CGImageDestinationSetProperties(
idst: &CGImageDestination,
properties: Option<&CFDictionary>,
);
}
unsafe { CGImageDestinationSetProperties(self, properties) }
}
#[doc(alias = "CGImageDestinationAddImage")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn add_image(&self, image: &CGImage, properties: Option<&CFDictionary>) {
extern "C-unwind" {
fn CGImageDestinationAddImage(
idst: &CGImageDestination,
image: &CGImage,
properties: Option<&CFDictionary>,
);
}
unsafe { CGImageDestinationAddImage(self, image, properties) }
}
#[doc(alias = "CGImageDestinationAddImageFromSource")]
#[cfg(feature = "CGImageSource")]
#[inline]
pub unsafe fn add_image_from_source(
&self,
isrc: &CGImageSource,
index: usize,
properties: Option<&CFDictionary>,
) {
extern "C-unwind" {
fn CGImageDestinationAddImageFromSource(
idst: &CGImageDestination,
isrc: &CGImageSource,
index: usize,
properties: Option<&CFDictionary>,
);
}
unsafe { CGImageDestinationAddImageFromSource(self, isrc, index, properties) }
}
#[doc(alias = "CGImageDestinationFinalize")]
#[inline]
pub unsafe fn finalize(&self) -> bool {
extern "C-unwind" {
fn CGImageDestinationFinalize(idst: &CGImageDestination) -> bool;
}
unsafe { CGImageDestinationFinalize(self) }
}
#[doc(alias = "CGImageDestinationAddImageAndMetadata")]
#[cfg(all(feature = "CGImageMetadata", feature = "objc2-core-graphics"))]
#[inline]
pub unsafe fn add_image_and_metadata(
&self,
image: &CGImage,
metadata: Option<&CGImageMetadata>,
options: Option<&CFDictionary>,
) {
extern "C-unwind" {
fn CGImageDestinationAddImageAndMetadata(
idst: &CGImageDestination,
image: &CGImage,
metadata: Option<&CGImageMetadata>,
options: Option<&CFDictionary>,
);
}
unsafe { CGImageDestinationAddImageAndMetadata(self, image, metadata, options) }
}
}
extern "C" {
pub static kCGImageDestinationPreserveGainMap: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationMetadata: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationMergeMetadata: &'static CFString;
}
extern "C" {
pub static kCGImageMetadataShouldExcludeXMP: &'static CFString;
}
extern "C" {
pub static kCGImageMetadataShouldExcludeGPS: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationDateTime: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationOrientation: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyEncoder: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyASTCEncoder: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyPVREncoder: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyBCEncoder: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyBCFormat: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyASTCBlockSize: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyASTCBlockSize4x4: &'static CFString;
}
extern "C" {
pub static kCGImagePropertyASTCBlockSize8x8: &'static CFString;
}
impl CGImageDestination {
#[doc(alias = "CGImageDestinationCopyImageSource")]
#[cfg(feature = "CGImageSource")]
#[inline]
pub unsafe fn copy_image_source(
&self,
isrc: &CGImageSource,
options: Option<&CFDictionary>,
err: *mut *mut CFError,
) -> bool {
extern "C-unwind" {
fn CGImageDestinationCopyImageSource(
idst: &CGImageDestination,
isrc: &CGImageSource,
options: Option<&CFDictionary>,
err: *mut *mut CFError,
) -> bool;
}
unsafe { CGImageDestinationCopyImageSource(self, isrc, options, err) }
}
#[doc(alias = "CGImageDestinationAddAuxiliaryDataInfo")]
#[inline]
pub unsafe fn add_auxiliary_data_info(
&self,
auxiliary_image_data_type: &CFString,
auxiliary_data_info_dictionary: &CFDictionary,
) {
extern "C-unwind" {
fn CGImageDestinationAddAuxiliaryDataInfo(
idst: &CGImageDestination,
auxiliary_image_data_type: &CFString,
auxiliary_data_info_dictionary: &CFDictionary,
);
}
unsafe {
CGImageDestinationAddAuxiliaryDataInfo(
self,
auxiliary_image_data_type,
auxiliary_data_info_dictionary,
)
}
}
}
extern "C" {
pub static kCGImageDestinationEncodeRequest: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeToSDR: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeToISOHDR: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeToISOGainmap: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeRequestOptions: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeBaseIsSDR: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeTonemapMode: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeIsBaseImage: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeBaseColorSpace: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeBasePixelFormatRequest: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeGenerateGainMapWithBaseImage: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeGainMapPixelFormatRequest: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeGainMapSubsampleFactor: &'static CFString;
}
extern "C" {
pub static kCGImageDestinationEncodeAlternateColorSpace: &'static CFString;
}
#[deprecated = "renamed to `CGImageDestination::type_identifiers`"]
#[inline]
pub unsafe extern "C-unwind" fn CGImageDestinationCopyTypeIdentifiers() -> CFRetained<CFArray> {
extern "C-unwind" {
fn CGImageDestinationCopyTypeIdentifiers() -> Option<NonNull<CFArray>>;
}
let ret = unsafe { CGImageDestinationCopyTypeIdentifiers() };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CGImageDestination::with_data_consumer`"]
#[inline]
pub unsafe extern "C-unwind" fn CGImageDestinationCreateWithDataConsumer(
consumer: &CGDataConsumer,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CGImageDestination>> {
extern "C-unwind" {
fn CGImageDestinationCreateWithDataConsumer(
consumer: &CGDataConsumer,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<NonNull<CGImageDestination>>;
}
let ret = unsafe { CGImageDestinationCreateWithDataConsumer(consumer, r#type, count, options) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `CGImageDestination::with_data`"]
#[inline]
pub unsafe extern "C-unwind" fn CGImageDestinationCreateWithData(
data: &CFMutableData,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CGImageDestination>> {
extern "C-unwind" {
fn CGImageDestinationCreateWithData(
data: &CFMutableData,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<NonNull<CGImageDestination>>;
}
let ret = unsafe { CGImageDestinationCreateWithData(data, r#type, count, options) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `CGImageDestination::with_url`"]
#[inline]
pub unsafe extern "C-unwind" fn CGImageDestinationCreateWithURL(
url: &CFURL,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CGImageDestination>> {
extern "C-unwind" {
fn CGImageDestinationCreateWithURL(
url: &CFURL,
r#type: &CFString,
count: usize,
options: Option<&CFDictionary>,
) -> Option<NonNull<CGImageDestination>>;
}
let ret = unsafe { CGImageDestinationCreateWithURL(url, r#type, count, options) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `CGImageDestination::set_properties`"]
pub fn CGImageDestinationSetProperties(
idst: &CGImageDestination,
properties: Option<&CFDictionary>,
);
}
extern "C-unwind" {
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CGImageDestination::add_image`"]
pub fn CGImageDestinationAddImage(
idst: &CGImageDestination,
image: &CGImage,
properties: Option<&CFDictionary>,
);
}
extern "C-unwind" {
#[cfg(feature = "CGImageSource")]
#[deprecated = "renamed to `CGImageDestination::add_image_from_source`"]
pub fn CGImageDestinationAddImageFromSource(
idst: &CGImageDestination,
isrc: &CGImageSource,
index: usize,
properties: Option<&CFDictionary>,
);
}
extern "C-unwind" {
#[deprecated = "renamed to `CGImageDestination::finalize`"]
pub fn CGImageDestinationFinalize(idst: &CGImageDestination) -> bool;
}
extern "C-unwind" {
#[cfg(all(feature = "CGImageMetadata", feature = "objc2-core-graphics"))]
#[deprecated = "renamed to `CGImageDestination::add_image_and_metadata`"]
pub fn CGImageDestinationAddImageAndMetadata(
idst: &CGImageDestination,
image: &CGImage,
metadata: Option<&CGImageMetadata>,
options: Option<&CFDictionary>,
);
}
extern "C-unwind" {
#[cfg(feature = "CGImageSource")]
#[deprecated = "renamed to `CGImageDestination::copy_image_source`"]
pub fn CGImageDestinationCopyImageSource(
idst: &CGImageDestination,
isrc: &CGImageSource,
options: Option<&CFDictionary>,
err: *mut *mut CFError,
) -> bool;
}
extern "C-unwind" {
#[deprecated = "renamed to `CGImageDestination::add_auxiliary_data_info`"]
pub fn CGImageDestinationAddAuxiliaryDataInfo(
idst: &CGImageDestination,
auxiliary_image_data_type: &CFString,
auxiliary_data_info_dictionary: &CFDictionary,
);
}