objc2_ar_kit/generated/
ARSkeleton.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-vision")]
7use objc2_vision::*;
8
9use crate::*;
10
11#[cfg(feature = "objc2")]
12extern_class!(
13    /// An object representing a skeleton.
14    ///
15    /// A skeleton's structure is defined by a skeleton definition.
16    ///
17    /// See: ARSkeletonDefinition
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arskeleton?language=objc)
20    #[unsafe(super(NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(feature = "objc2")]
23    pub struct ARSkeleton;
24);
25
26#[cfg(feature = "objc2")]
27unsafe impl Send for ARSkeleton {}
28
29#[cfg(feature = "objc2")]
30unsafe impl Sync for ARSkeleton {}
31
32#[cfg(feature = "objc2")]
33extern_conformance!(
34    unsafe impl NSObjectProtocol for ARSkeleton {}
35);
36
37#[cfg(feature = "objc2")]
38impl ARSkeleton {
39    extern_methods!(
40        #[cfg(feature = "ARSkeletonDefinition")]
41        /// Skeleton definition.
42        ///
43        /// This property is not atomic.
44        ///
45        /// # Safety
46        ///
47        /// This might not be thread-safe.
48        #[unsafe(method(definition))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn definition(&self) -> Retained<ARSkeletonDefinition>;
51
52        /// The number of joints.
53        ///
54        /// This property is not atomic.
55        ///
56        /// # Safety
57        ///
58        /// This might not be thread-safe.
59        #[unsafe(method(jointCount))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn jointCount(&self) -> NSUInteger;
62
63        /// Tracking state for a given joint.
64        ///
65        ///
66        /// Parameter `jointIndex`: The index of the joint.
67        ///
68        /// Returns: YES if the joint is tracked. NO otherwise.
69        #[unsafe(method(isJointTracked:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn isJointTracked(&self, joint_index: NSInteger) -> bool;
72
73        /// Unavailable
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new() -> Retained<Self>;
81    );
82}
83
84#[cfg(feature = "objc2")]
85extern_class!(
86    /// An object representing a skeleton in 3D.
87    ///
88    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arskeleton3d?language=objc)
89    #[unsafe(super(ARSkeleton, NSObject))]
90    #[derive(Debug, PartialEq, Eq, Hash)]
91    #[cfg(feature = "objc2")]
92    pub struct ARSkeleton3D;
93);
94
95#[cfg(feature = "objc2")]
96unsafe impl Send for ARSkeleton3D {}
97
98#[cfg(feature = "objc2")]
99unsafe impl Sync for ARSkeleton3D {}
100
101#[cfg(feature = "objc2")]
102extern_conformance!(
103    unsafe impl NSObjectProtocol for ARSkeleton3D {}
104);
105
106#[cfg(feature = "objc2")]
107impl ARSkeleton3D {
108    extern_methods!(
109        /// Unavailable
110        #[unsafe(method(init))]
111        #[unsafe(method_family = init)]
112        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
113
114        #[unsafe(method(new))]
115        #[unsafe(method_family = new)]
116        pub unsafe fn new() -> Retained<Self>;
117    );
118}
119
120#[cfg(feature = "objc2")]
121extern_class!(
122    /// An object representing a skeleton in 2D.
123    ///
124    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arskeleton2d?language=objc)
125    #[unsafe(super(ARSkeleton, NSObject))]
126    #[derive(Debug, PartialEq, Eq, Hash)]
127    #[cfg(feature = "objc2")]
128    pub struct ARSkeleton2D;
129);
130
131#[cfg(feature = "objc2")]
132unsafe impl Send for ARSkeleton2D {}
133
134#[cfg(feature = "objc2")]
135unsafe impl Sync for ARSkeleton2D {}
136
137#[cfg(feature = "objc2")]
138extern_conformance!(
139    unsafe impl NSObjectProtocol for ARSkeleton2D {}
140);
141
142#[cfg(feature = "objc2")]
143impl ARSkeleton2D {
144    extern_methods!(
145        /// Unavailable
146        #[unsafe(method(init))]
147        #[unsafe(method_family = init)]
148        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
149
150        #[unsafe(method(new))]
151        #[unsafe(method_family = new)]
152        pub unsafe fn new() -> Retained<Self>;
153    );
154}
155
156#[cfg(feature = "objc2")]
157impl ARSkeleton {
158    /// Returns the landmark joint name that corresponds to a key point defined in Vision framework.
159    ///
160    /// See: VNRecognizedPointKey, VNDetectHumanBodyPoseRequest
161    ///
162    /// If an invalid key point is passed the returned point will be nil.
163    ///
164    ///
165    /// Parameter `recognizedPointKey`: Recognized key point.
166    ///
167    /// Returns: Joint name that could be mapped to a ARSkeleton2D. Nil if no mapping exists.
168    #[doc(alias = "ARSkeletonJointNameForRecognizedPointKey")]
169    #[cfg(all(
170        feature = "ARSkeletonDefinition",
171        feature = "objc2",
172        feature = "objc2-foundation",
173        feature = "objc2-vision"
174    ))]
175    #[inline]
176    pub unsafe fn joint_name_for_recognized_point_key(
177        recognized_point_key: &VNRecognizedPointKey,
178    ) -> Option<Retained<ARSkeletonJointName>> {
179        extern "C-unwind" {
180            fn ARSkeletonJointNameForRecognizedPointKey(
181                recognized_point_key: &VNRecognizedPointKey,
182            ) -> *mut ARSkeletonJointName;
183        }
184        let ret = unsafe { ARSkeletonJointNameForRecognizedPointKey(recognized_point_key) };
185        unsafe { Retained::retain_autoreleased(ret) }
186    }
187}
188
189#[cfg(all(
190    feature = "ARSkeletonDefinition",
191    feature = "objc2",
192    feature = "objc2-foundation",
193    feature = "objc2-vision"
194))]
195#[deprecated = "renamed to `ARSkeleton::joint_name_for_recognized_point_key`"]
196#[inline]
197pub unsafe extern "C-unwind" fn ARSkeletonJointNameForRecognizedPointKey(
198    recognized_point_key: &VNRecognizedPointKey,
199) -> Option<Retained<ARSkeletonJointName>> {
200    extern "C-unwind" {
201        fn ARSkeletonJointNameForRecognizedPointKey(
202            recognized_point_key: &VNRecognizedPointKey,
203        ) -> *mut ARSkeletonJointName;
204    }
205    let ret = unsafe { ARSkeletonJointNameForRecognizedPointKey(recognized_point_key) };
206    unsafe { Retained::retain_autoreleased(ret) }
207}