objc2_ar_kit/generated/
ARMatteGenerator.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-metal")]
7use objc2_metal::*;
8
9use crate::*;
10
11/// The resolution at which the matte is to be generated.
12///
13/// The matte generated per frame can be full resolution of the captured camera image or half resolution. The caller chooses one of the options from ARMatteResolution during initialization.
14///
15/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/armatteresolution?language=objc)
16// NS_ENUM
17#[cfg(feature = "objc2")]
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct ARMatteResolution(pub NSInteger);
21#[cfg(feature = "objc2")]
22impl ARMatteResolution {
23    #[doc(alias = "ARMatteResolutionFull")]
24    pub const Full: Self = Self(0);
25    #[doc(alias = "ARMatteResolutionHalf")]
26    pub const Half: Self = Self(1);
27}
28
29#[cfg(feature = "objc2")]
30unsafe impl Encode for ARMatteResolution {
31    const ENCODING: Encoding = NSInteger::ENCODING;
32}
33
34#[cfg(feature = "objc2")]
35unsafe impl RefEncode for ARMatteResolution {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39#[cfg(feature = "objc2")]
40extern_class!(
41    /// An object designed to generate either full resolution or half resolution matte given the ARFrame.
42    ///
43    /// The caller initializes the object once and calls the alpha matte generation API for every ARFrame with the captured image and segmentation stencil.
44    ///
45    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/armattegenerator?language=objc)
46    #[unsafe(super(NSObject))]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    #[cfg(feature = "objc2")]
49    pub struct ARMatteGenerator;
50);
51
52#[cfg(feature = "objc2")]
53extern_conformance!(
54    unsafe impl NSObjectProtocol for ARMatteGenerator {}
55);
56
57#[cfg(feature = "objc2")]
58impl ARMatteGenerator {
59    extern_methods!(
60        #[cfg(feature = "objc2-metal")]
61        /// Initializes an instance of ARMatteGenerator.
62        ///
63        ///
64        /// For efficient creation of alpha mattes in real time it is recommended to instantiate this object only once and to generate an alpha matte for every incoming frame.
65        ///
66        /// See: ARFrame
67        ///
68        /// See: -[ARMatteGenerator generateMatteFromFrame:commandBuffer:]
69        ///
70        /// Parameter `device`: The device the filter will run on.
71        ///
72        /// Parameter `matteResolution`: The resolution at which the matte is to be generated. Set using one of the values from 'ARMatteResolution'.
73        ///
74        /// See: ARMatteResolution
75        ///
76        /// Returns: Instance of ARMatteGenerator.
77        #[unsafe(method(initWithDevice:matteResolution:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithDevice_matteResolution(
80            this: Allocated<Self>,
81            device: &ProtocolObject<dyn MTLDevice>,
82            matte_resolution: ARMatteResolution,
83        ) -> Retained<Self>;
84
85        #[cfg(all(feature = "ARFrame", feature = "objc2-metal"))]
86        /// Generates alpha matte at either full resolution or half the resolution of the captured image.
87        ///
88        ///
89        /// Parameter `frame`: Current ARFrame containing camera image and segmentation stencil. The caller is to ensure that a valid segmentation buffer is present.
90        ///
91        /// Parameter `commandBuffer`: Metal command buffer for encoding matting related operations. The command buffer is committed by the caller externally.
92        ///
93        /// Returns: Alpha matte MTLTexture for the given ARFrame at full resolution or half resolution as chosen by the  caller during initialization.
94        #[unsafe(method(generateMatteFromFrame:commandBuffer:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn generateMatteFromFrame_commandBuffer(
97            &self,
98            frame: &ARFrame,
99            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
100        ) -> Retained<ProtocolObject<dyn MTLTexture>>;
101
102        #[cfg(all(feature = "ARFrame", feature = "objc2-metal"))]
103        /// Generates dilated depth at the resolution of the segmentation stencil.
104        ///
105        /// The caller can use depth information when compositing a virtual object with the captured scene. This API returns the dilated linear depth to the caller. The reprojection of this depth to the caller's scene space is carried out externally.
106        ///
107        /// Parameter `frame`: Current ARFrame containing camera image and estimated depth buffer. The caller is to ensure that a valid depth buffer is present.
108        ///
109        /// Parameter `commandBuffer`: Metal command buffer for encoding depth dilation operations. The command buffer is committed by the caller externally.
110        ///
111        /// Returns: Dilated depth MTLTexture for the given ARFrame at the segmentation stencil resolution. The texture consists of a single channel and is of type float16.
112        #[unsafe(method(generateDilatedDepthFromFrame:commandBuffer:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn generateDilatedDepthFromFrame_commandBuffer(
115            &self,
116            frame: &ARFrame,
117            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
118        ) -> Retained<ProtocolObject<dyn MTLTexture>>;
119
120        /// Unavailable
121        #[unsafe(method(init))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
124
125        #[unsafe(method(new))]
126        #[unsafe(method_family = new)]
127        pub unsafe fn new() -> Retained<Self>;
128    );
129}