objc2_metal_performance_shaders/generated/MPSImage/
MPSImageIntegral.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6use objc2_metal::*;
7
8use crate::*;
9
10extern_class!(
11    /// The MPSImageIntegral calculates the sum of pixels over a specified region in the image.
12    /// The value at each position is the sum of all pixels in a source image rectangle, sumRect:
13    ///
14    /// sumRect.origin = MPSUnaryImageKernel.offset
15    /// sumRect.size = dest_position - MPSUnaryImageKernel.clipRect.origin
16    ///
17    /// If the channels in the source image are normalized, half-float or floating values,
18    /// the destination image is recommended to be a 32-bit floating-point image.
19    /// If the channels in the source image are integer values, it is recommended that
20    /// an appropriate 32-bit integer image destination format is used.
21    ///
22    /// This kernel accepts uint and int textures in addition to unorm and floating-point textures.
23    ///
24    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageintegral?language=objc)
25    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
26    #[derive(Debug, PartialEq, Eq, Hash)]
27    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
28    pub struct MPSImageIntegral;
29);
30
31#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
32extern_conformance!(
33    unsafe impl NSCoding for MPSImageIntegral {}
34);
35
36#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
37extern_conformance!(
38    unsafe impl NSCopying for MPSImageIntegral {}
39);
40
41#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
42unsafe impl CopyingHelper for MPSImageIntegral {
43    type Result = Self;
44}
45
46#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
47extern_conformance!(
48    unsafe impl NSObjectProtocol for MPSImageIntegral {}
49);
50
51#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
52extern_conformance!(
53    unsafe impl NSSecureCoding for MPSImageIntegral {}
54);
55
56#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
57impl MPSImageIntegral {
58    extern_methods!();
59}
60
61/// Methods declared on superclass `MPSUnaryImageKernel`.
62#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
63impl MPSImageIntegral {
64    extern_methods!(
65        /// Standard init with default properties per filter type
66        ///
67        /// Parameter `device`: The device that the filter will be used on. May not be NULL.
68        ///
69        /// Returns: a pointer to the newly initialized object. This will fail, returning
70        /// nil if the device is not supported. Devices must be
71        /// MTLFeatureSet_iOS_GPUFamily2_v1 or later.
72        #[unsafe(method(initWithDevice:))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn initWithDevice(
75            this: Allocated<Self>,
76            device: &ProtocolObject<dyn MTLDevice>,
77        ) -> Retained<Self>;
78
79        /// NSSecureCoding compatability
80        ///
81        /// While the standard NSSecureCoding/NSCoding method
82        /// -initWithCoder: should work, since the file can't
83        /// know which device your data is allocated on, we
84        /// have to guess and may guess incorrectly.  To avoid
85        /// that problem, use initWithCoder:device instead.
86        ///
87        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
88        ///
89        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
90        ///
91        /// Returns: A new MPSKernel object, or nil if failure.
92        ///
93        /// # Safety
94        ///
95        /// `a_decoder` possibly has further requirements.
96        #[unsafe(method(initWithCoder:device:))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn initWithCoder_device(
99            this: Allocated<Self>,
100            a_decoder: &NSCoder,
101            device: &ProtocolObject<dyn MTLDevice>,
102        ) -> Option<Retained<Self>>;
103    );
104}
105
106/// Methods declared on superclass `MPSKernel`.
107#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
108impl MPSImageIntegral {
109    extern_methods!(
110        /// Called by NSCoder to decode MPSKernels
111        ///
112        /// This isn't the right interface to decode a MPSKernel, but
113        /// it is the one that NSCoder uses. To enable your NSCoder
114        /// (e.g. NSKeyedUnarchiver) to set which device to use
115        /// extend the object to adopt the MPSDeviceProvider
116        /// protocol. Otherwise, the Metal system default device
117        /// will be used.
118        ///
119        /// # Safety
120        ///
121        /// `a_decoder` possibly has further requirements.
122        #[unsafe(method(initWithCoder:))]
123        #[unsafe(method_family = init)]
124        pub unsafe fn initWithCoder(
125            this: Allocated<Self>,
126            a_decoder: &NSCoder,
127        ) -> Option<Retained<Self>>;
128    );
129}
130
131/// Methods declared on superclass `NSObject`.
132#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
133impl MPSImageIntegral {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138
139        #[unsafe(method(new))]
140        #[unsafe(method_family = new)]
141        pub unsafe fn new() -> Retained<Self>;
142    );
143}
144
145extern_class!(
146    /// The MPSImageIntegralOfSquares calculates the sum of squared pixels over a specified region in the image.
147    /// The value at each position is the sum of all squared pixels in a source image rectangle, sumRect:
148    ///
149    /// sumRect.origin = MPSUnaryImageKernel.offset
150    /// sumRect.size = dest_position - MPSUnaryImageKernel.clipRect.origin
151    ///
152    /// If the channels in the source image are normalized, half-float or floating values,
153    /// the destination image is recommended to be a 32-bit floating-point image.
154    /// If the channels in the source image are integer values, it is recommended that
155    /// an appropriate 32-bit integer image destination format is used.
156    ///
157    /// This kernel accepts uint and int textures in addition to unorm and floating-point textures.
158    ///
159    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageintegralofsquares?language=objc)
160    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
161    #[derive(Debug, PartialEq, Eq, Hash)]
162    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
163    pub struct MPSImageIntegralOfSquares;
164);
165
166#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
167extern_conformance!(
168    unsafe impl NSCoding for MPSImageIntegralOfSquares {}
169);
170
171#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
172extern_conformance!(
173    unsafe impl NSCopying for MPSImageIntegralOfSquares {}
174);
175
176#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
177unsafe impl CopyingHelper for MPSImageIntegralOfSquares {
178    type Result = Self;
179}
180
181#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
182extern_conformance!(
183    unsafe impl NSObjectProtocol for MPSImageIntegralOfSquares {}
184);
185
186#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
187extern_conformance!(
188    unsafe impl NSSecureCoding for MPSImageIntegralOfSquares {}
189);
190
191#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
192impl MPSImageIntegralOfSquares {
193    extern_methods!();
194}
195
196/// Methods declared on superclass `MPSUnaryImageKernel`.
197#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
198impl MPSImageIntegralOfSquares {
199    extern_methods!(
200        /// Standard init with default properties per filter type
201        ///
202        /// Parameter `device`: The device that the filter will be used on. May not be NULL.
203        ///
204        /// Returns: a pointer to the newly initialized object. This will fail, returning
205        /// nil if the device is not supported. Devices must be
206        /// MTLFeatureSet_iOS_GPUFamily2_v1 or later.
207        #[unsafe(method(initWithDevice:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithDevice(
210            this: Allocated<Self>,
211            device: &ProtocolObject<dyn MTLDevice>,
212        ) -> Retained<Self>;
213
214        /// NSSecureCoding compatability
215        ///
216        /// While the standard NSSecureCoding/NSCoding method
217        /// -initWithCoder: should work, since the file can't
218        /// know which device your data is allocated on, we
219        /// have to guess and may guess incorrectly.  To avoid
220        /// that problem, use initWithCoder:device instead.
221        ///
222        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
223        ///
224        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
225        ///
226        /// Returns: A new MPSKernel object, or nil if failure.
227        ///
228        /// # Safety
229        ///
230        /// `a_decoder` possibly has further requirements.
231        #[unsafe(method(initWithCoder:device:))]
232        #[unsafe(method_family = init)]
233        pub unsafe fn initWithCoder_device(
234            this: Allocated<Self>,
235            a_decoder: &NSCoder,
236            device: &ProtocolObject<dyn MTLDevice>,
237        ) -> Option<Retained<Self>>;
238    );
239}
240
241/// Methods declared on superclass `MPSKernel`.
242#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
243impl MPSImageIntegralOfSquares {
244    extern_methods!(
245        /// Called by NSCoder to decode MPSKernels
246        ///
247        /// This isn't the right interface to decode a MPSKernel, but
248        /// it is the one that NSCoder uses. To enable your NSCoder
249        /// (e.g. NSKeyedUnarchiver) to set which device to use
250        /// extend the object to adopt the MPSDeviceProvider
251        /// protocol. Otherwise, the Metal system default device
252        /// will be used.
253        ///
254        /// # Safety
255        ///
256        /// `a_decoder` possibly has further requirements.
257        #[unsafe(method(initWithCoder:))]
258        #[unsafe(method_family = init)]
259        pub unsafe fn initWithCoder(
260            this: Allocated<Self>,
261            a_decoder: &NSCoder,
262        ) -> Option<Retained<Self>>;
263    );
264}
265
266/// Methods declared on superclass `NSObject`.
267#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
268impl MPSImageIntegralOfSquares {
269    extern_methods!(
270        #[unsafe(method(init))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
273
274        #[unsafe(method(new))]
275        #[unsafe(method_family = new)]
276        pub unsafe fn new() -> Retained<Self>;
277    );
278}