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")]
24extern_conformance!(
25    unsafe impl NSCopying for VNDetectContoursRequest {}
26);
27
28#[cfg(feature = "VNRequest")]
29unsafe impl CopyingHelper for VNDetectContoursRequest {
30    type Result = Self;
31}
32
33#[cfg(feature = "VNRequest")]
34extern_conformance!(
35    unsafe impl NSObjectProtocol for VNDetectContoursRequest {}
36);
37
38#[cfg(feature = "VNRequest")]
39impl VNDetectContoursRequest {
40    extern_methods!(
41        /// The amount to adjust the image's contrast by.
42        /// A value of +1.0 means that the contrast is not adjusted. The default value is +2.0.
43        ///
44        /// 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.
45        #[unsafe(method(contrastAdjustment))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn contrastAdjustment(&self) -> c_float;
48
49        /// Setter for [`contrastAdjustment`][Self::contrastAdjustment].
50        #[unsafe(method(setContrastAdjustment:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn setContrastAdjustment(&self, contrast_adjustment: c_float);
53
54        /// 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.
55        /// The default value is +0.5 (i.e. pixel center).
56        #[unsafe(method(contrastPivot))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn contrastPivot(&self) -> Option<Retained<NSNumber>>;
59
60        /// Setter for [`contrastPivot`][Self::contrastPivot].
61        #[unsafe(method(setContrastPivot:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn setContrastPivot(&self, contrast_pivot: Option<&NSNumber>);
64
65        /// 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.
66        #[unsafe(method(detectsDarkOnLight))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn detectsDarkOnLight(&self) -> bool;
69
70        /// Setter for [`detectsDarkOnLight`][Self::detectsDarkOnLight].
71        #[unsafe(method(setDetectsDarkOnLight:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn setDetectsDarkOnLight(&self, detects_dark_on_light: bool);
74
75        #[deprecated]
76        #[unsafe(method(detectDarkOnLight))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn detectDarkOnLight(&self) -> bool;
79
80        /// Setter for [`detectDarkOnLight`][Self::detectDarkOnLight].
81        #[deprecated]
82        #[unsafe(method(setDetectDarkOnLight:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn setDetectDarkOnLight(&self, detect_dark_on_light: bool);
85
86        /// 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.
87        ///
88        /// 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.
89        #[unsafe(method(maximumImageDimension))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn maximumImageDimension(&self) -> NSUInteger;
92
93        /// Setter for [`maximumImageDimension`][Self::maximumImageDimension].
94        #[unsafe(method(setMaximumImageDimension:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn setMaximumImageDimension(&self, maximum_image_dimension: NSUInteger);
97
98        #[cfg(feature = "VNObservation")]
99        /// VNContoursObservation results.
100        #[unsafe(method(results))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn results(&self) -> Option<Retained<NSArray<VNContoursObservation>>>;
103    );
104}
105
106/// Methods declared on superclass `VNRequest`.
107#[cfg(feature = "VNRequest")]
108impl VNDetectContoursRequest {
109    extern_methods!(
110        /// Creates a new VNRequest with no completion handler.
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[cfg(feature = "block2")]
116        /// Creates a new VNRequest with an optional completion handler.
117        ///
118        ///
119        /// 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.
120        #[unsafe(method(initWithCompletionHandler:))]
121        #[unsafe(method_family = init)]
122        pub unsafe fn initWithCompletionHandler(
123            this: Allocated<Self>,
124            completion_handler: VNRequestCompletionHandler,
125        ) -> Retained<Self>;
126    );
127}
128
129/// Methods declared on superclass `NSObject`.
130#[cfg(feature = "VNRequest")]
131impl VNDetectContoursRequest {
132    extern_methods!(
133        #[unsafe(method(new))]
134        #[unsafe(method_family = new)]
135        pub unsafe fn new() -> Retained<Self>;
136    );
137}
138
139/// [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectcontourrequestrevision1?language=objc)
140pub static VNDetectContourRequestRevision1: NSUInteger = 1;