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"))]
110unsafe impl NSCopying for ARFrame {}
111
112#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
113unsafe impl CopyingHelper for ARFrame {
114 type Result = Self;
115}
116
117#[cfg(feature = "objc2")]
118unsafe impl NSObjectProtocol for ARFrame {}
119
120#[cfg(feature = "objc2")]
121impl ARFrame {
122 extern_methods!(
123 #[cfg(feature = "objc2-foundation")]
124 /// A timestamp identifying the frame.
125 #[unsafe(method(timestamp))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn timestamp(&self) -> NSTimeInterval;
128
129 #[cfg(feature = "objc2-core-video")]
130 /// The frame’s captured image.
131 #[unsafe(method(capturedImage))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn capturedImage(&self) -> Retained<CVPixelBuffer>;
134
135 #[cfg(feature = "objc2-foundation")]
136 /// A dictionary of EXIF metadata for the captured image.
137 #[unsafe(method(exifData))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn exifData(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
140
141 #[cfg(feature = "objc2-metal")]
142 /// A tileable texture that contains image noise matching the current camera streams
143 /// noise properties.
144 ///
145 ///
146 /// A camera stream depicts image noise that gives the captured image
147 /// a grainy look and varies with light conditions.
148 /// The variations are stored along the depth dimension of the camera grain texture
149 /// and can be selected at runtime using the camera grain intensity of the current frame.
150 #[unsafe(method(cameraGrainTexture))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn cameraGrainTexture(&self)
153 -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
154
155 /// The frame’s camera grain intensity in range 0 to 1.
156 ///
157 ///
158 /// A camera stream depicts image noise that gives the captured image
159 /// a grainy look and varies with light conditions.
160 /// The camera grain intensity can be used to select a texture slice from the frames
161 /// camera grain texture.
162 #[unsafe(method(cameraGrainIntensity))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn cameraGrainIntensity(&self) -> c_float;
165
166 #[cfg(feature = "objc2-av-foundation")]
167 /// The frame’s captured depth data.
168 ///
169 /// Depth data is only provided with face tracking on frames where depth data was captured.
170 #[unsafe(method(capturedDepthData))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn capturedDepthData(&self) -> Option<Retained<AVDepthData>>;
173
174 #[cfg(feature = "objc2-foundation")]
175 /// A timestamp identifying the depth data.
176 #[unsafe(method(capturedDepthDataTimestamp))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn capturedDepthDataTimestamp(&self) -> NSTimeInterval;
179
180 #[cfg(feature = "ARCamera")]
181 /// The camera used to capture the frame’s image.
182 ///
183 /// The camera provides the device’s position and orientation as well as camera parameters.
184 #[unsafe(method(camera))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn camera(&self) -> Retained<ARCamera>;
187
188 #[cfg(all(feature = "ARAnchor", feature = "objc2-foundation"))]
189 /// A list of anchors in the scene.
190 #[unsafe(method(anchors))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn anchors(&self) -> Retained<NSArray<ARAnchor>>;
193
194 #[cfg(feature = "ARLightEstimate")]
195 /// A light estimate representing the light in the scene.
196 ///
197 /// Returns nil if there is no light estimation.
198 #[unsafe(method(lightEstimate))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn lightEstimate(&self) -> Option<Retained<ARLightEstimate>>;
201
202 #[cfg(feature = "ARPointCloud")]
203 /// Feature points in the scene with respect to the frame’s origin.
204 ///
205 /// The feature points are only provided for configurations using world tracking.
206 #[unsafe(method(rawFeaturePoints))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn rawFeaturePoints(&self) -> Option<Retained<ARPointCloud>>;
209
210 /// The status of world mapping for the area visible to the frame.
211 ///
212 /// This can be used to identify the state of the world map for the visible area and if additional scanning
213 /// should be done before saving a world map.
214 #[unsafe(method(worldMappingStatus))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn worldMappingStatus(&self) -> ARWorldMappingStatus;
217
218 #[cfg(feature = "objc2-core-video")]
219 /// A buffer that represents the segmented content of the capturedImage.
220 ///
221 /// In order to identify to which class a pixel has been classified one needs to compare its intensity value with the values
222 /// found in `ARSegmentationClass`.
223 ///
224 /// See: ARSegmentationClass
225 ///
226 /// See: -[ARConfiguration setFrameSemantics:]
227 #[unsafe(method(segmentationBuffer))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn segmentationBuffer(&self) -> Option<Retained<CVPixelBuffer>>;
230
231 #[cfg(feature = "objc2-core-video")]
232 /// A buffer that represents the estimated depth values for a performed segmentation.
233 ///
234 /// For each non-background pixel in the segmentation buffer the corresponding depth value can be accessed in this buffer.
235 ///
236 /// See: -[ARConfiguration setFrameSemantics:]
237 ///
238 /// See: -[ARFrame segmentationBuffer]
239 #[unsafe(method(estimatedDepthData))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn estimatedDepthData(&self) -> Option<Retained<CVPixelBuffer>>;
242
243 #[cfg(feature = "ARBody2D")]
244 /// A detected body in the current frame.
245 ///
246 /// See: -[ARConfiguration setFrameSemantics:]
247 #[unsafe(method(detectedBody))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn detectedBody(&self) -> Option<Retained<ARBody2D>>;
250
251 #[cfg(feature = "ARGeoTrackingTypes")]
252 /// The status of geo tracking.
253 #[unsafe(method(geoTrackingStatus))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn geoTrackingStatus(&self) -> Option<Retained<ARGeoTrackingStatus>>;
256
257 #[cfg(feature = "ARDepthData")]
258 /// Scene depth data.
259 ///
260 /// See: ARFrameSemanticSceneDepth.
261 ///
262 /// See: -[ARConfiguration setFrameSemantics:]
263 #[unsafe(method(sceneDepth))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn sceneDepth(&self) -> Option<Retained<ARDepthData>>;
266
267 #[cfg(feature = "ARDepthData")]
268 /// Scene depth data, smoothed for temporal consistency.
269 ///
270 /// See: ARFrameSemanticSmoothedSceneDepth.
271 ///
272 /// See: -[ARConfiguration setFrameSemantics:]
273 #[unsafe(method(smoothedSceneDepth))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn smoothedSceneDepth(&self) -> Option<Retained<ARDepthData>>;
276
277 #[cfg(all(
278 feature = "ARHitTestResult",
279 feature = "objc2-core-foundation",
280 feature = "objc2-foundation"
281 ))]
282 /// Searches the frame for objects corresponding to a point in the captured image.
283 ///
284 ///
285 /// A 2D point in the captured image’s coordinate space can refer to any point along a line segment
286 /// in the 3D coordinate space. Hit-testing is the process of finding objects in the world located along this line segment.
287 ///
288 /// Parameter `point`: A point in the image-space coordinate system of the captured image.
289 /// Values should range from (0,0) - upper left corner to (1,1) - lower right corner.
290 ///
291 /// Parameter `types`: The types of results to search for.
292 ///
293 /// Returns: An array of all hit-test results sorted from nearest to farthest.
294 #[deprecated = "Use [ARSession raycast:]"]
295 #[unsafe(method(hitTest:types:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn hitTest_types(
298 &self,
299 point: CGPoint,
300 types: ARHitTestResultType,
301 ) -> Retained<NSArray<ARHitTestResult>>;
302
303 #[cfg(all(feature = "ARRaycastQuery", feature = "objc2-core-foundation"))]
304 /// Creates a raycast query originating from the point on the captured image, aligned along the center of the field of view of the camera.
305 ///
306 /// 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.
307 ///
308 /// Parameter `point`: A point in the image-space coordinate system of the captured image.
309 /// Values should range from (0,0) - upper left corner to (1,1) - lower right corner.
310 ///
311 /// Parameter `target`: Type of target where the ray should terminate.
312 ///
313 /// Parameter `alignment`: Alignment of the target.
314 #[unsafe(method(raycastQueryFromPoint:allowingTarget:alignment:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn raycastQueryFromPoint_allowingTarget_alignment(
317 &self,
318 point: CGPoint,
319 target: ARRaycastTarget,
320 alignment: ARRaycastTargetAlignment,
321 ) -> Retained<ARRaycastQuery>;
322
323 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-ui-kit"))]
324 /// Returns a display transform for the provided viewport size and orientation.
325 ///
326 ///
327 /// The display transform can be used to convert normalized points in the image-space coordinate system
328 /// of the captured image to normalized points in the view’s coordinate space. The transform provides the correct rotation
329 /// and aspect-fill for presenting the captured image in the given orientation and size.
330 ///
331 /// Parameter `orientation`: The orientation of the viewport.
332 ///
333 /// Parameter `viewportSize`: The size of the viewport.
334 #[unsafe(method(displayTransformForOrientation:viewportSize:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn displayTransformForOrientation_viewportSize(
337 &self,
338 orientation: UIInterfaceOrientation,
339 viewport_size: CGSize,
340 ) -> CGAffineTransform;
341
342 /// Unavailable
343 #[unsafe(method(init))]
344 #[unsafe(method_family = init)]
345 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
346
347 #[unsafe(method(new))]
348 #[unsafe(method_family = new)]
349 pub unsafe fn new() -> Retained<Self>;
350 );
351}