objc2_metal_performance_shaders/generated/MPSImage/
MPSImageMath.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    /// Dependencies: This depends on Metal.framework.
13    ///
14    /// This filter takes two source images, a primary source image and a secondary source image,
15    /// and outputs a single destination image. It applies an element-wise arithmetic operator to
16    /// each pixel in a primary source image and a corresponding pixel in a secondary source image
17    /// over a specified region.
18    ///
19    /// The supported arithmetic operators are the following:
20    /// - Addition
21    /// - Subtraction
22    /// - Multiplication
23    /// - Division
24    ///
25    /// This filter takes additional parameters: primaryScale, secondaryScale, and bias. The default
26    /// value for primaryScale and secondaryScale is 1.0f. The default value for bias is 0.0f. This
27    /// filter applies primaryScale, secondaryScale, and bias to the primary source pixel (x) and
28    /// secondary source pixel (y) in the following way:
29    /// - Addition:         result = ((primaryScale * x) + (secondaryScale * y)) + bias
30    /// - Subtraction:      result = ((primaryScale * x) - (secondaryScale * y)) + bias
31    /// - Multiplicaton:    result = ((primaryScale * x) * (secondaryScale * y)) + bias
32    /// - Division:         result = ((primaryScale * x) / (secondaryScale * y)) + bias
33    ///
34    /// To clamp the result of an arithmetic operation, where
35    /// result = clamp(result, minimumValue, maximumValue),
36    /// set the minimumValue and maximumValue appropriately. The default value of minimumValue
37    /// is -FLT_MAX. The default value of maximumValue is FLT_MAX.
38    ///
39    /// This filter also takes the following additional parameters:
40    /// - primaryStrideInPixels
41    /// - secondaryStrideInPixels
42    /// These parameters can be used to control broadcasting for the data stored in the primary and
43    /// secondary source images. For example, setting all strides for the primary source image to 0
44    /// will result in the primarySource image being treated as a scalar value. The only supported
45    /// values are 0 or 1. The default value of these parameters is 1.
46    ///
47    /// This filter accepts uint and int data in addition to unorm and floating-point data.
48    ///
49    /// You must use one of the sub-classes of MPSImageArithmetic.
50    ///
51    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagearithmetic?language=objc)
52    #[unsafe(super(MPSBinaryImageKernel, MPSKernel, NSObject))]
53    #[derive(Debug, PartialEq, Eq, Hash)]
54    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
55    pub struct MPSImageArithmetic;
56);
57
58#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
59extern_conformance!(
60    unsafe impl NSCoding for MPSImageArithmetic {}
61);
62
63#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
64extern_conformance!(
65    unsafe impl NSCopying for MPSImageArithmetic {}
66);
67
68#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
69unsafe impl CopyingHelper for MPSImageArithmetic {
70    type Result = Self;
71}
72
73#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
74extern_conformance!(
75    unsafe impl NSObjectProtocol for MPSImageArithmetic {}
76);
77
78#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
79extern_conformance!(
80    unsafe impl NSSecureCoding for MPSImageArithmetic {}
81);
82
83#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
84impl MPSImageArithmetic {
85    extern_methods!(
86        #[unsafe(method(primaryScale))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn primaryScale(&self) -> c_float;
89
90        /// Setter for [`primaryScale`][Self::primaryScale].
91        #[unsafe(method(setPrimaryScale:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setPrimaryScale(&self, primary_scale: c_float);
94
95        #[unsafe(method(secondaryScale))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn secondaryScale(&self) -> c_float;
98
99        /// Setter for [`secondaryScale`][Self::secondaryScale].
100        #[unsafe(method(setSecondaryScale:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setSecondaryScale(&self, secondary_scale: c_float);
103
104        #[unsafe(method(bias))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn bias(&self) -> c_float;
107
108        /// Setter for [`bias`][Self::bias].
109        #[unsafe(method(setBias:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn setBias(&self, bias: c_float);
112
113        /// The secondarySource stride in the x, y, and z dimensions. The only supported values are 0 or 1.
114        /// The default value for each dimension is 1.
115        #[unsafe(method(primaryStrideInPixels))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn primaryStrideInPixels(&self) -> MTLSize;
118
119        /// Setter for [`primaryStrideInPixels`][Self::primaryStrideInPixels].
120        #[unsafe(method(setPrimaryStrideInPixels:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setPrimaryStrideInPixels(&self, primary_stride_in_pixels: MTLSize);
123
124        /// The secondarySource stride in the x, y, and z dimensions. The only supported values are 0 or 1.
125        /// The default value for each dimension is 1.
126        #[unsafe(method(secondaryStrideInPixels))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn secondaryStrideInPixels(&self) -> MTLSize;
129
130        /// Setter for [`secondaryStrideInPixels`][Self::secondaryStrideInPixels].
131        #[unsafe(method(setSecondaryStrideInPixels:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setSecondaryStrideInPixels(&self, secondary_stride_in_pixels: MTLSize);
134
135        /// minimumValue is to clamp the result of an arithmetic operation:
136        /// result = clamp(result, minimumValue, maximumValue).
137        /// The default value of minimumValue is -FLT_MAX.
138        #[unsafe(method(minimumValue))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn minimumValue(&self) -> c_float;
141
142        /// Setter for [`minimumValue`][Self::minimumValue].
143        #[unsafe(method(setMinimumValue:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn setMinimumValue(&self, minimum_value: c_float);
146
147        /// maximumValue is used to clamp the result of an arithmetic operation:
148        /// result = clamp(result, minimumValue, maximumValue).
149        /// The default value of maximumValue is FLT_MAX.
150        #[unsafe(method(maximumValue))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn maximumValue(&self) -> c_float;
153
154        /// Setter for [`maximumValue`][Self::maximumValue].
155        #[unsafe(method(setMaximumValue:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setMaximumValue(&self, maximum_value: c_float);
158
159        #[unsafe(method(initWithDevice:))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn initWithDevice(
162            this: Allocated<Self>,
163            device: &ProtocolObject<dyn MTLDevice>,
164        ) -> Retained<Self>;
165    );
166}
167
168/// Methods declared on superclass `MPSBinaryImageKernel`.
169#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
170impl MPSImageArithmetic {
171    extern_methods!(
172        /// NSSecureCoding compatability
173        ///
174        /// While the standard NSSecureCoding/NSCoding method
175        /// -initWithCoder: should work, since the file can't
176        /// know which device your data is allocated on, we
177        /// have to guess and may guess incorrectly.  To avoid
178        /// that problem, use initWithCoder:device instead.
179        ///
180        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
181        ///
182        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
183        ///
184        /// Returns: A new MPSKernel object, or nil if failure.
185        ///
186        /// # Safety
187        ///
188        /// `a_decoder` possibly has further requirements.
189        #[unsafe(method(initWithCoder:device:))]
190        #[unsafe(method_family = init)]
191        pub unsafe fn initWithCoder_device(
192            this: Allocated<Self>,
193            a_decoder: &NSCoder,
194            device: &ProtocolObject<dyn MTLDevice>,
195        ) -> Option<Retained<Self>>;
196    );
197}
198
199/// Methods declared on superclass `MPSKernel`.
200#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
201impl MPSImageArithmetic {
202    extern_methods!(
203        /// Called by NSCoder to decode MPSKernels
204        ///
205        /// This isn't the right interface to decode a MPSKernel, but
206        /// it is the one that NSCoder uses. To enable your NSCoder
207        /// (e.g. NSKeyedUnarchiver) to set which device to use
208        /// extend the object to adopt the MPSDeviceProvider
209        /// protocol. Otherwise, the Metal system default device
210        /// will be used.
211        ///
212        /// # Safety
213        ///
214        /// `a_decoder` possibly has further requirements.
215        #[unsafe(method(initWithCoder:))]
216        #[unsafe(method_family = init)]
217        pub unsafe fn initWithCoder(
218            this: Allocated<Self>,
219            a_decoder: &NSCoder,
220        ) -> Option<Retained<Self>>;
221    );
222}
223
224/// Methods declared on superclass `NSObject`.
225#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
226impl MPSImageArithmetic {
227    extern_methods!(
228        #[unsafe(method(init))]
229        #[unsafe(method_family = init)]
230        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
231
232        #[unsafe(method(new))]
233        #[unsafe(method_family = new)]
234        pub unsafe fn new() -> Retained<Self>;
235    );
236}
237
238extern_class!(
239    /// Dependencies: This depends on Metal.framework.
240    ///
241    /// Specifies the addition operator.
242    /// For each pixel in the primary source image (x) and each pixel in a secondary source image (y),
243    /// it applies the following function: result = ((primaryScale * x) + (secondaryScale * y)) + bias.
244    ///
245    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageadd?language=objc)
246    #[unsafe(super(MPSImageArithmetic, MPSBinaryImageKernel, MPSKernel, NSObject))]
247    #[derive(Debug, PartialEq, Eq, Hash)]
248    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
249    pub struct MPSImageAdd;
250);
251
252#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
253extern_conformance!(
254    unsafe impl NSCoding for MPSImageAdd {}
255);
256
257#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
258extern_conformance!(
259    unsafe impl NSCopying for MPSImageAdd {}
260);
261
262#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
263unsafe impl CopyingHelper for MPSImageAdd {
264    type Result = Self;
265}
266
267#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
268extern_conformance!(
269    unsafe impl NSObjectProtocol for MPSImageAdd {}
270);
271
272#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
273extern_conformance!(
274    unsafe impl NSSecureCoding for MPSImageAdd {}
275);
276
277#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
278impl MPSImageAdd {
279    extern_methods!(
280        /// Initialize the addition operator
281        ///
282        /// Parameter `device`: The device the filter will run on.
283        ///
284        /// Returns: A valid MPSImageAdd object or nil, if failure.
285        #[unsafe(method(initWithDevice:))]
286        #[unsafe(method_family = init)]
287        pub unsafe fn initWithDevice(
288            this: Allocated<Self>,
289            device: &ProtocolObject<dyn MTLDevice>,
290        ) -> Retained<Self>;
291    );
292}
293
294/// Methods declared on superclass `MPSBinaryImageKernel`.
295#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
296impl MPSImageAdd {
297    extern_methods!(
298        /// NSSecureCoding compatability
299        ///
300        /// While the standard NSSecureCoding/NSCoding method
301        /// -initWithCoder: should work, since the file can't
302        /// know which device your data is allocated on, we
303        /// have to guess and may guess incorrectly.  To avoid
304        /// that problem, use initWithCoder:device instead.
305        ///
306        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
307        ///
308        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
309        ///
310        /// Returns: A new MPSKernel object, or nil if failure.
311        ///
312        /// # Safety
313        ///
314        /// `a_decoder` possibly has further requirements.
315        #[unsafe(method(initWithCoder:device:))]
316        #[unsafe(method_family = init)]
317        pub unsafe fn initWithCoder_device(
318            this: Allocated<Self>,
319            a_decoder: &NSCoder,
320            device: &ProtocolObject<dyn MTLDevice>,
321        ) -> Option<Retained<Self>>;
322    );
323}
324
325/// Methods declared on superclass `MPSKernel`.
326#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
327impl MPSImageAdd {
328    extern_methods!(
329        /// Called by NSCoder to decode MPSKernels
330        ///
331        /// This isn't the right interface to decode a MPSKernel, but
332        /// it is the one that NSCoder uses. To enable your NSCoder
333        /// (e.g. NSKeyedUnarchiver) to set which device to use
334        /// extend the object to adopt the MPSDeviceProvider
335        /// protocol. Otherwise, the Metal system default device
336        /// will be used.
337        ///
338        /// # Safety
339        ///
340        /// `a_decoder` possibly has further requirements.
341        #[unsafe(method(initWithCoder:))]
342        #[unsafe(method_family = init)]
343        pub unsafe fn initWithCoder(
344            this: Allocated<Self>,
345            a_decoder: &NSCoder,
346        ) -> Option<Retained<Self>>;
347    );
348}
349
350/// Methods declared on superclass `NSObject`.
351#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
352impl MPSImageAdd {
353    extern_methods!(
354        #[unsafe(method(init))]
355        #[unsafe(method_family = init)]
356        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
357
358        #[unsafe(method(new))]
359        #[unsafe(method_family = new)]
360        pub unsafe fn new() -> Retained<Self>;
361    );
362}
363
364extern_class!(
365    /// Dependencies: This depends on Metal.framework.
366    ///
367    /// Specifies the subtraction operator.
368    /// For each pixel in the primary source image (x) and each pixel in a secondary source image (y),
369    /// it applies the following function: result = ((primaryScale * x) - (secondaryScale * y)) + bias.
370    ///
371    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagesubtract?language=objc)
372    #[unsafe(super(MPSImageArithmetic, MPSBinaryImageKernel, MPSKernel, NSObject))]
373    #[derive(Debug, PartialEq, Eq, Hash)]
374    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
375    pub struct MPSImageSubtract;
376);
377
378#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
379extern_conformance!(
380    unsafe impl NSCoding for MPSImageSubtract {}
381);
382
383#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
384extern_conformance!(
385    unsafe impl NSCopying for MPSImageSubtract {}
386);
387
388#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
389unsafe impl CopyingHelper for MPSImageSubtract {
390    type Result = Self;
391}
392
393#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
394extern_conformance!(
395    unsafe impl NSObjectProtocol for MPSImageSubtract {}
396);
397
398#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
399extern_conformance!(
400    unsafe impl NSSecureCoding for MPSImageSubtract {}
401);
402
403#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
404impl MPSImageSubtract {
405    extern_methods!(
406        /// Initialize the subtraction operator
407        ///
408        /// Parameter `device`: The device the filter will run on.
409        ///
410        /// Returns: A valid MPSImageSubtract object or nil, if failure.
411        #[unsafe(method(initWithDevice:))]
412        #[unsafe(method_family = init)]
413        pub unsafe fn initWithDevice(
414            this: Allocated<Self>,
415            device: &ProtocolObject<dyn MTLDevice>,
416        ) -> Retained<Self>;
417    );
418}
419
420/// Methods declared on superclass `MPSBinaryImageKernel`.
421#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
422impl MPSImageSubtract {
423    extern_methods!(
424        /// NSSecureCoding compatability
425        ///
426        /// While the standard NSSecureCoding/NSCoding method
427        /// -initWithCoder: should work, since the file can't
428        /// know which device your data is allocated on, we
429        /// have to guess and may guess incorrectly.  To avoid
430        /// that problem, use initWithCoder:device instead.
431        ///
432        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
433        ///
434        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
435        ///
436        /// Returns: A new MPSKernel object, or nil if failure.
437        ///
438        /// # Safety
439        ///
440        /// `a_decoder` possibly has further requirements.
441        #[unsafe(method(initWithCoder:device:))]
442        #[unsafe(method_family = init)]
443        pub unsafe fn initWithCoder_device(
444            this: Allocated<Self>,
445            a_decoder: &NSCoder,
446            device: &ProtocolObject<dyn MTLDevice>,
447        ) -> Option<Retained<Self>>;
448    );
449}
450
451/// Methods declared on superclass `MPSKernel`.
452#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
453impl MPSImageSubtract {
454    extern_methods!(
455        /// Called by NSCoder to decode MPSKernels
456        ///
457        /// This isn't the right interface to decode a MPSKernel, but
458        /// it is the one that NSCoder uses. To enable your NSCoder
459        /// (e.g. NSKeyedUnarchiver) to set which device to use
460        /// extend the object to adopt the MPSDeviceProvider
461        /// protocol. Otherwise, the Metal system default device
462        /// will be used.
463        ///
464        /// # Safety
465        ///
466        /// `a_decoder` possibly has further requirements.
467        #[unsafe(method(initWithCoder:))]
468        #[unsafe(method_family = init)]
469        pub unsafe fn initWithCoder(
470            this: Allocated<Self>,
471            a_decoder: &NSCoder,
472        ) -> Option<Retained<Self>>;
473    );
474}
475
476/// Methods declared on superclass `NSObject`.
477#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
478impl MPSImageSubtract {
479    extern_methods!(
480        #[unsafe(method(init))]
481        #[unsafe(method_family = init)]
482        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
483
484        #[unsafe(method(new))]
485        #[unsafe(method_family = new)]
486        pub unsafe fn new() -> Retained<Self>;
487    );
488}
489
490extern_class!(
491    /// Dependencies: This depends on Metal.framework.
492    ///
493    /// Specifies the multiplication operator.
494    /// For each pixel in the primary source image (x) and each pixel in a secondary source image (y),
495    /// it applies the following function: result = ((primaryScale * x) * (secondaryScale * y)) + bias.
496    ///
497    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagemultiply?language=objc)
498    #[unsafe(super(MPSImageArithmetic, MPSBinaryImageKernel, MPSKernel, NSObject))]
499    #[derive(Debug, PartialEq, Eq, Hash)]
500    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
501    pub struct MPSImageMultiply;
502);
503
504#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
505extern_conformance!(
506    unsafe impl NSCoding for MPSImageMultiply {}
507);
508
509#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
510extern_conformance!(
511    unsafe impl NSCopying for MPSImageMultiply {}
512);
513
514#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
515unsafe impl CopyingHelper for MPSImageMultiply {
516    type Result = Self;
517}
518
519#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
520extern_conformance!(
521    unsafe impl NSObjectProtocol for MPSImageMultiply {}
522);
523
524#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
525extern_conformance!(
526    unsafe impl NSSecureCoding for MPSImageMultiply {}
527);
528
529#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
530impl MPSImageMultiply {
531    extern_methods!(
532        /// Initialize the multiplication operator
533        ///
534        /// Parameter `device`: The device the filter will run on.
535        ///
536        /// Returns: A valid MPSImageMultiply object or nil, if failure.
537        #[unsafe(method(initWithDevice:))]
538        #[unsafe(method_family = init)]
539        pub unsafe fn initWithDevice(
540            this: Allocated<Self>,
541            device: &ProtocolObject<dyn MTLDevice>,
542        ) -> Retained<Self>;
543    );
544}
545
546/// Methods declared on superclass `MPSBinaryImageKernel`.
547#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
548impl MPSImageMultiply {
549    extern_methods!(
550        /// NSSecureCoding compatability
551        ///
552        /// While the standard NSSecureCoding/NSCoding method
553        /// -initWithCoder: should work, since the file can't
554        /// know which device your data is allocated on, we
555        /// have to guess and may guess incorrectly.  To avoid
556        /// that problem, use initWithCoder:device instead.
557        ///
558        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
559        ///
560        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
561        ///
562        /// Returns: A new MPSKernel object, or nil if failure.
563        ///
564        /// # Safety
565        ///
566        /// `a_decoder` possibly has further requirements.
567        #[unsafe(method(initWithCoder:device:))]
568        #[unsafe(method_family = init)]
569        pub unsafe fn initWithCoder_device(
570            this: Allocated<Self>,
571            a_decoder: &NSCoder,
572            device: &ProtocolObject<dyn MTLDevice>,
573        ) -> Option<Retained<Self>>;
574    );
575}
576
577/// Methods declared on superclass `MPSKernel`.
578#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
579impl MPSImageMultiply {
580    extern_methods!(
581        /// Called by NSCoder to decode MPSKernels
582        ///
583        /// This isn't the right interface to decode a MPSKernel, but
584        /// it is the one that NSCoder uses. To enable your NSCoder
585        /// (e.g. NSKeyedUnarchiver) to set which device to use
586        /// extend the object to adopt the MPSDeviceProvider
587        /// protocol. Otherwise, the Metal system default device
588        /// will be used.
589        ///
590        /// # Safety
591        ///
592        /// `a_decoder` possibly has further requirements.
593        #[unsafe(method(initWithCoder:))]
594        #[unsafe(method_family = init)]
595        pub unsafe fn initWithCoder(
596            this: Allocated<Self>,
597            a_decoder: &NSCoder,
598        ) -> Option<Retained<Self>>;
599    );
600}
601
602/// Methods declared on superclass `NSObject`.
603#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
604impl MPSImageMultiply {
605    extern_methods!(
606        #[unsafe(method(init))]
607        #[unsafe(method_family = init)]
608        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
609
610        #[unsafe(method(new))]
611        #[unsafe(method_family = new)]
612        pub unsafe fn new() -> Retained<Self>;
613    );
614}
615
616extern_class!(
617    /// Dependencies: This depends on Metal.framework.
618    ///
619    /// Specifies the division operator.
620    /// For each pixel in the primary source image (x) and each pixel in a secondary source image (y),
621    /// it applies the following function: result = ((primaryScale * x) / (secondaryScale * y)) + bias.
622    ///
623    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagedivide?language=objc)
624    #[unsafe(super(MPSImageArithmetic, MPSBinaryImageKernel, MPSKernel, NSObject))]
625    #[derive(Debug, PartialEq, Eq, Hash)]
626    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
627    pub struct MPSImageDivide;
628);
629
630#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
631extern_conformance!(
632    unsafe impl NSCoding for MPSImageDivide {}
633);
634
635#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
636extern_conformance!(
637    unsafe impl NSCopying for MPSImageDivide {}
638);
639
640#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
641unsafe impl CopyingHelper for MPSImageDivide {
642    type Result = Self;
643}
644
645#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
646extern_conformance!(
647    unsafe impl NSObjectProtocol for MPSImageDivide {}
648);
649
650#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
651extern_conformance!(
652    unsafe impl NSSecureCoding for MPSImageDivide {}
653);
654
655#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
656impl MPSImageDivide {
657    extern_methods!(
658        /// Initialize the division operator
659        ///
660        /// Parameter `device`: The device the filter will run on.
661        ///
662        /// Returns: A valid MPSImageDivide object or nil, if failure.
663        #[unsafe(method(initWithDevice:))]
664        #[unsafe(method_family = init)]
665        pub unsafe fn initWithDevice(
666            this: Allocated<Self>,
667            device: &ProtocolObject<dyn MTLDevice>,
668        ) -> Retained<Self>;
669    );
670}
671
672/// Methods declared on superclass `MPSBinaryImageKernel`.
673#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
674impl MPSImageDivide {
675    extern_methods!(
676        /// NSSecureCoding compatability
677        ///
678        /// While the standard NSSecureCoding/NSCoding method
679        /// -initWithCoder: should work, since the file can't
680        /// know which device your data is allocated on, we
681        /// have to guess and may guess incorrectly.  To avoid
682        /// that problem, use initWithCoder:device instead.
683        ///
684        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
685        ///
686        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
687        ///
688        /// Returns: A new MPSKernel object, or nil if failure.
689        ///
690        /// # Safety
691        ///
692        /// `a_decoder` possibly has further requirements.
693        #[unsafe(method(initWithCoder:device:))]
694        #[unsafe(method_family = init)]
695        pub unsafe fn initWithCoder_device(
696            this: Allocated<Self>,
697            a_decoder: &NSCoder,
698            device: &ProtocolObject<dyn MTLDevice>,
699        ) -> Option<Retained<Self>>;
700    );
701}
702
703/// Methods declared on superclass `MPSKernel`.
704#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
705impl MPSImageDivide {
706    extern_methods!(
707        /// Called by NSCoder to decode MPSKernels
708        ///
709        /// This isn't the right interface to decode a MPSKernel, but
710        /// it is the one that NSCoder uses. To enable your NSCoder
711        /// (e.g. NSKeyedUnarchiver) to set which device to use
712        /// extend the object to adopt the MPSDeviceProvider
713        /// protocol. Otherwise, the Metal system default device
714        /// will be used.
715        ///
716        /// # Safety
717        ///
718        /// `a_decoder` possibly has further requirements.
719        #[unsafe(method(initWithCoder:))]
720        #[unsafe(method_family = init)]
721        pub unsafe fn initWithCoder(
722            this: Allocated<Self>,
723            a_decoder: &NSCoder,
724        ) -> Option<Retained<Self>>;
725    );
726}
727
728/// Methods declared on superclass `NSObject`.
729#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
730impl MPSImageDivide {
731    extern_methods!(
732        #[unsafe(method(init))]
733        #[unsafe(method_family = init)]
734        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
735
736        #[unsafe(method(new))]
737        #[unsafe(method_family = new)]
738        pub unsafe fn new() -> Retained<Self>;
739    );
740}