objc2_vision/generated/
VNDetectContoursRequest.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::*;
7
8use crate::*;
9
10extern_class!(
11    /// A request that will detect the contours for the edges in an image.
12    ///
13    ///
14    /// This request will produce a VNContoursObservation which describes the contours.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectcontoursrequest?language=objc)
17    #[unsafe(super(VNImageBasedRequest, VNRequest, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(feature = "VNRequest")]
20    pub struct VNDetectContoursRequest;
21);
22
23#[cfg(feature = "VNRequest")]
24unsafe impl NSCopying for VNDetectContoursRequest {}
25
26#[cfg(feature = "VNRequest")]
27unsafe impl CopyingHelper for VNDetectContoursRequest {
28    type Result = Self;
29}
30
31#[cfg(feature = "VNRequest")]
32unsafe impl NSObjectProtocol for VNDetectContoursRequest {}
33
34#[cfg(feature = "VNRequest")]
35impl VNDetectContoursRequest {
36    extern_methods!(
37        /// The amount to adjust the image's contrast by.
38        /// A value of +1.0 means that the contrast is not adjusted. The default value is +2.0.
39        ///
40        /// Contour detection works best with high contrast images. The default value of 2 doubles the image's contrast to aid in detection. If the image already has a high contrast then this value should be set to 1.
41        #[unsafe(method(contrastAdjustment))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn contrastAdjustment(&self) -> c_float;
44
45        /// Setter for [`contrastAdjustment`][Self::contrastAdjustment].
46        #[unsafe(method(setContrastAdjustment:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setContrastAdjustment(&self, contrast_adjustment: c_float);
49
50        /// The pixel value to use as a pivot for the contrast. Valid values are from [0.0 ... +1.0], or nil to auto-detect based on image intensity.
51        /// The default value is +0.5 (i.e. pixel center).
52        #[unsafe(method(contrastPivot))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn contrastPivot(&self) -> Option<Retained<NSNumber>>;
55
56        /// Setter for [`contrastPivot`][Self::contrastPivot].
57        #[unsafe(method(setContrastPivot:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setContrastPivot(&self, contrast_pivot: Option<&NSNumber>);
60
61        /// Identifies to the request if detecting a dark object on a light background, or vice versa, to aid in detection. The default value is YES.
62        #[unsafe(method(detectsDarkOnLight))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn detectsDarkOnLight(&self) -> bool;
65
66        /// Setter for [`detectsDarkOnLight`][Self::detectsDarkOnLight].
67        #[unsafe(method(setDetectsDarkOnLight:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn setDetectsDarkOnLight(&self, detects_dark_on_light: bool);
70
71        #[deprecated]
72        #[unsafe(method(detectDarkOnLight))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn detectDarkOnLight(&self) -> bool;
75
76        /// Setter for [`detectDarkOnLight`][Self::detectDarkOnLight].
77        #[deprecated]
78        #[unsafe(method(setDetectDarkOnLight:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setDetectDarkOnLight(&self, detect_dark_on_light: bool);
81
82        /// The limit on the maximum dimension of the image to be used for contour detection. Valid range of values is [64 ... NSUIntegerMax]. The default value is 512.
83        ///
84        /// As the contour request is compute intensive, the input image is scaled down maintaining aspect ratio (if needed), such that its maximum dimension is the value of this property. The image never gets scaled up, so specifying the maximum value ensures that the image gets processed in its original size and not downscaled.
85        #[unsafe(method(maximumImageDimension))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn maximumImageDimension(&self) -> NSUInteger;
88
89        /// Setter for [`maximumImageDimension`][Self::maximumImageDimension].
90        #[unsafe(method(setMaximumImageDimension:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setMaximumImageDimension(&self, maximum_image_dimension: NSUInteger);
93
94        #[cfg(feature = "VNObservation")]
95        /// VNContoursObservation results.
96        #[unsafe(method(results))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn results(&self) -> Option<Retained<NSArray<VNContoursObservation>>>;
99    );
100}
101
102/// Methods declared on superclass `VNRequest`.
103#[cfg(feature = "VNRequest")]
104impl VNDetectContoursRequest {
105    extern_methods!(
106        /// Creates a new VNRequest with no completion handler.
107        #[unsafe(method(init))]
108        #[unsafe(method_family = init)]
109        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
110
111        #[cfg(feature = "block2")]
112        /// Creates a new VNRequest with an optional completion handler.
113        ///
114        ///
115        /// Parameter `completionHandler`: The block to be invoked after the request has completed its processing. The completion handler gets executed on the same dispatch queue as the request being executed.
116        #[unsafe(method(initWithCompletionHandler:))]
117        #[unsafe(method_family = init)]
118        pub unsafe fn initWithCompletionHandler(
119            this: Allocated<Self>,
120            completion_handler: VNRequestCompletionHandler,
121        ) -> Retained<Self>;
122    );
123}
124
125/// Methods declared on superclass `NSObject`.
126#[cfg(feature = "VNRequest")]
127impl VNDetectContoursRequest {
128    extern_methods!(
129        #[unsafe(method(new))]
130        #[unsafe(method_family = new)]
131        pub unsafe fn new() -> Retained<Self>;
132    );
133}
134
135/// [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectcontourrequestrevision1?language=objc)
136pub static VNDetectContourRequestRevision1: NSUInteger = 1;