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::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-vision")]
use objc2_vision::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// An object representing a skeleton.
    ///
    /// A skeleton's structure is defined by a skeleton definition.
    ///
    /// See: ARSkeletonDefinition
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arskeleton?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARSkeleton;
);

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

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

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

#[cfg(feature = "objc2")]
impl ARSkeleton {
    extern_methods!(
        #[cfg(feature = "ARSkeletonDefinition")]
        /// Skeleton definition.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(definition))]
        #[unsafe(method_family = none)]
        pub unsafe fn definition(&self) -> Retained<ARSkeletonDefinition>;

        /// The number of joints.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(jointCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn jointCount(&self) -> NSUInteger;

        /// Tracking state for a given joint.
        ///
        ///
        /// Parameter `jointIndex`: The index of the joint.
        ///
        /// Returns: YES if the joint is tracked. NO otherwise.
        #[unsafe(method(isJointTracked:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isJointTracked(&self, joint_index: NSInteger) -> bool;

        /// 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>;
    );
}

#[cfg(feature = "objc2")]
extern_class!(
    /// An object representing a skeleton in 3D.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arskeleton3d?language=objc)
    #[unsafe(super(ARSkeleton, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARSkeleton3D;
);

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

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

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

#[cfg(feature = "objc2")]
impl ARSkeleton3D {
    extern_methods!(
        /// 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>;
    );
}

#[cfg(feature = "objc2")]
extern_class!(
    /// An object representing a skeleton in 2D.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arskeleton2d?language=objc)
    #[unsafe(super(ARSkeleton, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARSkeleton2D;
);

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

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

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

#[cfg(feature = "objc2")]
impl ARSkeleton2D {
    extern_methods!(
        /// 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>;
    );
}

#[cfg(feature = "objc2")]
impl ARSkeleton {
    /// Returns the landmark joint name that corresponds to a key point defined in Vision framework.
    ///
    /// See: VNRecognizedPointKey, VNDetectHumanBodyPoseRequest
    ///
    /// If an invalid key point is passed the returned point will be nil.
    ///
    ///
    /// Parameter `recognizedPointKey`: Recognized key point.
    ///
    /// Returns: Joint name that could be mapped to a ARSkeleton2D. Nil if no mapping exists.
    #[doc(alias = "ARSkeletonJointNameForRecognizedPointKey")]
    #[cfg(all(
        feature = "ARSkeletonDefinition",
        feature = "objc2",
        feature = "objc2-foundation",
        feature = "objc2-vision"
    ))]
    #[inline]
    pub unsafe fn joint_name_for_recognized_point_key(
        recognized_point_key: &VNRecognizedPointKey,
    ) -> Option<Retained<ARSkeletonJointName>> {
        extern "C-unwind" {
            fn ARSkeletonJointNameForRecognizedPointKey(
                recognized_point_key: &VNRecognizedPointKey,
            ) -> *mut ARSkeletonJointName;
        }
        let ret = unsafe { ARSkeletonJointNameForRecognizedPointKey(recognized_point_key) };
        unsafe { Retained::retain_autoreleased(ret) }
    }
}

#[cfg(all(
    feature = "ARSkeletonDefinition",
    feature = "objc2",
    feature = "objc2-foundation",
    feature = "objc2-vision"
))]
#[deprecated = "renamed to `ARSkeleton::joint_name_for_recognized_point_key`"]
#[inline]
pub unsafe extern "C-unwind" fn ARSkeletonJointNameForRecognizedPointKey(
    recognized_point_key: &VNRecognizedPointKey,
) -> Option<Retained<ARSkeletonJointName>> {
    extern "C-unwind" {
        fn ARSkeletonJointNameForRecognizedPointKey(
            recognized_point_key: &VNRecognizedPointKey,
        ) -> *mut ARSkeletonJointName;
    }
    let ret = unsafe { ARSkeletonJointNameForRecognizedPointKey(recognized_point_key) };
    unsafe { Retained::retain_autoreleased(ret) }
}