objc2_ar_kit/generated/ARReferenceImage.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-core-foundation")]
8use objc2_core_foundation::*;
9#[cfg(feature = "objc2-core-graphics")]
10use objc2_core_graphics::*;
11#[cfg(feature = "objc2-core-video")]
12use objc2_core_video::*;
13#[cfg(feature = "objc2-foundation")]
14use objc2_foundation::*;
15#[cfg(feature = "objc2-image-io")]
16use objc2_image_io::*;
17
18use crate::*;
19
20#[cfg(feature = "objc2")]
21extern_class!(
22 /// A reference image to be detected in the scene.
23 ///
24 /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arreferenceimage?language=objc)
25 #[unsafe(super(NSObject))]
26 #[derive(Debug, PartialEq, Eq, Hash)]
27 #[cfg(feature = "objc2")]
28 pub struct ARReferenceImage;
29);
30
31#[cfg(feature = "objc2")]
32unsafe impl Send for ARReferenceImage {}
33
34#[cfg(feature = "objc2")]
35unsafe impl Sync for ARReferenceImage {}
36
37#[cfg(feature = "objc2")]
38extern_conformance!(
39 unsafe impl NSObjectProtocol for ARReferenceImage {}
40);
41
42#[cfg(feature = "objc2")]
43impl ARReferenceImage {
44 extern_methods!(
45 #[cfg(feature = "objc2-foundation")]
46 /// An optional name used to identify the image.
47 ///
48 /// This property is not atomic.
49 ///
50 /// # Safety
51 ///
52 /// This might not be thread-safe.
53 #[unsafe(method(name))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn name(&self) -> Option<Retained<NSString>>;
56
57 #[cfg(feature = "objc2-foundation")]
58 /// Setter for [`name`][Self::name].
59 ///
60 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
61 ///
62 /// # Safety
63 ///
64 /// This might not be thread-safe.
65 #[unsafe(method(setName:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn setName(&self, name: Option<&NSString>);
68
69 #[cfg(feature = "objc2-core-foundation")]
70 /// The physical size of the image in meters.
71 ///
72 /// This property is not atomic.
73 ///
74 /// # Safety
75 ///
76 /// This might not be thread-safe.
77 #[unsafe(method(physicalSize))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn physicalSize(&self) -> CGSize;
80
81 #[cfg(feature = "objc2-foundation")]
82 /// The AR resource group name for this image.
83 ///
84 /// If this image was loaded via an AR resource group in the Xcode asset catalogue this property will have the name of the resource group,
85 /// else be set to nil.
86 ///
87 /// This property is not atomic.
88 ///
89 /// # Safety
90 ///
91 /// This might not be thread-safe.
92 #[unsafe(method(resourceGroupName))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn resourceGroupName(&self) -> Option<Retained<NSString>>;
95
96 #[cfg(all(feature = "block2", feature = "objc2-foundation"))]
97 /// Validate if this image can be used for image detection or tracking.
98 ///
99 /// When loading reference images from the asset catalog this verification is not needed as the same verification happens
100 /// at compile time.
101 ///
102 /// Parameter `completionHandler`: Completion handler invoked when validation is done. The completion handler takes the following parameters:
103 /// error - An error that indicates why the image is not suitable for tracking, or nil if no error occurred.
104 #[unsafe(method(validateWithCompletionHandler:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn validateWithCompletionHandler(
107 &self,
108 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
109 );
110
111 #[cfg(all(
112 feature = "objc2-core-foundation",
113 feature = "objc2-core-graphics",
114 feature = "objc2-image-io"
115 ))]
116 /// Creates a new reference image.
117 ///
118 ///
119 /// Parameter `image`: The reference image as CGImage.
120 ///
121 /// Parameter `orientation`: The image orientation.
122 ///
123 /// Parameter `physicalWidth`: The width in meters of the physical object.
124 #[unsafe(method(initWithCGImage:orientation:physicalWidth:))]
125 #[unsafe(method_family = init)]
126 pub unsafe fn initWithCGImage_orientation_physicalWidth(
127 this: Allocated<Self>,
128 image: &CGImage,
129 orientation: CGImagePropertyOrientation,
130 physical_width: CGFloat,
131 ) -> Retained<Self>;
132
133 #[cfg(all(
134 feature = "objc2-core-foundation",
135 feature = "objc2-core-video",
136 feature = "objc2-image-io"
137 ))]
138 /// Creates a new reference image.
139 ///
140 ///
141 /// Parameter `pixelBuffer`: The reference image as CVPixelBuffer.
142 ///
143 /// Parameter `physicalWidth`: The width in meters of the physical object.
144 ///
145 /// Parameter `orientation`: The image orientation.
146 #[unsafe(method(initWithPixelBuffer:orientation:physicalWidth:))]
147 #[unsafe(method_family = init)]
148 pub unsafe fn initWithPixelBuffer_orientation_physicalWidth(
149 this: Allocated<Self>,
150 pixel_buffer: &CVPixelBuffer,
151 orientation: CGImagePropertyOrientation,
152 physical_width: CGFloat,
153 ) -> Retained<Self>;
154
155 #[cfg(feature = "objc2-foundation")]
156 /// Returns the set of ARReferenceImages in the specified resource group and bundle.
157 ///
158 ///
159 /// Parameter `name`: The name of the resource group.
160 ///
161 /// Parameter `bundle`: The bundle containing the image file or asset catalog. Specify nil to search the app’s main bundle.
162 ///
163 /// Returns: The set of reference images or nil on error.
164 #[unsafe(method(referenceImagesInGroupNamed:bundle:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn referenceImagesInGroupNamed_bundle(
167 name: &NSString,
168 bundle: Option<&NSBundle>,
169 ) -> Option<Retained<NSSet<ARReferenceImage>>>;
170
171 /// Unavailable
172 #[unsafe(method(init))]
173 #[unsafe(method_family = init)]
174 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
175
176 #[unsafe(method(new))]
177 #[unsafe(method_family = new)]
178 pub unsafe fn new() -> Retained<Self>;
179 );
180}