objc2-ar-kit 0.3.2

Bindings to the ARKit 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-video")]
use objc2_core_video::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;
#[cfg(feature = "objc2-image-io")]
use objc2_image_io::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// A reference image to be detected in the scene.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arreferenceimage?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARReferenceImage;
);

#[cfg(feature = "objc2")]
unsafe impl Send for ARReferenceImage {}

#[cfg(feature = "objc2")]
unsafe impl Sync for ARReferenceImage {}

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARReferenceImage {}
);

#[cfg(feature = "objc2")]
impl ARReferenceImage {
    extern_methods!(
        #[cfg(feature = "objc2-foundation")]
        /// An optional name used to identify the image.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "objc2-foundation")]
        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setName(&self, name: Option<&NSString>);

        #[cfg(feature = "objc2-core-foundation")]
        /// The physical size of the image in meters.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(physicalSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn physicalSize(&self) -> CGSize;

        #[cfg(feature = "objc2-foundation")]
        /// The AR resource group name for this image.
        ///
        /// If this image was loaded via an AR resource group in the Xcode asset catalogue this property will have the name of the resource group,
        /// else be set to nil.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(resourceGroupName))]
        #[unsafe(method_family = none)]
        pub unsafe fn resourceGroupName(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "block2", feature = "objc2-foundation"))]
        /// Validate if this image can be used for image detection or tracking.
        ///
        /// When loading reference images from the asset catalog this verification is not needed as the same verification happens
        /// at compile time.
        ///
        /// Parameter `completionHandler`: Completion handler invoked when validation is done. The completion handler takes the following parameters:
        /// error - An error that indicates why the image is not suitable for tracking, or nil if no error occurred.
        #[unsafe(method(validateWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn validateWithCompletionHandler(
            &self,
            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
        );

        #[cfg(all(
            feature = "objc2-core-foundation",
            feature = "objc2-core-graphics",
            feature = "objc2-image-io"
        ))]
        /// Creates a new reference image.
        ///
        ///
        /// Parameter `image`: The reference image as CGImage.
        ///
        /// Parameter `orientation`: The image orientation.
        ///
        /// Parameter `physicalWidth`: The width in meters of the physical object.
        #[unsafe(method(initWithCGImage:orientation:physicalWidth:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCGImage_orientation_physicalWidth(
            this: Allocated<Self>,
            image: &CGImage,
            orientation: CGImagePropertyOrientation,
            physical_width: CGFloat,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "objc2-core-foundation",
            feature = "objc2-core-video",
            feature = "objc2-image-io"
        ))]
        /// Creates a new reference image.
        ///
        ///
        /// Parameter `pixelBuffer`: The reference image as CVPixelBuffer.
        ///
        /// Parameter `physicalWidth`: The width in meters of the physical object.
        ///
        /// Parameter `orientation`: The image orientation.
        #[unsafe(method(initWithPixelBuffer:orientation:physicalWidth:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPixelBuffer_orientation_physicalWidth(
            this: Allocated<Self>,
            pixel_buffer: &CVPixelBuffer,
            orientation: CGImagePropertyOrientation,
            physical_width: CGFloat,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-foundation")]
        /// Returns the set of ARReferenceImages in the specified resource group and bundle.
        ///
        ///
        /// Parameter `name`: The name of the resource group.
        ///
        /// Parameter `bundle`: The bundle containing the image file or asset catalog. Specify nil to search the app’s main bundle.
        ///
        /// Returns: The set of reference images or nil on error.
        #[unsafe(method(referenceImagesInGroupNamed:bundle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn referenceImagesInGroupNamed_bundle(
            name: &NSString,
            bundle: Option<&NSBundle>,
        ) -> Option<Retained<NSSet<ARReferenceImage>>>;

        /// Unavailable
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}