objc2-color-sync 0.3.2

Bindings to the ColorSync framework
Documentation
//! 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/colorsynccmm?language=objc)
#[doc(alias = "ColorSyncCMMRef")]
#[repr(C)]
pub struct ColorSyncCMM {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

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

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

impl ColorSyncCMM {
    #[doc(alias = "ColorSyncCMMCreate")]
    #[inline]
    pub unsafe fn new(cmm_bundle: &CFBundle) -> Option<CFRetained<ColorSyncCMM>> {
        extern "C-unwind" {
            fn ColorSyncCMMCreate(cmm_bundle: &CFBundle) -> Option<NonNull<ColorSyncCMM>>;
        }
        let ret = unsafe { ColorSyncCMMCreate(cmm_bundle) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    #[doc(alias = "ColorSyncCMMGetBundle")]
    #[inline]
    pub unsafe fn bundle(&self) -> Option<CFRetained<CFBundle>> {
        extern "C-unwind" {
            fn ColorSyncCMMGetBundle(param1: &ColorSyncCMM) -> Option<NonNull<CFBundle>>;
        }
        let ret = unsafe { ColorSyncCMMGetBundle(self) };
        ret.map(|ret| unsafe { CFRetained::retain(ret) })
    }

    #[doc(alias = "ColorSyncCMMCopyLocalizedName")]
    #[inline]
    pub unsafe fn localized_name(&self) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn ColorSyncCMMCopyLocalizedName(param1: &ColorSyncCMM) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { ColorSyncCMMCopyLocalizedName(self) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    #[doc(alias = "ColorSyncCMMCopyCMMIdentifier")]
    #[inline]
    pub unsafe fn cmm_identifier(&self) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn ColorSyncCMMCopyCMMIdentifier(param1: &ColorSyncCMM) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { ColorSyncCMMCopyCMMIdentifier(self) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/colorsynccmmiteratecallback?language=objc)
pub type ColorSyncCMMIterateCallback =
    Option<unsafe extern "C-unwind" fn(NonNull<ColorSyncCMM>, NonNull<c_void>) -> bool>;

extern "C-unwind" {
    /// # Safety
    ///
    /// - `call_back` must be implemented correctly.
    /// - `user_info` must be a valid pointer or null.
    pub fn ColorSyncIterateInstalledCMMs(
        call_back: ColorSyncCMMIterateCallback,
        user_info: *mut c_void,
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/cmminitializelinkprofileproc?language=objc)
#[cfg(feature = "ColorSyncProfile")]
pub type CMMInitializeLinkProfileProc = Option<
    unsafe extern "C-unwind" fn(
        NonNull<ColorSyncMutableProfile>,
        NonNull<CFArray>,
        *const CFDictionary,
    ) -> bool,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/cmminitializetransformproc?language=objc)
#[cfg(feature = "ColorSyncTransform")]
pub type CMMInitializeTransformProc = Option<
    unsafe extern "C-unwind" fn(
        NonNull<ColorSyncTransform>,
        NonNull<CFArray>,
        *const CFDictionary,
    ) -> bool,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/cmmapplytransformproc?language=objc)
#[cfg(feature = "ColorSyncTransform")]
pub type CMMApplyTransformProc = Option<
    unsafe extern "C-unwind" fn(
        NonNull<ColorSyncTransform>,
        usize,
        usize,
        usize,
        NonNull<NonNull<c_void>>,
        ColorSyncDataDepth,
        ColorSyncDataLayout,
        usize,
        usize,
        NonNull<NonNull<c_void>>,
        ColorSyncDataDepth,
        ColorSyncDataLayout,
        usize,
        *const CFDictionary,
    ) -> bool,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/cmmcreatetransformpropertyproc?language=objc)
#[cfg(feature = "ColorSyncTransform")]
pub type CMMCreateTransformPropertyProc = Option<
    unsafe extern "C-unwind" fn(
        *mut ColorSyncTransform,
        NonNull<CFType>,
        *const CFDictionary,
    ) -> *const CFType,
>;

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

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

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

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

#[deprecated = "renamed to `ColorSyncCMM::new`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncCMMCreate(
    cmm_bundle: &CFBundle,
) -> Option<CFRetained<ColorSyncCMM>> {
    extern "C-unwind" {
        fn ColorSyncCMMCreate(cmm_bundle: &CFBundle) -> Option<NonNull<ColorSyncCMM>>;
    }
    let ret = unsafe { ColorSyncCMMCreate(cmm_bundle) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `ColorSyncCMM::bundle`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncCMMGetBundle(
    param1: &ColorSyncCMM,
) -> Option<CFRetained<CFBundle>> {
    extern "C-unwind" {
        fn ColorSyncCMMGetBundle(param1: &ColorSyncCMM) -> Option<NonNull<CFBundle>>;
    }
    let ret = unsafe { ColorSyncCMMGetBundle(param1) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

#[deprecated = "renamed to `ColorSyncCMM::localized_name`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncCMMCopyLocalizedName(
    param1: &ColorSyncCMM,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn ColorSyncCMMCopyLocalizedName(param1: &ColorSyncCMM) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { ColorSyncCMMCopyLocalizedName(param1) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `ColorSyncCMM::cmm_identifier`"]
#[inline]
pub unsafe extern "C-unwind" fn ColorSyncCMMCopyCMMIdentifier(
    param1: &ColorSyncCMM,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn ColorSyncCMMCopyCMMIdentifier(param1: &ColorSyncCMM) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { ColorSyncCMMCopyCMMIdentifier(param1) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}