//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
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::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/colorsynctransform?language=objc)
#[doc(alias = "ColorSyncTransformRef")]
#[repr(C)]
pub struct ColorSyncTransform {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl ColorSyncTransform {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"ColorSyncTransform"> for ColorSyncTransform {}
);

unsafe impl ConcreteType for ColorSyncTransform {
    #[doc(alias = "ColorSyncTransformGetTypeID")]
    #[inline]
    fn type_id() -> CFTypeID {
        extern "C-unwind" {
            fn ColorSyncTransformGetTypeID() -> CFTypeID;
        }
        unsafe { ColorSyncTransformGetTypeID() }
    }
}

impl ColorSyncTransform {
    /// # Safety
    ///
    /// - `profile_sequence` generic must be of the correct type.
    /// - `options` generics must be of the correct type.
    #[doc(alias = "ColorSyncTransformCreate")]
    #[inline]
    pub unsafe fn new(
        profile_sequence: Option<&CFArray>,
        options: Option<&CFDictionary>,
    ) -> Option<CFRetained<ColorSyncTransform>> {
        extern "C-unwind" {
            fn ColorSyncTransformCreate(
                profile_sequence: Option<&CFArray>,
                options: Option<&CFDictionary>,
            ) -> Option<NonNull<ColorSyncTransform>>;
        }
        let ret = unsafe { ColorSyncTransformCreate(profile_sequence, options) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// # Safety
    ///
    /// - `key` should be of the correct type.
    /// - `options` generics must be of the correct type.
    #[doc(alias = "ColorSyncTransformCopyProperty")]
    #[inline]
    pub unsafe fn property(
        &self,
        key: &CFType,
        options: Option<&CFDictionary>,
    ) -> Option<CFRetained<CFType>> {
        extern "C-unwind" {
            fn ColorSyncTransformCopyProperty(
                transform: &ColorSyncTransform,
                key: &CFType,
                options: Option<&CFDictionary>,
            ) -> Option<NonNull<CFType>>;
        }
        let ret = unsafe { ColorSyncTransformCopyProperty(self, key, options) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// # Safety
    ///
    /// - `key` should be of the correct type.
    /// - `property` should be of the correct type.
    #[doc(alias = "ColorSyncTransformSetProperty")]
    #[inline]
    pub unsafe fn set_property(&self, key: &CFType, property: Option<&CFType>) {
        extern "C-unwind" {
            fn ColorSyncTransformSetProperty(
                transform: &ColorSyncTransform,
                key: &CFType,
                property: Option<&CFType>,
            );
        }
        unsafe { ColorSyncTransformSetProperty(self, key, property) }
    }

    #[doc(alias = "ColorSyncTransformGetProfileSequence")]
    #[inline]
    pub unsafe fn profile_sequence(&self) -> Option<CFRetained<CFArray>> {
        extern "C-unwind" {
            fn ColorSyncTransformGetProfileSequence(
                transform: &ColorSyncTransform,
            ) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { ColorSyncTransformGetProfileSequence(self) };
        ret.map(|ret| unsafe { CFRetained::retain(ret) })
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/colorsyncdatadepth?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ColorSyncDataDepth(pub c_uint);
impl ColorSyncDataDepth {
    #[doc(alias = "kColorSync1BitGamut")]
    pub const Sync1BitGamut: Self = Self(1);
    #[doc(alias = "kColorSync8BitInteger")]
    pub const Sync8BitInteger: Self = Self(2);
    #[doc(alias = "kColorSync16BitInteger")]
    pub const Sync16BitInteger: Self = Self(3);
    #[doc(alias = "kColorSync16BitFloat")]
    pub const Sync16BitFloat: Self = Self(4);
    #[doc(alias = "kColorSync32BitInteger")]
    pub const Sync32BitInteger: Self = Self(5);
    #[doc(alias = "kColorSync32BitNamedColorIndex")]
    pub const Sync32BitNamedColorIndex: Self = Self(6);
    #[doc(alias = "kColorSync32BitFloat")]
    pub const Sync32BitFloat: Self = Self(7);
    #[doc(alias = "kColorSync10BitInteger")]
    pub const Sync10BitInteger: Self = Self(8);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for ColorSyncDataDepth {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for ColorSyncDataDepth {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/colorsyncalphainfo?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ColorSyncAlphaInfo(pub c_uint);
impl ColorSyncAlphaInfo {
    #[doc(alias = "kColorSyncAlphaNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "kColorSyncAlphaPremultipliedLast")]
    pub const PremultipliedLast: Self = Self(1);
    #[doc(alias = "kColorSyncAlphaPremultipliedFirst")]
    pub const PremultipliedFirst: Self = Self(2);
    #[doc(alias = "kColorSyncAlphaLast")]
    pub const Last: Self = Self(3);
    #[doc(alias = "kColorSyncAlphaFirst")]
    pub const First: Self = Self(4);
    #[doc(alias = "kColorSyncAlphaNoneSkipLast")]
    pub const NoneSkipLast: Self = Self(5);
    #[doc(alias = "kColorSyncAlphaNoneSkipFirst")]
    pub const NoneSkipFirst: Self = Self(6);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for ColorSyncAlphaInfo {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for ColorSyncAlphaInfo {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncalphainfomask?language=objc)
pub const kColorSyncAlphaInfoMask: c_uint = 0x1F;
/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbyteordermask?language=objc)
pub const kColorSyncByteOrderMask: c_uint = 0x7000;
/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbyteorderdefault?language=objc)
pub const kColorSyncByteOrderDefault: c_uint = 0 << 12;
/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbyteorder16little?language=objc)
pub const kColorSyncByteOrder16Little: c_uint = 1 << 12;
/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbyteorder32little?language=objc)
pub const kColorSyncByteOrder32Little: c_uint = 2 << 12;
/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbyteorder16big?language=objc)
pub const kColorSyncByteOrder16Big: c_uint = 3 << 12;
/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbyteorder32big?language=objc)
pub const kColorSyncByteOrder32Big: c_uint = 4 << 12;

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/colorsyncdatalayout?language=objc)
pub type ColorSyncDataLayout = u32;

impl ColorSyncTransform {
    /// # Safety
    ///
    /// - `dst` must be a valid pointer.
    /// - `src` must be a valid pointer.
    /// - `options` generics must be of the correct type.
    #[doc(alias = "ColorSyncTransformConvert")]
    #[inline]
    pub unsafe fn convert(
        &self,
        width: usize,
        height: usize,
        dst: NonNull<c_void>,
        dst_depth: ColorSyncDataDepth,
        dst_layout: ColorSyncDataLayout,
        dst_bytes_per_row: usize,
        src: NonNull<c_void>,
        src_depth: ColorSyncDataDepth,
        src_layout: ColorSyncDataLayout,
        src_bytes_per_row: usize,
        options: Option<&CFDictionary>,
    ) -> bool {
        extern "C-unwind" {
            fn ColorSyncTransformConvert(
                transform: &ColorSyncTransform,
                width: usize,
                height: usize,
                dst: NonNull<c_void>,
                dst_depth: ColorSyncDataDepth,
                dst_layout: ColorSyncDataLayout,
                dst_bytes_per_row: usize,
                src: NonNull<c_void>,
                src_depth: ColorSyncDataDepth,
                src_layout: ColorSyncDataLayout,
                src_bytes_per_row: usize,
                options: Option<&CFDictionary>,
            ) -> bool;
        }
        unsafe {
            ColorSyncTransformConvert(
                self,
                width,
                height,
                dst,
                dst_depth,
                dst_layout,
                dst_bytes_per_row,
                src,
                src_depth,
                src_layout,
                src_bytes_per_row,
                options,
            )
        }
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncprofile?language=objc)
    pub static kColorSyncProfile: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncrenderingintent?language=objc)
    pub static kColorSyncRenderingIntent: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncrenderingintentperceptual?language=objc)
    pub static kColorSyncRenderingIntentPerceptual: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncrenderingintentrelative?language=objc)
    pub static kColorSyncRenderingIntentRelative: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncrenderingintentsaturation?language=objc)
    pub static kColorSyncRenderingIntentSaturation: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncrenderingintentabsolute?language=objc)
    pub static kColorSyncRenderingIntentAbsolute: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncrenderingintentuseprofileheader?language=objc)
    pub static kColorSyncRenderingIntentUseProfileHeader: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformtag?language=objc)
    pub static kColorSyncTransformTag: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformdevicetopcs?language=objc)
    pub static kColorSyncTransformDeviceToPCS: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformpcstopcs?language=objc)
    pub static kColorSyncTransformPCSToPCS: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformpcstodevice?language=objc)
    pub static kColorSyncTransformPCSToDevice: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformdevicetodevice?language=objc)
    pub static kColorSyncTransformDeviceToDevice: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformgamutcheck?language=objc)
    pub static kColorSyncTransformGamutCheck: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncblackpointcompensation?language=objc)
    pub static kColorSyncBlackPointCompensation: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncextendedrange?language=objc)
    pub static kColorSyncExtendedRange: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynchdrderivative?language=objc)
    pub static kColorSyncHDRDerivative: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncpqderivative?language=objc)
    pub static kColorSyncPQDerivative: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynchlgderivative?language=objc)
    pub static kColorSyncHLGDerivative: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncpreferredcmm?language=objc)
    pub static kColorSyncPreferredCMM: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconvertquality?language=objc)
    pub static kColorSyncConvertQuality: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncbestquality?language=objc)
    pub static kColorSyncBestQuality: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncnormalquality?language=objc)
    pub static kColorSyncNormalQuality: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdraftquality?language=objc)
    pub static kColorSyncDraftQuality: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconvertuseextendedrange?language=objc)
    pub static kColorSyncConvertUseExtendedRange: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransforminfo?language=objc)
    pub static kColorSyncTransformInfo: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformcreator?language=objc)
    pub static kColorSyncTransformCreator: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformsrcspace?language=objc)
    pub static kColorSyncTransformSrcSpace: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformdstspace?language=objc)
    pub static kColorSyncTransformDstSpace: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformcodefragmenttype?language=objc)
    pub static kColorSyncTransformCodeFragmentType: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformcodefragmentmd5?language=objc)
    pub static kColorSyncTransformCodeFragmentMD5: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformfullconversiondata?language=objc)
    pub static kColorSyncTransformFullConversionData: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformsimplifiedconversiondata?language=objc)
    pub static kColorSyncTransformSimplifiedConversionData: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformparametricconversiondata?language=objc)
    pub static kColorSyncTransformParametricConversionData: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformprofilesequnce?language=objc)
    pub static kColorSyncTransformProfileSequnce: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynctransformuseitu709oetf?language=objc)
    pub static kColorSyncTransformUseITU709OETF: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionmatrix?language=objc)
    pub static kColorSyncConversionMatrix: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionparamcurve0?language=objc)
    pub static kColorSyncConversionParamCurve0: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionparamcurve1?language=objc)
    pub static kColorSyncConversionParamCurve1: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionparamcurve2?language=objc)
    pub static kColorSyncConversionParamCurve2: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionparamcurve3?language=objc)
    pub static kColorSyncConversionParamCurve3: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionparamcurve4?language=objc)
    pub static kColorSyncConversionParamCurve4: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversion1dlut?language=objc)
    pub static kColorSyncConversion1DLut: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversiongridpoints?language=objc)
    pub static kColorSyncConversionGridPoints: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionchannelid?language=objc)
    pub static kColorSyncConversionChannelID: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversion3dlut?language=objc)
    pub static kColorSyncConversion3DLut: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionndlut?language=objc)
    pub static kColorSyncConversionNDLut: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversioninpchan?language=objc)
    pub static kColorSyncConversionInpChan: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionoutchan?language=objc)
    pub static kColorSyncConversionOutChan: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncconversionbpc?language=objc)
    pub static kColorSyncConversionBPC: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncfixedpointrange?language=objc)
    pub static kColorSyncFixedPointRange: &'static CFString;
}

/// # Safety
///
/// - `profile_sequence` generic must be of the correct type.
/// - `options` generics must be of the correct type.
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncCreateCodeFragment(
    profile_sequence: &CFArray,
    options: &CFDictionary,
) -> CFRetained<CFType> {
    extern "C-unwind" {
        fn ColorSyncCreateCodeFragment(
            profile_sequence: &CFArray,
            options: &CFDictionary,
        ) -> Option<NonNull<CFType>>;
    }
    let ret = unsafe { ColorSyncCreateCodeFragment(profile_sequence, options) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `ColorSyncTransform::new`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncTransformCreate(
    profile_sequence: Option<&CFArray>,
    options: Option<&CFDictionary>,
) -> Option<CFRetained<ColorSyncTransform>> {
    extern "C-unwind" {
        fn ColorSyncTransformCreate(
            profile_sequence: Option<&CFArray>,
            options: Option<&CFDictionary>,
        ) -> Option<NonNull<ColorSyncTransform>>;
    }
    let ret = unsafe { ColorSyncTransformCreate(profile_sequence, options) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `ColorSyncTransform::property`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncTransformCopyProperty(
    transform: &ColorSyncTransform,
    key: &CFType,
    options: Option<&CFDictionary>,
) -> Option<CFRetained<CFType>> {
    extern "C-unwind" {
        fn ColorSyncTransformCopyProperty(
            transform: &ColorSyncTransform,
            key: &CFType,
            options: Option<&CFDictionary>,
        ) -> Option<NonNull<CFType>>;
    }
    let ret = unsafe { ColorSyncTransformCopyProperty(transform, key, options) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[deprecated = "renamed to `ColorSyncTransform::set_property`"]
    pub fn ColorSyncTransformSetProperty(
        transform: &ColorSyncTransform,
        key: &CFType,
        property: Option<&CFType>,
    );
}

#[deprecated = "renamed to `ColorSyncTransform::profile_sequence`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncTransformGetProfileSequence(
    transform: &ColorSyncTransform,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn ColorSyncTransformGetProfileSequence(
            transform: &ColorSyncTransform,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { ColorSyncTransformGetProfileSequence(transform) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

extern "C-unwind" {
    #[deprecated = "renamed to `ColorSyncTransform::convert`"]
    pub fn ColorSyncTransformConvert(
        transform: &ColorSyncTransform,
        width: usize,
        height: usize,
        dst: NonNull<c_void>,
        dst_depth: ColorSyncDataDepth,
        dst_layout: ColorSyncDataLayout,
        dst_bytes_per_row: usize,
        src: NonNull<c_void>,
        src_depth: ColorSyncDataDepth,
        src_layout: ColorSyncDataLayout,
        src_bytes_per_row: usize,
        options: Option<&CFDictionary>,
    ) -> bool;
}
