//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-metal")]
use objc2_metal::*;

use crate::*;

// NS_TYPED_ENUM
pub type CIContextOption = NSString;

extern "C" {
    pub static kCIContextOutputColorSpace: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextWorkingColorSpace: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextWorkingFormat: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextHighQualityDownsample: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextOutputPremultiplied: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextCacheIntermediates: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextUseSoftwareRenderer: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextPriorityRequestLow: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextAllowLowPower: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextName: &'static CIContextOption;
}

extern "C" {
    pub static kCIContextMemoryLimit: &'static CIContextOption;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CIContext;

    unsafe impl ClassType for CIContext {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for CIContext {}

extern_methods!(
    unsafe impl CIContext {
        #[method_id(@__retain_semantics Other contextWithOptions:)]
        pub unsafe fn contextWithOptions(
            options: Option<&NSDictionary<CIContextOption, AnyObject>>,
        ) -> Retained<CIContext>;

        #[method_id(@__retain_semantics Other context)]
        pub unsafe fn context() -> Retained<CIContext>;

        #[method_id(@__retain_semantics Init initWithOptions:)]
        pub unsafe fn initWithOptions(
            this: Allocated<Self>,
            options: Option<&NSDictionary<CIContextOption, AnyObject>>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other contextWithMTLDevice:)]
        pub unsafe fn contextWithMTLDevice(
            device: &ProtocolObject<dyn MTLDevice>,
        ) -> Retained<CIContext>;

        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other contextWithMTLDevice:options:)]
        pub unsafe fn contextWithMTLDevice_options(
            device: &ProtocolObject<dyn MTLDevice>,
            options: Option<&NSDictionary<CIContextOption, AnyObject>>,
        ) -> Retained<CIContext>;

        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other contextWithMTLCommandQueue:)]
        pub unsafe fn contextWithMTLCommandQueue(
            command_queue: &ProtocolObject<dyn MTLCommandQueue>,
        ) -> Retained<CIContext>;

        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other contextWithMTLCommandQueue:options:)]
        pub unsafe fn contextWithMTLCommandQueue_options(
            command_queue: &ProtocolObject<dyn MTLCommandQueue>,
            options: Option<&NSDictionary<CIContextOption, AnyObject>>,
        ) -> Retained<CIContext>;

        #[cfg(feature = "CIImage")]
        #[method(workingFormat)]
        pub unsafe fn workingFormat(&self) -> CIFormat;

        #[cfg(feature = "CIImage")]
        #[deprecated]
        #[method(drawImage:atPoint:fromRect:)]
        pub unsafe fn drawImage_atPoint_fromRect(
            &self,
            image: &CIImage,
            at_point: CGPoint,
            from_rect: CGRect,
        );

        #[cfg(feature = "CIImage")]
        #[method(drawImage:inRect:fromRect:)]
        pub unsafe fn drawImage_inRect_fromRect(
            &self,
            image: &CIImage,
            in_rect: CGRect,
            from_rect: CGRect,
        );

        #[method(reclaimResources)]
        pub unsafe fn reclaimResources(&self);

        #[method(clearCaches)]
        pub unsafe fn clearCaches(&self);

        #[method(inputImageMaximumSize)]
        pub unsafe fn inputImageMaximumSize(&self) -> CGSize;

        #[method(outputImageMaximumSize)]
        pub unsafe fn outputImageMaximumSize(&self) -> CGSize;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CIContext {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_methods!(
    /// createCGImage
    unsafe impl CIContext {}
);

extern_methods!(
    /// OfflineGPUSupport
    unsafe impl CIContext {
        #[method(offlineGPUCount)]
        pub unsafe fn offlineGPUCount() -> c_uint;

        #[deprecated = "Core Image OpenGL API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)"]
        #[method_id(@__retain_semantics Other contextForOfflineGPUAtIndex:)]
        pub unsafe fn contextForOfflineGPUAtIndex(index: c_uint) -> Option<Retained<CIContext>>;
    }
);

// NS_TYPED_ENUM
pub type CIImageRepresentationOption = NSString;

extern "C" {
    pub static kCIImageRepresentationAVDepthData: &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationDepthImage: &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationDisparityImage: &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationAVPortraitEffectsMatte: &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationPortraitEffectsMatteImage:
        &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationAVSemanticSegmentationMattes:
        &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationSemanticSegmentationSkinMatteImage:
        &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationSemanticSegmentationHairMatteImage:
        &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationSemanticSegmentationTeethMatteImage:
        &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationSemanticSegmentationGlassesMatteImage:
        &'static CIImageRepresentationOption;
}

extern "C" {
    pub static kCIImageRepresentationSemanticSegmentationSkyMatteImage:
        &'static CIImageRepresentationOption;
}

extern_methods!(
    /// ImageRepresentation
    unsafe impl CIContext {
        #[cfg(feature = "CIImage")]
        #[method_id(@__retain_semantics Other OpenEXRRepresentationOfImage:options:error:_)]
        pub unsafe fn OpenEXRRepresentationOfImage_options_error(
            &self,
            image: &CIImage,
            options: &NSDictionary<CIImageRepresentationOption, AnyObject>,
        ) -> Result<Retained<NSData>, Retained<NSError>>;

        #[cfg(feature = "CIImage")]
        #[method(writeOpenEXRRepresentationOfImage:toURL:options:error:_)]
        pub unsafe fn writeOpenEXRRepresentationOfImage_toURL_options_error(
            &self,
            image: &CIImage,
            url: &NSURL,
            options: &NSDictionary<CIImageRepresentationOption, AnyObject>,
        ) -> Result<(), Retained<NSError>>;
    }
);

extern_methods!(
    /// CIDepthBlurEffect
    unsafe impl CIContext {
        #[cfg(feature = "CIFilter")]
        #[method_id(@__retain_semantics Other depthBlurEffectFilterForImageURL:options:)]
        pub unsafe fn depthBlurEffectFilterForImageURL_options(
            &self,
            url: &NSURL,
            options: Option<&NSDictionary>,
        ) -> Option<Retained<CIFilter>>;

        #[cfg(feature = "CIFilter")]
        #[method_id(@__retain_semantics Other depthBlurEffectFilterForImageData:options:)]
        pub unsafe fn depthBlurEffectFilterForImageData_options(
            &self,
            data: &NSData,
            options: Option<&NSDictionary>,
        ) -> Option<Retained<CIFilter>>;
    }
);
