objc2_metal_performance_shaders/generated/MPSImage/
MPSImageStatistics.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7use objc2_metal::*;
8
9use crate::*;
10
11extern_class!(
12    /// The MPSImageStatisticsMinAndMax computes the minimum and maximum pixel values for a given region of an image.
13    /// The min and max values are written to the destination image at the following pixel locations:
14    /// - min value is written at pixel location (0, 0)
15    /// - max value is written at pixel location (1, 0)
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagestatisticsminandmax?language=objc)
18    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
21    pub struct MPSImageStatisticsMinAndMax;
22);
23
24#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
25extern_conformance!(
26    unsafe impl NSCoding for MPSImageStatisticsMinAndMax {}
27);
28
29#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
30extern_conformance!(
31    unsafe impl NSCopying for MPSImageStatisticsMinAndMax {}
32);
33
34#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
35unsafe impl CopyingHelper for MPSImageStatisticsMinAndMax {
36    type Result = Self;
37}
38
39#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
40extern_conformance!(
41    unsafe impl NSObjectProtocol for MPSImageStatisticsMinAndMax {}
42);
43
44#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
45extern_conformance!(
46    unsafe impl NSSecureCoding for MPSImageStatisticsMinAndMax {}
47);
48
49#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
50impl MPSImageStatisticsMinAndMax {
51    extern_methods!(
52        /// The source rectangle to use when reading data.
53        ///
54        /// A MTLRegion that indicates which part of the source to read. If the clipRectSource does not lie
55        /// completely within the source image, the intersection of the image bounds and clipRectSource will
56        /// be used. The clipRectSource replaces the MPSUnaryImageKernel offset parameter for this filter.
57        /// The latter is ignored.   Default: MPSRectNoClip, use the entire source texture.
58        ///
59        /// The clipRect specified in MPSUnaryImageKernel is used to control the origin in the destination texture
60        /// where the min, max values are written.  The clipRect.width must be >=2.  The clipRect.height must be >= 1.
61        #[unsafe(method(clipRectSource))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn clipRectSource(&self) -> MTLRegion;
64
65        /// Setter for [`clipRectSource`][Self::clipRectSource].
66        #[unsafe(method(setClipRectSource:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setClipRectSource(&self, clip_rect_source: MTLRegion);
69
70        /// Specifies information to apply the statistics min-max operation on an image.
71        ///
72        /// Parameter `device`: The device the filter will run on
73        ///
74        /// Returns: A valid MPSImageStatisticsMinAndMax object or nil, if failure.
75        #[unsafe(method(initWithDevice:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithDevice(
78            this: Allocated<Self>,
79            device: &ProtocolObject<dyn MTLDevice>,
80        ) -> Retained<Self>;
81
82        /// NSSecureCoding compatability
83        ///
84        /// While the standard NSSecureCoding/NSCoding method
85        /// -initWithCoder: should work, since the file can't
86        /// know which device your data is allocated on, we
87        /// have to guess and may guess incorrectly.  To avoid
88        /// that problem, use initWithCoder:device instead.
89        ///
90        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
91        ///
92        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
93        ///
94        /// Returns: A new MPSKernel object, or nil if failure.
95        ///
96        /// # Safety
97        ///
98        /// `a_decoder` possibly has further requirements.
99        #[unsafe(method(initWithCoder:device:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithCoder_device(
102            this: Allocated<Self>,
103            a_decoder: &NSCoder,
104            device: &ProtocolObject<dyn MTLDevice>,
105        ) -> Option<Retained<Self>>;
106    );
107}
108
109/// Methods declared on superclass `MPSKernel`.
110#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
111impl MPSImageStatisticsMinAndMax {
112    extern_methods!(
113        /// Called by NSCoder to decode MPSKernels
114        ///
115        /// This isn't the right interface to decode a MPSKernel, but
116        /// it is the one that NSCoder uses. To enable your NSCoder
117        /// (e.g. NSKeyedUnarchiver) to set which device to use
118        /// extend the object to adopt the MPSDeviceProvider
119        /// protocol. Otherwise, the Metal system default device
120        /// will be used.
121        ///
122        /// # Safety
123        ///
124        /// `a_decoder` possibly has further requirements.
125        #[unsafe(method(initWithCoder:))]
126        #[unsafe(method_family = init)]
127        pub unsafe fn initWithCoder(
128            this: Allocated<Self>,
129            a_decoder: &NSCoder,
130        ) -> Option<Retained<Self>>;
131    );
132}
133
134/// Methods declared on superclass `NSObject`.
135#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
136impl MPSImageStatisticsMinAndMax {
137    extern_methods!(
138        #[unsafe(method(init))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
141
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new() -> Retained<Self>;
145    );
146}
147
148extern_class!(
149    /// The MPSImageStatisticsMeanAndVariance computes the mean and variance for a given region of an image.
150    /// The mean and variance values are written to the destination image at the following pixel locations:
151    /// - mean value is written at pixel location (0, 0)
152    /// - variance value is written at pixel location (1, 0)
153    ///
154    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagestatisticsmeanandvariance?language=objc)
155    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
156    #[derive(Debug, PartialEq, Eq, Hash)]
157    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
158    pub struct MPSImageStatisticsMeanAndVariance;
159);
160
161#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
162extern_conformance!(
163    unsafe impl NSCoding for MPSImageStatisticsMeanAndVariance {}
164);
165
166#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
167extern_conformance!(
168    unsafe impl NSCopying for MPSImageStatisticsMeanAndVariance {}
169);
170
171#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
172unsafe impl CopyingHelper for MPSImageStatisticsMeanAndVariance {
173    type Result = Self;
174}
175
176#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
177extern_conformance!(
178    unsafe impl NSObjectProtocol for MPSImageStatisticsMeanAndVariance {}
179);
180
181#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
182extern_conformance!(
183    unsafe impl NSSecureCoding for MPSImageStatisticsMeanAndVariance {}
184);
185
186#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
187impl MPSImageStatisticsMeanAndVariance {
188    extern_methods!(
189        /// The source rectangle to use when reading data.
190        ///
191        /// A MTLRegion that indicates which part of the source to read. If the clipRectSource does not lie
192        /// completely within the source image, the intersection of the image bounds and clipRectSource will
193        /// be used. The clipRectSource replaces the MPSUnaryImageKernel offset parameter for this filter.
194        /// The latter is ignored.   Default: MPSRectNoClip, use the entire source texture.
195        ///
196        /// The clipRect specified in MPSUnaryImageKernel is used to control the origin in the destination texture
197        /// where the mean value is written.
198        #[unsafe(method(clipRectSource))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn clipRectSource(&self) -> MTLRegion;
201
202        /// Setter for [`clipRectSource`][Self::clipRectSource].
203        #[unsafe(method(setClipRectSource:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setClipRectSource(&self, clip_rect_source: MTLRegion);
206
207        /// Specifies information to apply the statistics mean operation on an image.
208        ///
209        /// Parameter `device`: The device the filter will run on
210        ///
211        /// Returns: A valid MPSImageStatisticsMeanAndVariance object or nil, if failure.
212        #[unsafe(method(initWithDevice:))]
213        #[unsafe(method_family = init)]
214        pub unsafe fn initWithDevice(
215            this: Allocated<Self>,
216            device: &ProtocolObject<dyn MTLDevice>,
217        ) -> Retained<Self>;
218
219        /// NSSecureCoding compatability
220        ///
221        /// While the standard NSSecureCoding/NSCoding method
222        /// -initWithCoder: should work, since the file can't
223        /// know which device your data is allocated on, we
224        /// have to guess and may guess incorrectly.  To avoid
225        /// that problem, use initWithCoder:device instead.
226        ///
227        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
228        ///
229        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
230        ///
231        /// Returns: A new MPSKernel object, or nil if failure.
232        ///
233        /// # Safety
234        ///
235        /// `a_decoder` possibly has further requirements.
236        #[unsafe(method(initWithCoder:device:))]
237        #[unsafe(method_family = init)]
238        pub unsafe fn initWithCoder_device(
239            this: Allocated<Self>,
240            a_decoder: &NSCoder,
241            device: &ProtocolObject<dyn MTLDevice>,
242        ) -> Option<Retained<Self>>;
243    );
244}
245
246/// Methods declared on superclass `MPSKernel`.
247#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
248impl MPSImageStatisticsMeanAndVariance {
249    extern_methods!(
250        /// Called by NSCoder to decode MPSKernels
251        ///
252        /// This isn't the right interface to decode a MPSKernel, but
253        /// it is the one that NSCoder uses. To enable your NSCoder
254        /// (e.g. NSKeyedUnarchiver) to set which device to use
255        /// extend the object to adopt the MPSDeviceProvider
256        /// protocol. Otherwise, the Metal system default device
257        /// will be used.
258        ///
259        /// # Safety
260        ///
261        /// `a_decoder` possibly has further requirements.
262        #[unsafe(method(initWithCoder:))]
263        #[unsafe(method_family = init)]
264        pub unsafe fn initWithCoder(
265            this: Allocated<Self>,
266            a_decoder: &NSCoder,
267        ) -> Option<Retained<Self>>;
268    );
269}
270
271/// Methods declared on superclass `NSObject`.
272#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
273impl MPSImageStatisticsMeanAndVariance {
274    extern_methods!(
275        #[unsafe(method(init))]
276        #[unsafe(method_family = init)]
277        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
278
279        #[unsafe(method(new))]
280        #[unsafe(method_family = new)]
281        pub unsafe fn new() -> Retained<Self>;
282    );
283}
284
285extern_class!(
286    /// The MPSImageStatisticsMean computes the mean for a given region of an image.
287    ///
288    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagestatisticsmean?language=objc)
289    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
290    #[derive(Debug, PartialEq, Eq, Hash)]
291    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
292    pub struct MPSImageStatisticsMean;
293);
294
295#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
296extern_conformance!(
297    unsafe impl NSCoding for MPSImageStatisticsMean {}
298);
299
300#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
301extern_conformance!(
302    unsafe impl NSCopying for MPSImageStatisticsMean {}
303);
304
305#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
306unsafe impl CopyingHelper for MPSImageStatisticsMean {
307    type Result = Self;
308}
309
310#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
311extern_conformance!(
312    unsafe impl NSObjectProtocol for MPSImageStatisticsMean {}
313);
314
315#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
316extern_conformance!(
317    unsafe impl NSSecureCoding for MPSImageStatisticsMean {}
318);
319
320#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
321impl MPSImageStatisticsMean {
322    extern_methods!(
323        /// The source rectangle to use when reading data.
324        ///
325        /// A MTLRegion that indicates which part of the source to read. If the clipRectSource does not lie
326        /// completely within the source image, the intersection of the image bounds and clipRectSource will
327        /// be used. The clipRectSource replaces the MPSUnaryImageKernel offset parameter for this filter.
328        /// The latter is ignored.   Default: MPSRectNoClip, use the entire source texture.
329        ///
330        /// The clipRect specified in MPSUnaryImageKernel is used to control the origin in the destination texture
331        /// where the mean value is written.
332        #[unsafe(method(clipRectSource))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn clipRectSource(&self) -> MTLRegion;
335
336        /// Setter for [`clipRectSource`][Self::clipRectSource].
337        #[unsafe(method(setClipRectSource:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn setClipRectSource(&self, clip_rect_source: MTLRegion);
340
341        /// Specifies information to apply the statistics mean operation on an image.
342        ///
343        /// Parameter `device`: The device the filter will run on
344        ///
345        /// Returns: A valid MPSImageStatisticsMean object or nil, if failure.
346        #[unsafe(method(initWithDevice:))]
347        #[unsafe(method_family = init)]
348        pub unsafe fn initWithDevice(
349            this: Allocated<Self>,
350            device: &ProtocolObject<dyn MTLDevice>,
351        ) -> Retained<Self>;
352
353        /// NSSecureCoding compatability
354        ///
355        /// While the standard NSSecureCoding/NSCoding method
356        /// -initWithCoder: should work, since the file can't
357        /// know which device your data is allocated on, we
358        /// have to guess and may guess incorrectly.  To avoid
359        /// that problem, use initWithCoder:device instead.
360        ///
361        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
362        ///
363        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
364        ///
365        /// Returns: A new MPSKernel object, or nil if failure.
366        ///
367        /// # Safety
368        ///
369        /// `a_decoder` possibly has further requirements.
370        #[unsafe(method(initWithCoder:device:))]
371        #[unsafe(method_family = init)]
372        pub unsafe fn initWithCoder_device(
373            this: Allocated<Self>,
374            a_decoder: &NSCoder,
375            device: &ProtocolObject<dyn MTLDevice>,
376        ) -> Option<Retained<Self>>;
377    );
378}
379
380/// Methods declared on superclass `MPSKernel`.
381#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
382impl MPSImageStatisticsMean {
383    extern_methods!(
384        /// Called by NSCoder to decode MPSKernels
385        ///
386        /// This isn't the right interface to decode a MPSKernel, but
387        /// it is the one that NSCoder uses. To enable your NSCoder
388        /// (e.g. NSKeyedUnarchiver) to set which device to use
389        /// extend the object to adopt the MPSDeviceProvider
390        /// protocol. Otherwise, the Metal system default device
391        /// will be used.
392        ///
393        /// # Safety
394        ///
395        /// `a_decoder` possibly has further requirements.
396        #[unsafe(method(initWithCoder:))]
397        #[unsafe(method_family = init)]
398        pub unsafe fn initWithCoder(
399            this: Allocated<Self>,
400            a_decoder: &NSCoder,
401        ) -> Option<Retained<Self>>;
402    );
403}
404
405/// Methods declared on superclass `NSObject`.
406#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
407impl MPSImageStatisticsMean {
408    extern_methods!(
409        #[unsafe(method(init))]
410        #[unsafe(method_family = init)]
411        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
412
413        #[unsafe(method(new))]
414        #[unsafe(method_family = new)]
415        pub unsafe fn new() -> Retained<Self>;
416    );
417}