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