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::*;
#[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 {
#[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) })
}
#[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) })
}
#[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) })
}
}
#[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);
}
#[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);
}
pub const kColorSyncAlphaInfoMask: c_uint = 0x1F;
pub const kColorSyncByteOrderMask: c_uint = 0x7000;
pub const kColorSyncByteOrderDefault: c_uint = 0 << 12;
pub const kColorSyncByteOrder16Little: c_uint = 1 << 12;
pub const kColorSyncByteOrder32Little: c_uint = 2 << 12;
pub const kColorSyncByteOrder16Big: c_uint = 3 << 12;
pub const kColorSyncByteOrder32Big: c_uint = 4 << 12;
pub type ColorSyncDataLayout = u32;
impl ColorSyncTransform {
#[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" {
pub static kColorSyncProfile: &'static CFString;
}
extern "C" {
pub static kColorSyncRenderingIntent: &'static CFString;
}
extern "C" {
pub static kColorSyncRenderingIntentPerceptual: &'static CFString;
}
extern "C" {
pub static kColorSyncRenderingIntentRelative: &'static CFString;
}
extern "C" {
pub static kColorSyncRenderingIntentSaturation: &'static CFString;
}
extern "C" {
pub static kColorSyncRenderingIntentAbsolute: &'static CFString;
}
extern "C" {
pub static kColorSyncRenderingIntentUseProfileHeader: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformTag: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformDeviceToPCS: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformPCSToPCS: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformPCSToDevice: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformDeviceToDevice: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformGamutCheck: &'static CFString;
}
extern "C" {
pub static kColorSyncBlackPointCompensation: &'static CFString;
}
extern "C" {
pub static kColorSyncExtendedRange: &'static CFString;
}
extern "C" {
pub static kColorSyncHDRDerivative: &'static CFString;
}
extern "C" {
pub static kColorSyncPQDerivative: &'static CFString;
}
extern "C" {
pub static kColorSyncHLGDerivative: &'static CFString;
}
extern "C" {
pub static kColorSyncPreferredCMM: &'static CFString;
}
extern "C" {
pub static kColorSyncConvertQuality: &'static CFString;
}
extern "C" {
pub static kColorSyncBestQuality: &'static CFString;
}
extern "C" {
pub static kColorSyncNormalQuality: &'static CFString;
}
extern "C" {
pub static kColorSyncDraftQuality: &'static CFString;
}
extern "C" {
pub static kColorSyncConvertUseExtendedRange: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformInfo: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformCreator: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformSrcSpace: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformDstSpace: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformCodeFragmentType: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformCodeFragmentMD5: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformFullConversionData: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformSimplifiedConversionData: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformParametricConversionData: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformProfileSequnce: &'static CFString;
}
extern "C" {
pub static kColorSyncTransformUseITU709OETF: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionMatrix: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionParamCurve0: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionParamCurve1: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionParamCurve2: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionParamCurve3: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionParamCurve4: &'static CFString;
}
extern "C" {
pub static kColorSyncConversion1DLut: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionGridPoints: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionChannelID: &'static CFString;
}
extern "C" {
pub static kColorSyncConversion3DLut: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionNDLut: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionInpChan: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionOutChan: &'static CFString;
}
extern "C" {
pub static kColorSyncConversionBPC: &'static CFString;
}
extern "C" {
pub static kColorSyncFixedPointRange: &'static CFString;
}
#[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;
}