objc2_vision/generated/VNUtils.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use objc2::__framework_prelude::*;
4#[cfg(feature = "objc2-core-foundation")]
5use objc2_core_foundation::*;
6
7use crate::*;
8
9extern "C" {
10 /// The normalized identity rect of { {0, 0}, {1, 1} }.
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnnormalizedidentityrect?language=objc)
13 #[cfg(feature = "objc2-core-foundation")]
14 pub static VNNormalizedIdentityRect: CGRect;
15}
16
17extern "C-unwind" {
18 /// Determines whether or not the normalized rect describes the identity rect of { {0, 0}, {1, 1} }.
19 ///
20 ///
21 /// Parameter `normalizedRect`: The rectangle in the normalized coordinate space of [0..1].
22 ///
23 ///
24 /// Returns: YES if the rect is the identity rect; otherwise, NO.
25 #[cfg(feature = "objc2-core-foundation")]
26 pub fn VNNormalizedRectIsIdentityRect(normalized_rect: CGRect) -> bool;
27}
28
29extern "C-unwind" {
30 /// Returns a point in (possibly non-integral) image coordinates that is projected from a point in a normalized coordinate space.
31 ///
32 ///
33 /// Parameter `normalizedPoint`: The point in the normalized coordinate space of [0..1].
34 ///
35 ///
36 /// Parameter `imageWidth`: The pixel width of the image.
37 ///
38 ///
39 /// Parameter `imageHeight`: The pixel height of the image.
40 ///
41 ///
42 /// Returns: the point in image coordinates.
43 #[cfg(feature = "objc2-core-foundation")]
44 pub fn VNImagePointForNormalizedPoint(
45 normalized_point: CGPoint,
46 image_width: usize,
47 image_height: usize,
48 ) -> CGPoint;
49}
50
51extern "C-unwind" {
52 /// Returns a point in (possibly non-integral) image coordinates that is projected from a point in a normalized coordinate space taking the region of interest (roi) into account.
53 ///
54 ///
55 /// Parameter `normalizedPoint`: The point in the normalized coordinate space of [0..1].
56 ///
57 ///
58 /// Parameter `imageWidth`: The pixel width of the image.
59 ///
60 ///
61 /// Parameter `imageHeight`: The pixel height of the image.
62 ///
63 ///
64 /// Parameter `roi`: The region of interest on which the normalized point was based on.
65 ///
66 ///
67 /// Returns: the point in image coordinates from a normalized point that was reported in relation to a region of interest.
68 #[cfg(feature = "objc2-core-foundation")]
69 pub fn VNImagePointForNormalizedPointUsingRegionOfInterest(
70 normalized_point: CGPoint,
71 image_width: usize,
72 image_height: usize,
73 roi: CGRect,
74 ) -> CGPoint;
75}
76
77extern "C-unwind" {
78 /// Returns a point in normalized coordinate space that is projected from a point in a image coordinates
79 ///
80 ///
81 /// Parameter `imagePoint`: The point in image coordinate space.
82 ///
83 ///
84 /// Parameter `imageWidth`: The pixel width of the image.
85 ///
86 ///
87 /// Parameter `imageHeight`: The pixel height of the image.
88 ///
89 ///
90 /// Returns: the point in normalized coordinates.
91 #[cfg(feature = "objc2-core-foundation")]
92 pub fn VNNormalizedPointForImagePoint(
93 image_point: CGPoint,
94 image_width: usize,
95 image_height: usize,
96 ) -> CGPoint;
97}
98
99extern "C-unwind" {
100 /// Returns a point in normalized coordinate space within a spedified regioin of interest (roi) that is projected from a point in a image coordinates
101 ///
102 ///
103 /// Parameter `imagePoint`: The point in image coordinate space.
104 ///
105 ///
106 /// Parameter `imageWidth`: The pixel width of the image.
107 ///
108 ///
109 /// Parameter `imageHeight`: The pixel height of the image.
110 ///
111 ///
112 /// Parameter `roi`: The region of interest on which the normalized point will based on.
113 ///
114 ///
115 /// Returns: the point in normalized coordinates in relation to the region of interest.
116 #[cfg(feature = "objc2-core-foundation")]
117 pub fn VNNormalizedPointForImagePointUsingRegionOfInterest(
118 image_point: CGPoint,
119 image_width: usize,
120 image_height: usize,
121 roi: CGRect,
122 ) -> CGPoint;
123}
124
125extern "C-unwind" {
126 /// Returns a rectangle in (possibly non-integral) image coordinates that is projected from a rectangle in a normalized coordinate space.
127 ///
128 ///
129 /// Parameter `normalizedRect`: The rectangle in the normalized coordinate space of [0..1].
130 ///
131 ///
132 /// Parameter `imageWidth`: The pixel width of the image.
133 ///
134 ///
135 /// Parameter `imageHeight`: The pixel height of the image.
136 ///
137 ///
138 /// Returns: the rectangle in pixel coordinates.
139 #[cfg(feature = "objc2-core-foundation")]
140 pub fn VNImageRectForNormalizedRect(
141 normalized_rect: CGRect,
142 image_width: usize,
143 image_height: usize,
144 ) -> CGRect;
145}
146
147extern "C-unwind" {
148 /// Returns a rectangle in (possibly non-integral) image coordinates that is projected from a rectangle in a normalized coordinate space taking the region of interest (roi) into account.
149 ///
150 ///
151 /// Parameter `normalizedRect`: The rectangle in the normalized coordinate space of [0..1].
152 ///
153 ///
154 /// Parameter `imageWidth`: The pixel width of the image.
155 ///
156 ///
157 /// Parameter `imageHeight`: The pixel height of the image.
158 ///
159 ///
160 /// Parameter `roi`: The region of interest on which the normalized point was based on.
161 ///
162 ///
163 /// Returns: the rectangle in pixel coordinates from a normalized rectangle that was reported in relation to a region of interest.
164 #[cfg(feature = "objc2-core-foundation")]
165 pub fn VNImageRectForNormalizedRectUsingRegionOfInterest(
166 normalized_rect: CGRect,
167 image_width: usize,
168 image_height: usize,
169 roi: CGRect,
170 ) -> CGRect;
171}
172
173extern "C-unwind" {
174 /// Returns an image rectangle in normalized coordinates.
175 ///
176 ///
177 /// Parameter `imageRect`: The rectangle in image coordinate space.
178 ///
179 ///
180 /// Parameter `imageWidth`: The pixel width of the image.
181 ///
182 ///
183 /// Parameter `imageHeight`: The pixel height of the image.
184 ///
185 ///
186 /// Returns: the normalized rectangle.
187 #[cfg(feature = "objc2-core-foundation")]
188 pub fn VNNormalizedRectForImageRect(
189 image_rect: CGRect,
190 image_width: usize,
191 image_height: usize,
192 ) -> CGRect;
193}
194
195extern "C-unwind" {
196 /// Returns an image rectangle in normalized coordinates in relation to the region of interest.
197 ///
198 ///
199 /// Parameter `imageRect`: The rectangle in image coordinate space.
200 ///
201 ///
202 /// Parameter `imageWidth`: The pixel width of the image.
203 ///
204 ///
205 /// Parameter `imageHeight`: The pixel height of the image.
206 ///
207 ///
208 /// Parameter `roi`: The region of interest on which the normalized rect will be based on.
209 ///
210 ///
211 /// Returns: the normalized rectangle in relation to the region of interest.
212 #[cfg(feature = "objc2-core-foundation")]
213 pub fn VNNormalizedRectForImageRectUsingRegionOfInterest(
214 image_rect: CGRect,
215 image_width: usize,
216 image_height: usize,
217 roi: CGRect,
218 ) -> CGRect;
219}
220
221#[cfg(feature = "VNTypes")]
222impl VNElementType {
223 /// Obtain the size, in bytes, of a given element type.
224 ///
225 ///
226 /// Parameter `elementType`: The element type.
227 ///
228 ///
229 /// Returns: a byte count, or 0 if the element type is unknown.
230 #[doc(alias = "VNElementTypeSize")]
231 #[cfg(feature = "VNTypes")]
232 #[inline]
233 pub unsafe fn size(self: VNElementType) -> NSUInteger {
234 extern "C-unwind" {
235 fn VNElementTypeSize(element_type: VNElementType) -> NSUInteger;
236 }
237 unsafe { VNElementTypeSize(self) }
238 }
239}
240
241extern "C-unwind" {
242 #[cfg(feature = "VNTypes")]
243 #[deprecated = "renamed to `VNElementType::size`"]
244 pub fn VNElementTypeSize(element_type: VNElementType) -> NSUInteger;
245}