objc2_metal_performance_shaders/generated/MPSImage/
MPSImageDistanceTransform.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    /// Perform a Euclidean Distance Transform
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimageeuclideandistancetransform?language=objc)
15    #[unsafe(super(MPSUnaryImageKernel, MPSKernel, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
18    pub struct MPSImageEuclideanDistanceTransform;
19);
20
21#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
22extern_conformance!(
23    unsafe impl NSCoding for MPSImageEuclideanDistanceTransform {}
24);
25
26#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
27extern_conformance!(
28    unsafe impl NSCopying for MPSImageEuclideanDistanceTransform {}
29);
30
31#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
32unsafe impl CopyingHelper for MPSImageEuclideanDistanceTransform {
33    type Result = Self;
34}
35
36#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
37extern_conformance!(
38    unsafe impl NSObjectProtocol for MPSImageEuclideanDistanceTransform {}
39);
40
41#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
42extern_conformance!(
43    unsafe impl NSSecureCoding for MPSImageEuclideanDistanceTransform {}
44);
45
46#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
47impl MPSImageEuclideanDistanceTransform {
48    extern_methods!(
49        /// Defines a search scope size around output pixel to limit closest non-zero pixel search. Optional variable.
50        ///
51        /// When the non-zeroes in the input image are on average very far away from each other (ie. the distances are large),
52        /// the distance calculation algorithm has to work harder to find the closest pixel. If you don't care about getting exact
53        /// results beyond a certain distance you can use this property to limit the search space and speed up the kernels.
54        /// In case there are no non-zero pixels within this search scope around the output pixel, then the output value will
55        /// be some number that is larger than this search limit. Normally you should be fine with the default value of FLT_MAX,
56        /// which results in the exact EDT, so use this only if you need additional performance.
57        /// Typical good values are: 32, 64, 96, 128.
58        /// Default: FLT_MAX
59        #[unsafe(method(searchLimitRadius))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn searchLimitRadius(&self) -> c_float;
62
63        /// Setter for [`searchLimitRadius`][Self::searchLimitRadius].
64        #[unsafe(method(setSearchLimitRadius:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setSearchLimitRadius(&self, search_limit_radius: c_float);
67
68        /// Specifies information to apply the statistics min-max operation on an image.
69        ///
70        /// Parameter `device`: The device the filter will run on
71        ///
72        /// Returns: A valid MPSImageEuclideanDistanceTransform object or nil, if failure.
73        #[unsafe(method(initWithDevice:))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn initWithDevice(
76            this: Allocated<Self>,
77            device: &ProtocolObject<dyn MTLDevice>,
78        ) -> Retained<Self>;
79
80        /// NSSecureCoding compatability
81        ///
82        /// While the standard NSSecureCoding/NSCoding method
83        /// -initWithCoder: should work, since the file can't
84        /// know which device your data is allocated on, we
85        /// have to guess and may guess incorrectly.  To avoid
86        /// that problem, use initWithCoder:device instead.
87        ///
88        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
89        ///
90        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
91        ///
92        /// Returns: A new MPSKernel object, or nil if failure.
93        ///
94        /// # Safety
95        ///
96        /// `a_decoder` possibly has further requirements.
97        #[unsafe(method(initWithCoder:device:))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn initWithCoder_device(
100            this: Allocated<Self>,
101            a_decoder: &NSCoder,
102            device: &ProtocolObject<dyn MTLDevice>,
103        ) -> Option<Retained<Self>>;
104    );
105}
106
107/// Methods declared on superclass `MPSKernel`.
108#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
109impl MPSImageEuclideanDistanceTransform {
110    extern_methods!(
111        /// Called by NSCoder to decode MPSKernels
112        ///
113        /// This isn't the right interface to decode a MPSKernel, but
114        /// it is the one that NSCoder uses. To enable your NSCoder
115        /// (e.g. NSKeyedUnarchiver) to set which device to use
116        /// extend the object to adopt the MPSDeviceProvider
117        /// protocol. Otherwise, the Metal system default device
118        /// will be used.
119        ///
120        /// # Safety
121        ///
122        /// `a_decoder` possibly has further requirements.
123        #[unsafe(method(initWithCoder:))]
124        #[unsafe(method_family = init)]
125        pub unsafe fn initWithCoder(
126            this: Allocated<Self>,
127            a_decoder: &NSCoder,
128        ) -> Option<Retained<Self>>;
129    );
130}
131
132/// Methods declared on superclass `NSObject`.
133#[cfg(all(feature = "MPSCore", feature = "MPSImageKernel", feature = "MPSKernel"))]
134impl MPSImageEuclideanDistanceTransform {
135    extern_methods!(
136        #[unsafe(method(init))]
137        #[unsafe(method_family = init)]
138        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140        #[unsafe(method(new))]
141        #[unsafe(method_family = new)]
142        pub unsafe fn new() -> Retained<Self>;
143    );
144}