objc2_ar_kit/generated/
ARFrame.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-av-foundation")]
8use objc2_av_foundation::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11#[cfg(feature = "objc2-core-video")]
12use objc2_core_video::*;
13#[cfg(feature = "objc2-foundation")]
14use objc2_foundation::*;
15#[cfg(feature = "objc2-metal")]
16use objc2_metal::*;
17#[cfg(feature = "objc2-ui-kit")]
18use objc2_ui_kit::*;
19
20use crate::*;
21
22/// Segmentation classes which defines a pixel's semantic label.
23///
24/// When running a configuration with 'ARFrameSemanticPersonSegmentation' every pixel in the
25/// segmentationBuffer on the ARFrame will conform to one of these classes.
26///
27/// See: -[ARConfiguration setFrameSemantics:]
28///
29/// See: -[ARFrame segmentationBuffer]
30///
31/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arsegmentationclass?language=objc)
32// NS_ENUM
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct ARSegmentationClass(pub u8);
36impl ARSegmentationClass {
37    #[doc(alias = "ARSegmentationClassNone")]
38    pub const None: Self = Self(0);
39    #[doc(alias = "ARSegmentationClassPerson")]
40    pub const Person: Self = Self(255);
41}
42
43#[cfg(feature = "objc2")]
44unsafe impl Encode for ARSegmentationClass {
45    const ENCODING: Encoding = u8::ENCODING;
46}
47
48#[cfg(feature = "objc2")]
49unsafe impl RefEncode for ARSegmentationClass {
50    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
51}
52
53/// A value describing the world mapping status for the area visible in a given frame.
54///
55/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arworldmappingstatus?language=objc)
56// NS_ENUM
57#[cfg(feature = "objc2")]
58#[repr(transparent)]
59#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
60pub struct ARWorldMappingStatus(pub NSInteger);
61#[cfg(feature = "objc2")]
62impl ARWorldMappingStatus {
63    /// World mapping is not available.
64    #[doc(alias = "ARWorldMappingStatusNotAvailable")]
65    pub const NotAvailable: Self = Self(0);
66    /// World mapping is available but has limited features.
67    /// For the device's current position, the session’s world map is not recommended for relocalization.
68    #[doc(alias = "ARWorldMappingStatusLimited")]
69    pub const Limited: Self = Self(1);
70    /// World mapping is actively extending the map with the user's motion.
71    /// The world map will be relocalizable for previously visited areas but is still being updated for the current space.
72    #[doc(alias = "ARWorldMappingStatusExtending")]
73    pub const Extending: Self = Self(2);
74    /// World mapping has adequately mapped the visible area.
75    /// The map can be used to relocalize for the device's current position.
76    #[doc(alias = "ARWorldMappingStatusMapped")]
77    pub const Mapped: Self = Self(3);
78}
79
80#[cfg(feature = "objc2")]
81unsafe impl Encode for ARWorldMappingStatus {
82    const ENCODING: Encoding = NSInteger::ENCODING;
83}
84
85#[cfg(feature = "objc2")]
86unsafe impl RefEncode for ARWorldMappingStatus {
87    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
88}
89
90#[cfg(feature = "objc2")]
91extern_class!(
92    /// An object encapsulating the state of everything being tracked for a given moment in time.
93    ///
94    /// The model provides a snapshot of all data needed to render a given frame.
95    ///
96    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arframe?language=objc)
97    #[unsafe(super(NSObject))]
98    #[derive(Debug, PartialEq, Eq, Hash)]
99    #[cfg(feature = "objc2")]
100    pub struct ARFrame;
101);
102
103#[cfg(feature = "objc2")]
104unsafe impl Send for ARFrame {}
105
106#[cfg(feature = "objc2")]
107unsafe impl Sync for ARFrame {}
108
109#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
110extern_conformance!(
111    unsafe impl NSCopying for ARFrame {}
112);
113
114#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
115unsafe impl CopyingHelper for ARFrame {
116    type Result = Self;
117}
118
119#[cfg(feature = "objc2")]
120extern_conformance!(
121    unsafe impl NSObjectProtocol for ARFrame {}
122);
123
124#[cfg(feature = "objc2")]
125impl ARFrame {
126    extern_methods!(
127        #[cfg(feature = "objc2-foundation")]
128        /// A timestamp identifying the frame.
129        #[unsafe(method(timestamp))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn timestamp(&self) -> NSTimeInterval;
132
133        #[cfg(feature = "objc2-core-video")]
134        /// The frame’s captured image.
135        #[unsafe(method(capturedImage))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn capturedImage(&self) -> Retained<CVPixelBuffer>;
138
139        #[cfg(feature = "objc2-foundation")]
140        /// A dictionary of EXIF metadata for the captured image.
141        #[unsafe(method(exifData))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn exifData(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
144
145        #[cfg(feature = "objc2-metal")]
146        /// A tileable texture that contains image noise matching the current camera streams
147        /// noise properties.
148        ///
149        ///
150        /// A camera stream depicts image noise that gives the captured image
151        /// a grainy look and varies with light conditions.
152        /// The variations are stored along the depth dimension of the camera grain texture
153        /// and can be selected at runtime using the camera grain intensity of the current frame.
154        #[unsafe(method(cameraGrainTexture))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn cameraGrainTexture(&self)
157            -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
158
159        /// The frame’s camera grain intensity in range 0 to 1.
160        ///
161        ///
162        /// A camera stream depicts image noise that gives the captured image
163        /// a grainy look and varies with light conditions.
164        /// The camera grain intensity can be used to select a texture slice from the frames
165        /// camera grain texture.
166        #[unsafe(method(cameraGrainIntensity))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn cameraGrainIntensity(&self) -> c_float;
169
170        #[cfg(feature = "objc2-av-foundation")]
171        /// The frame’s captured depth data.
172        ///
173        /// Depth data is only provided with face tracking on frames where depth data was captured.
174        #[unsafe(method(capturedDepthData))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn capturedDepthData(&self) -> Option<Retained<AVDepthData>>;
177
178        #[cfg(feature = "objc2-foundation")]
179        /// A timestamp identifying the depth data.
180        #[unsafe(method(capturedDepthDataTimestamp))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn capturedDepthDataTimestamp(&self) -> NSTimeInterval;
183
184        #[cfg(feature = "ARCamera")]
185        /// The camera used to capture the frame’s image.
186        ///
187        /// The camera provides the device’s position and orientation as well as camera parameters.
188        #[unsafe(method(camera))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn camera(&self) -> Retained<ARCamera>;
191
192        #[cfg(all(feature = "ARAnchor", feature = "objc2-foundation"))]
193        /// A list of anchors in the scene.
194        #[unsafe(method(anchors))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn anchors(&self) -> Retained<NSArray<ARAnchor>>;
197
198        #[cfg(feature = "ARLightEstimate")]
199        /// A light estimate representing the light in the scene.
200        ///
201        /// Returns nil if there is no light estimation.
202        #[unsafe(method(lightEstimate))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn lightEstimate(&self) -> Option<Retained<ARLightEstimate>>;
205
206        #[cfg(feature = "ARPointCloud")]
207        /// Feature points in the scene with respect to the frame’s origin.
208        ///
209        /// The feature points are only provided for configurations using world tracking.
210        #[unsafe(method(rawFeaturePoints))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn rawFeaturePoints(&self) -> Option<Retained<ARPointCloud>>;
213
214        /// The status of world mapping for the area visible to the frame.
215        ///
216        /// This can be used to identify the state of the world map for the visible area and if additional scanning
217        /// should be done before saving a world map.
218        #[unsafe(method(worldMappingStatus))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn worldMappingStatus(&self) -> ARWorldMappingStatus;
221
222        #[cfg(feature = "objc2-core-video")]
223        /// A buffer that represents the segmented content of the capturedImage.
224        ///
225        /// In order to identify to which class a pixel has been classified one needs to compare its intensity value with the values
226        /// found in `ARSegmentationClass`.
227        ///
228        /// See: ARSegmentationClass
229        ///
230        /// See: -[ARConfiguration setFrameSemantics:]
231        #[unsafe(method(segmentationBuffer))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn segmentationBuffer(&self) -> Option<Retained<CVPixelBuffer>>;
234
235        #[cfg(feature = "objc2-core-video")]
236        /// A buffer that represents the estimated depth values for a performed segmentation.
237        ///
238        /// For each non-background pixel in the segmentation buffer the corresponding depth value can be accessed in this buffer.
239        ///
240        /// See: -[ARConfiguration setFrameSemantics:]
241        ///
242        /// See: -[ARFrame segmentationBuffer]
243        #[unsafe(method(estimatedDepthData))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn estimatedDepthData(&self) -> Option<Retained<CVPixelBuffer>>;
246
247        #[cfg(feature = "ARBody2D")]
248        /// A detected body in the current frame.
249        ///
250        /// See: -[ARConfiguration setFrameSemantics:]
251        #[unsafe(method(detectedBody))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn detectedBody(&self) -> Option<Retained<ARBody2D>>;
254
255        #[cfg(feature = "ARGeoTrackingTypes")]
256        /// The status of geo tracking.
257        #[unsafe(method(geoTrackingStatus))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn geoTrackingStatus(&self) -> Option<Retained<ARGeoTrackingStatus>>;
260
261        #[cfg(feature = "ARDepthData")]
262        /// Scene depth data.
263        ///
264        /// See: ARFrameSemanticSceneDepth.
265        ///
266        /// See: -[ARConfiguration setFrameSemantics:]
267        #[unsafe(method(sceneDepth))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn sceneDepth(&self) -> Option<Retained<ARDepthData>>;
270
271        #[cfg(feature = "ARDepthData")]
272        /// Scene depth data, smoothed for temporal consistency.
273        ///
274        /// See: ARFrameSemanticSmoothedSceneDepth.
275        ///
276        /// See: -[ARConfiguration setFrameSemantics:]
277        #[unsafe(method(smoothedSceneDepth))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn smoothedSceneDepth(&self) -> Option<Retained<ARDepthData>>;
280
281        #[cfg(all(
282            feature = "ARHitTestResult",
283            feature = "objc2-core-foundation",
284            feature = "objc2-foundation"
285        ))]
286        /// Searches the frame for objects corresponding to a point in the captured image.
287        ///
288        ///
289        /// A 2D point in the captured image’s coordinate space can refer to any point along a line segment
290        /// in the 3D coordinate space. Hit-testing is the process of finding objects in the world located along this line segment.
291        ///
292        /// Parameter `point`: A point in the image-space coordinate system of the captured image.
293        /// Values should range from (0,0) - upper left corner to (1,1) - lower right corner.
294        ///
295        /// Parameter `types`: The types of results to search for.
296        ///
297        /// Returns: An array of all hit-test results sorted from nearest to farthest.
298        #[deprecated = "Use [ARSession raycast:]"]
299        #[unsafe(method(hitTest:types:))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn hitTest_types(
302            &self,
303            point: CGPoint,
304            types: ARHitTestResultType,
305        ) -> Retained<NSArray<ARHitTestResult>>;
306
307        #[cfg(all(feature = "ARRaycastQuery", feature = "objc2-core-foundation"))]
308        /// Creates a raycast query originating from the point on the captured image, aligned along the center of the field of view of the camera.
309        ///
310        /// A 2D point in the captured image’s coordinate space and the field of view of the frame's camera is used to create a ray in the 3D cooridnate space originating at the point.
311        ///
312        /// Parameter `point`: A point in the image-space coordinate system of the captured image.
313        /// Values should range from (0,0) - upper left corner to (1,1) - lower right corner.
314        ///
315        /// Parameter `target`: Type of target where the ray should terminate.
316        ///
317        /// Parameter `alignment`: Alignment of the target.
318        #[unsafe(method(raycastQueryFromPoint:allowingTarget:alignment:))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn raycastQueryFromPoint_allowingTarget_alignment(
321            &self,
322            point: CGPoint,
323            target: ARRaycastTarget,
324            alignment: ARRaycastTargetAlignment,
325        ) -> Retained<ARRaycastQuery>;
326
327        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-ui-kit"))]
328        /// Returns a display transform for the provided viewport size and orientation.
329        ///
330        ///
331        /// The display transform can be used to convert normalized points in the image-space coordinate system
332        /// of the captured image to normalized points in the view’s coordinate space. The transform provides the correct rotation
333        /// and aspect-fill for presenting the captured image in the given orientation and size.
334        ///
335        /// Parameter `orientation`: The orientation of the viewport.
336        ///
337        /// Parameter `viewportSize`: The size of the viewport.
338        #[unsafe(method(displayTransformForOrientation:viewportSize:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn displayTransformForOrientation_viewportSize(
341            &self,
342            orientation: UIInterfaceOrientation,
343            viewport_size: CGSize,
344        ) -> CGAffineTransform;
345
346        /// Unavailable
347        #[unsafe(method(init))]
348        #[unsafe(method_family = init)]
349        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
350
351        #[unsafe(method(new))]
352        #[unsafe(method_family = new)]
353        pub unsafe fn new() -> Retained<Self>;
354    );
355}