objc2-image-io 0.3.2

Bindings to the ImageIO framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/imageio/cgimageanimationstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGImageAnimationStatus(pub OSStatus);
impl CGImageAnimationStatus {
    #[doc(alias = "kCGImageAnimationStatus_ParameterError")]
    pub const ParameterError: Self = Self(-22140);
    #[doc(alias = "kCGImageAnimationStatus_CorruptInputImage")]
    pub const CorruptInputImage: Self = Self(-22141);
    #[doc(alias = "kCGImageAnimationStatus_UnsupportedFormat")]
    pub const UnsupportedFormat: Self = Self(-22142);
    #[doc(alias = "kCGImageAnimationStatus_IncompleteInputImage")]
    pub const IncompleteInputImage: Self = Self(-22143);
    #[doc(alias = "kCGImageAnimationStatus_AllocationFailure")]
    pub const AllocationFailure: Self = Self(-22144);
}

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

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

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

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/imageio/cgimagesourceanimationblock?language=objc)
#[cfg(all(feature = "block2", feature = "objc2-core-graphics"))]
pub type CGImageSourceAnimationBlock =
    *mut block2::DynBlock<dyn Fn(usize, NonNull<CGImage>, NonNull<bool>)>;

extern "C-unwind" {
    /// Animate the sequence of images contained in the file at `url`. Currently supported image
    /// formats are GIF and APNG. The `options` dictionary may be used to request additional playback
    /// options; see the list of keys above for more information. The block is called on the main queue
    /// at time intervals specified by the `delay time` of the image. The animation can be stopped by
    /// setting the boolean parameter of the block to true.
    ///
    /// # Safety
    ///
    /// - `options` generics must be of the correct type.
    /// - `block` must be a valid pointer.
    #[cfg(all(feature = "block2", feature = "objc2-core-graphics"))]
    pub fn CGAnimateImageAtURLWithBlock(
        url: &CFURL,
        options: Option<&CFDictionary>,
        block: CGImageSourceAnimationBlock,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Animate the sequence of images contained in `data`. Currently supported image
    /// formats are GIF and APNG. The `options` dictionary may be used to request additional playback
    /// options; see the list of keys above for more information. The block is called on the main queue
    /// at time intervals specified by the `delay time` of the image. The animation can be stopped by
    /// setting the boolean parameter of the block to true.
    ///
    /// # Safety
    ///
    /// - `options` generics must be of the correct type.
    /// - `block` must be a valid pointer.
    #[cfg(all(feature = "block2", feature = "objc2-core-graphics"))]
    pub fn CGAnimateImageDataWithBlock(
        data: &CFData,
        options: Option<&CFDictionary>,
        block: CGImageSourceAnimationBlock,
    ) -> OSStatus;
}