objc2_metal_performance_shaders/generated/MPSImage/
MPSImageMorphology.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 MPSImageAreaMax kernel finds the maximum pixel value in a rectangular region centered around each pixel
13    /// in the source image. If there are multiple channels in the source image, each channel is processed independently.
14    /// The edgeMode property is assumed to always be MPSImageEdgeModeClamp for this filter.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageareamax?language=objc)
17    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
20    pub struct MPSImageAreaMax;
21);
22
23#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
24extern_conformance!(
25    unsafe impl NSCoding for MPSImageAreaMax {}
26);
27
28#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
29extern_conformance!(
30    unsafe impl NSCopying for MPSImageAreaMax {}
31);
32
33#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
34unsafe impl CopyingHelper for MPSImageAreaMax {
35    type Result = Self;
36}
37
38#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
39extern_conformance!(
40    unsafe impl NSObjectProtocol for MPSImageAreaMax {}
41);
42
43#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
44extern_conformance!(
45    unsafe impl NSSecureCoding for MPSImageAreaMax {}
46);
47
48#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
49impl MPSImageAreaMax {
50    extern_methods!(
51        /// The height of the filter window. Must be an odd number.
52        #[unsafe(method(kernelHeight))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn kernelHeight(&self) -> NSUInteger;
55
56        /// The width of the filter window. Must be an odd number.
57        #[unsafe(method(kernelWidth))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn kernelWidth(&self) -> NSUInteger;
60
61        /// Set the kernel height and width
62        ///
63        /// Parameter `device`: The device the filter will run on
64        ///
65        /// Parameter `kernelWidth`: The width of the kernel. Must be an odd number.
66        ///
67        /// Parameter `kernelHeight`: The height of the kernel. Must be an odd number.
68        #[unsafe(method(initWithDevice:kernelWidth:kernelHeight:))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn initWithDevice_kernelWidth_kernelHeight(
71            this: Allocated<Self>,
72            device: &ProtocolObject<dyn MTLDevice>,
73            kernel_width: NSUInteger,
74            kernel_height: NSUInteger,
75        ) -> Retained<Self>;
76
77        /// NSSecureCoding compatability
78        ///
79        /// While the standard NSSecureCoding/NSCoding method
80        /// -initWithCoder: should work, since the file can't
81        /// know which device your data is allocated on, we
82        /// have to guess and may guess incorrectly.  To avoid
83        /// that problem, use initWithCoder:device instead.
84        ///
85        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
86        ///
87        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
88        ///
89        /// Returns: A new MPSKernel object, or nil if failure.
90        ///
91        /// # Safety
92        ///
93        /// `a_decoder` possibly has further requirements.
94        #[unsafe(method(initWithCoder:device:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithCoder_device(
97            this: Allocated<Self>,
98            a_decoder: &NSCoder,
99            device: &ProtocolObject<dyn MTLDevice>,
100        ) -> Option<Retained<Self>>;
101
102        #[unsafe(method(initWithDevice:))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn initWithDevice(
105            this: Allocated<Self>,
106            device: &ProtocolObject<dyn MTLDevice>,
107        ) -> Retained<Self>;
108    );
109}
110
111/// Methods declared on superclass `MPSKernel`.
112#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
113impl MPSImageAreaMax {
114    extern_methods!(
115        /// Called by NSCoder to decode MPSKernels
116        ///
117        /// This isn't the right interface to decode a MPSKernel, but
118        /// it is the one that NSCoder uses. To enable your NSCoder
119        /// (e.g. NSKeyedUnarchiver) to set which device to use
120        /// extend the object to adopt the MPSDeviceProvider
121        /// protocol. Otherwise, the Metal system default device
122        /// will be used.
123        ///
124        /// # Safety
125        ///
126        /// `a_decoder` possibly has further requirements.
127        #[unsafe(method(initWithCoder:))]
128        #[unsafe(method_family = init)]
129        pub unsafe fn initWithCoder(
130            this: Allocated<Self>,
131            a_decoder: &NSCoder,
132        ) -> Option<Retained<Self>>;
133    );
134}
135
136/// Methods declared on superclass `NSObject`.
137#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
138impl MPSImageAreaMax {
139    extern_methods!(
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}
149
150extern_class!(
151    /// The MPSImageAreaMin finds the minimum pixel value in a rectangular region centered around each pixel in the
152    /// source image. If there are multiple channels in the source image, each channel is processed independently.
153    /// It has the same methods as MPSImageAreaMax
154    /// The edgeMode property is assumed to always be MPSImageEdgeModeClamp for this filter.
155    ///
156    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageareamin?language=objc)
157    #[unsafe(super(MPSImageAreaMax, MPSUnaryImageKernel, MPSKernel, NSObject))]
158    #[derive(Debug, PartialEq, Eq, Hash)]
159    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
160    pub struct MPSImageAreaMin;
161);
162
163#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
164extern_conformance!(
165    unsafe impl NSCoding for MPSImageAreaMin {}
166);
167
168#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
169extern_conformance!(
170    unsafe impl NSCopying for MPSImageAreaMin {}
171);
172
173#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
174unsafe impl CopyingHelper for MPSImageAreaMin {
175    type Result = Self;
176}
177
178#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
179extern_conformance!(
180    unsafe impl NSObjectProtocol for MPSImageAreaMin {}
181);
182
183#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
184extern_conformance!(
185    unsafe impl NSSecureCoding for MPSImageAreaMin {}
186);
187
188#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
189impl MPSImageAreaMin {
190    extern_methods!();
191}
192
193/// Methods declared on superclass `MPSImageAreaMax`.
194#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
195impl MPSImageAreaMin {
196    extern_methods!(
197        /// Set the kernel height and width
198        ///
199        /// Parameter `device`: The device the filter will run on
200        ///
201        /// Parameter `kernelWidth`: The width of the kernel. Must be an odd number.
202        ///
203        /// Parameter `kernelHeight`: The height of the kernel. Must be an odd number.
204        #[unsafe(method(initWithDevice:kernelWidth:kernelHeight:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithDevice_kernelWidth_kernelHeight(
207            this: Allocated<Self>,
208            device: &ProtocolObject<dyn MTLDevice>,
209            kernel_width: NSUInteger,
210            kernel_height: NSUInteger,
211        ) -> Retained<Self>;
212
213        /// NSSecureCoding compatability
214        ///
215        /// While the standard NSSecureCoding/NSCoding method
216        /// -initWithCoder: should work, since the file can't
217        /// know which device your data is allocated on, we
218        /// have to guess and may guess incorrectly.  To avoid
219        /// that problem, use initWithCoder:device instead.
220        ///
221        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
222        ///
223        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
224        ///
225        /// Returns: A new MPSKernel object, or nil if failure.
226        ///
227        /// # Safety
228        ///
229        /// `a_decoder` possibly has further requirements.
230        #[unsafe(method(initWithCoder:device:))]
231        #[unsafe(method_family = init)]
232        pub unsafe fn initWithCoder_device(
233            this: Allocated<Self>,
234            a_decoder: &NSCoder,
235            device: &ProtocolObject<dyn MTLDevice>,
236        ) -> Option<Retained<Self>>;
237
238        #[unsafe(method(initWithDevice:))]
239        #[unsafe(method_family = init)]
240        pub unsafe fn initWithDevice(
241            this: Allocated<Self>,
242            device: &ProtocolObject<dyn MTLDevice>,
243        ) -> Retained<Self>;
244    );
245}
246
247/// Methods declared on superclass `MPSKernel`.
248#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
249impl MPSImageAreaMin {
250    extern_methods!(
251        /// Called by NSCoder to decode MPSKernels
252        ///
253        /// This isn't the right interface to decode a MPSKernel, but
254        /// it is the one that NSCoder uses. To enable your NSCoder
255        /// (e.g. NSKeyedUnarchiver) to set which device to use
256        /// extend the object to adopt the MPSDeviceProvider
257        /// protocol. Otherwise, the Metal system default device
258        /// will be used.
259        ///
260        /// # Safety
261        ///
262        /// `a_decoder` possibly has further requirements.
263        #[unsafe(method(initWithCoder:))]
264        #[unsafe(method_family = init)]
265        pub unsafe fn initWithCoder(
266            this: Allocated<Self>,
267            a_decoder: &NSCoder,
268        ) -> Option<Retained<Self>>;
269    );
270}
271
272/// Methods declared on superclass `NSObject`.
273#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
274impl MPSImageAreaMin {
275    extern_methods!(
276        #[unsafe(method(init))]
277        #[unsafe(method_family = init)]
278        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
279
280        #[unsafe(method(new))]
281        #[unsafe(method_family = new)]
282        pub unsafe fn new() -> Retained<Self>;
283    );
284}
285
286extern_class!(
287    /// The MPSImageDilate finds the maximum pixel value in a rectangular region centered around each pixel in the
288    /// source image. It is like the MPSImageAreaMax, except that the intensity at each position is calculated relative
289    /// to a different value before determining which is the maximum pixel value, allowing for shaped, non-rectangular
290    /// morphological probes.
291    ///
292    /// ```text
293    ///           for each pixel in the filter window:
294    ///               value =  pixel[filterY][filterX] - filter[filterY*filter_width+filterX]
295    ///               if( value > bestValue ){
296    ///                    result = value
297    ///                    bestValue = value;
298    ///               }
299    /// ```
300    ///
301    /// A filter that contains all zeros and is identical to a MPSImageAreaMax filter.  The center filter element
302    /// is assumed to be 0 to avoid causing a general darkening of the image.
303    ///
304    /// The edgeMode property is assumed to always be MPSImageEdgeModeClamp for this filter.
305    ///
306    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagedilate?language=objc)
307    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
308    #[derive(Debug, PartialEq, Eq, Hash)]
309    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
310    pub struct MPSImageDilate;
311);
312
313#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
314extern_conformance!(
315    unsafe impl NSCoding for MPSImageDilate {}
316);
317
318#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
319extern_conformance!(
320    unsafe impl NSCopying for MPSImageDilate {}
321);
322
323#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
324unsafe impl CopyingHelper for MPSImageDilate {
325    type Result = Self;
326}
327
328#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
329extern_conformance!(
330    unsafe impl NSObjectProtocol for MPSImageDilate {}
331);
332
333#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
334extern_conformance!(
335    unsafe impl NSSecureCoding for MPSImageDilate {}
336);
337
338#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
339impl MPSImageDilate {
340    extern_methods!(
341        /// The height of the filter window. Must be an odd number.
342        #[unsafe(method(kernelHeight))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn kernelHeight(&self) -> NSUInteger;
345
346        /// The width of the filter window. Must be an odd number.
347        #[unsafe(method(kernelWidth))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn kernelWidth(&self) -> NSUInteger;
350
351        /// Init a object with kernel height, width and weight values.
352        ///
353        /// Each dilate shape probe defines a 3D surface of values.
354        /// These are arranged in order left to right, then top to bottom
355        /// in a 1D array. (values[kernelWidth*y+x] = probe[y][x])
356        /// Values should be generally be in the range [0,1] with the center
357        /// pixel tending towards 0 and edges towards 1. However, any numerical
358        /// value is allowed. Calculations are subject to the usual floating-point
359        /// rounding error.
360        ///
361        ///
362        /// Parameter `device`: The device the filter will run on
363        ///
364        /// Parameter `kernelWidth`: The width of the kernel. Must be an odd number.
365        ///
366        /// Parameter `kernelHeight`: The height of the kernel. Must be an odd number.
367        ///
368        /// Parameter `values`: The set of values to use as the dilate probe.
369        /// The values are copied into the filter. To avoid
370        /// image ligthening or darkening, the center value should
371        /// be 0.0f.
372        ///
373        /// # Safety
374        ///
375        /// `values` must be a valid pointer.
376        #[unsafe(method(initWithDevice:kernelWidth:kernelHeight:values:))]
377        #[unsafe(method_family = init)]
378        pub unsafe fn initWithDevice_kernelWidth_kernelHeight_values(
379            this: Allocated<Self>,
380            device: &ProtocolObject<dyn MTLDevice>,
381            kernel_width: NSUInteger,
382            kernel_height: NSUInteger,
383            values: NonNull<c_float>,
384        ) -> Retained<Self>;
385
386        #[unsafe(method(initWithDevice:))]
387        #[unsafe(method_family = init)]
388        pub unsafe fn initWithDevice(
389            this: Allocated<Self>,
390            device: &ProtocolObject<dyn MTLDevice>,
391        ) -> Retained<Self>;
392
393        /// NSSecureCoding compatability
394        ///
395        /// While the standard NSSecureCoding/NSCoding method
396        /// -initWithCoder: should work, since the file can't
397        /// know which device your data is allocated on, we
398        /// have to guess and may guess incorrectly.  To avoid
399        /// that problem, use initWithCoder:device instead.
400        ///
401        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
402        ///
403        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
404        ///
405        /// Returns: A new MPSKernel object, or nil if failure.
406        ///
407        /// # Safety
408        ///
409        /// `a_decoder` possibly has further requirements.
410        #[unsafe(method(initWithCoder:device:))]
411        #[unsafe(method_family = init)]
412        pub unsafe fn initWithCoder_device(
413            this: Allocated<Self>,
414            a_decoder: &NSCoder,
415            device: &ProtocolObject<dyn MTLDevice>,
416        ) -> Option<Retained<Self>>;
417    );
418}
419
420/// Methods declared on superclass `MPSKernel`.
421#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
422impl MPSImageDilate {
423    extern_methods!(
424        /// Called by NSCoder to decode MPSKernels
425        ///
426        /// This isn't the right interface to decode a MPSKernel, but
427        /// it is the one that NSCoder uses. To enable your NSCoder
428        /// (e.g. NSKeyedUnarchiver) to set which device to use
429        /// extend the object to adopt the MPSDeviceProvider
430        /// protocol. Otherwise, the Metal system default device
431        /// will be used.
432        ///
433        /// # Safety
434        ///
435        /// `a_decoder` possibly has further requirements.
436        #[unsafe(method(initWithCoder:))]
437        #[unsafe(method_family = init)]
438        pub unsafe fn initWithCoder(
439            this: Allocated<Self>,
440            a_decoder: &NSCoder,
441        ) -> Option<Retained<Self>>;
442    );
443}
444
445/// Methods declared on superclass `NSObject`.
446#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
447impl MPSImageDilate {
448    extern_methods!(
449        #[unsafe(method(init))]
450        #[unsafe(method_family = init)]
451        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
452
453        #[unsafe(method(new))]
454        #[unsafe(method_family = new)]
455        pub unsafe fn new() -> Retained<Self>;
456    );
457}
458
459extern_class!(
460    /// The MPSImageErode filter finds the minimum pixel value in a rectangular region centered around each pixel in the
461    /// source image. It is like the MPSImageAreaMin, except that the intensity at each position is calculated relative
462    /// to a different value before determining which is the maximum pixel value, allowing for shaped, non-rectangular
463    /// morphological probes.
464    ///
465    /// ```text
466    ///           for each pixel in the filter window:
467    ///               value =  pixel[filterY][filterX] + filter[filterY*filter_width+filterX]
468    ///               if( value < bestValue ){
469    ///                    result = value
470    ///                    bestValue = value;
471    ///               }
472    /// ```
473    ///
474    /// A filter that contains all zeros is identical to a MPSImageAreaMin filter. The center filter element
475    /// is assumed to be 0, to avoid causing a general lightening of the image.
476    ///
477    /// The definition of the filter for MPSImageErode is different from vImage. (MPSErode_filter_value = 1.0f-vImageErode_filter_value.)
478    /// This allows MPSImageDilate and MPSImageErode to use the same filter, making open and close operators easier to write.
479    /// The edgeMode property is assumed to always be MPSImageEdgeModeClamp for this filter.
480    ///
481    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageerode?language=objc)
482    #[unsafe(super(MPSImageDilate, MPSUnaryImageKernel, MPSKernel, NSObject))]
483    #[derive(Debug, PartialEq, Eq, Hash)]
484    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
485    pub struct MPSImageErode;
486);
487
488#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
489extern_conformance!(
490    unsafe impl NSCoding for MPSImageErode {}
491);
492
493#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
494extern_conformance!(
495    unsafe impl NSCopying for MPSImageErode {}
496);
497
498#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
499unsafe impl CopyingHelper for MPSImageErode {
500    type Result = Self;
501}
502
503#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
504extern_conformance!(
505    unsafe impl NSObjectProtocol for MPSImageErode {}
506);
507
508#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
509extern_conformance!(
510    unsafe impl NSSecureCoding for MPSImageErode {}
511);
512
513#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
514impl MPSImageErode {
515    extern_methods!();
516}
517
518/// Methods declared on superclass `MPSImageDilate`.
519#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
520impl MPSImageErode {
521    extern_methods!(
522        /// Init a object with kernel height, width and weight values.
523        ///
524        /// Each dilate shape probe defines a 3D surface of values.
525        /// These are arranged in order left to right, then top to bottom
526        /// in a 1D array. (values[kernelWidth*y+x] = probe[y][x])
527        /// Values should be generally be in the range [0,1] with the center
528        /// pixel tending towards 0 and edges towards 1. However, any numerical
529        /// value is allowed. Calculations are subject to the usual floating-point
530        /// rounding error.
531        ///
532        ///
533        /// Parameter `device`: The device the filter will run on
534        ///
535        /// Parameter `kernelWidth`: The width of the kernel. Must be an odd number.
536        ///
537        /// Parameter `kernelHeight`: The height of the kernel. Must be an odd number.
538        ///
539        /// Parameter `values`: The set of values to use as the dilate probe.
540        /// The values are copied into the filter. To avoid
541        /// image ligthening or darkening, the center value should
542        /// be 0.0f.
543        ///
544        /// # Safety
545        ///
546        /// `values` must be a valid pointer.
547        #[unsafe(method(initWithDevice:kernelWidth:kernelHeight:values:))]
548        #[unsafe(method_family = init)]
549        pub unsafe fn initWithDevice_kernelWidth_kernelHeight_values(
550            this: Allocated<Self>,
551            device: &ProtocolObject<dyn MTLDevice>,
552            kernel_width: NSUInteger,
553            kernel_height: NSUInteger,
554            values: NonNull<c_float>,
555        ) -> Retained<Self>;
556
557        #[unsafe(method(initWithDevice:))]
558        #[unsafe(method_family = init)]
559        pub unsafe fn initWithDevice(
560            this: Allocated<Self>,
561            device: &ProtocolObject<dyn MTLDevice>,
562        ) -> Retained<Self>;
563
564        /// NSSecureCoding compatability
565        ///
566        /// While the standard NSSecureCoding/NSCoding method
567        /// -initWithCoder: should work, since the file can't
568        /// know which device your data is allocated on, we
569        /// have to guess and may guess incorrectly.  To avoid
570        /// that problem, use initWithCoder:device instead.
571        ///
572        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
573        ///
574        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
575        ///
576        /// Returns: A new MPSKernel object, or nil if failure.
577        ///
578        /// # Safety
579        ///
580        /// `a_decoder` possibly has further requirements.
581        #[unsafe(method(initWithCoder:device:))]
582        #[unsafe(method_family = init)]
583        pub unsafe fn initWithCoder_device(
584            this: Allocated<Self>,
585            a_decoder: &NSCoder,
586            device: &ProtocolObject<dyn MTLDevice>,
587        ) -> Option<Retained<Self>>;
588    );
589}
590
591/// Methods declared on superclass `MPSKernel`.
592#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
593impl MPSImageErode {
594    extern_methods!(
595        /// Called by NSCoder to decode MPSKernels
596        ///
597        /// This isn't the right interface to decode a MPSKernel, but
598        /// it is the one that NSCoder uses. To enable your NSCoder
599        /// (e.g. NSKeyedUnarchiver) to set which device to use
600        /// extend the object to adopt the MPSDeviceProvider
601        /// protocol. Otherwise, the Metal system default device
602        /// will be used.
603        ///
604        /// # Safety
605        ///
606        /// `a_decoder` possibly has further requirements.
607        #[unsafe(method(initWithCoder:))]
608        #[unsafe(method_family = init)]
609        pub unsafe fn initWithCoder(
610            this: Allocated<Self>,
611            a_decoder: &NSCoder,
612        ) -> Option<Retained<Self>>;
613    );
614}
615
616/// Methods declared on superclass `NSObject`.
617#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
618impl MPSImageErode {
619    extern_methods!(
620        #[unsafe(method(init))]
621        #[unsafe(method_family = init)]
622        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
623
624        #[unsafe(method(new))]
625        #[unsafe(method_family = new)]
626        pub unsafe fn new() -> Retained<Self>;
627    );
628}