objc2-vision 0.3.2

Bindings to the Vision framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A request that will detect rectangles in an image.
    ///
    ///
    /// This request will generate VNRectangleObservation objects describing the location of rectangles detected in an image.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectrectanglesrequest?language=objc)
    #[unsafe(super(VNImageBasedRequest, VNRequest, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VNRequest")]
    pub struct VNDetectRectanglesRequest;
);

#[cfg(feature = "VNRequest")]
extern_conformance!(
    unsafe impl NSCopying for VNDetectRectanglesRequest {}
);

#[cfg(feature = "VNRequest")]
unsafe impl CopyingHelper for VNDetectRectanglesRequest {
    type Result = Self;
}

#[cfg(feature = "VNRequest")]
extern_conformance!(
    unsafe impl NSObjectProtocol for VNDetectRectanglesRequest {}
);

#[cfg(feature = "VNRequest")]
impl VNDetectRectanglesRequest {
    extern_methods!(
        #[cfg(feature = "VNTypes")]
        /// Specifies the minimum aspect ratio of the rectangle(s) to look for, range [0.0, 1.0], default 0.5
        #[unsafe(method(minimumAspectRatio))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumAspectRatio(&self) -> VNAspectRatio;

        #[cfg(feature = "VNTypes")]
        /// Setter for [`minimumAspectRatio`][Self::minimumAspectRatio].
        #[unsafe(method(setMinimumAspectRatio:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumAspectRatio(&self, minimum_aspect_ratio: VNAspectRatio);

        #[cfg(feature = "VNTypes")]
        /// Specifies the maximum aspect ratio of the rectangle(s) to look for, range [0.0, 1.0], default 1.0
        #[unsafe(method(maximumAspectRatio))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumAspectRatio(&self) -> VNAspectRatio;

        #[cfg(feature = "VNTypes")]
        /// Setter for [`maximumAspectRatio`][Self::maximumAspectRatio].
        #[unsafe(method(setMaximumAspectRatio:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaximumAspectRatio(&self, maximum_aspect_ratio: VNAspectRatio);

        #[cfg(feature = "VNTypes")]
        /// Specifies the maximum number of degrees a rectangle corner angle can deviate from 90 degrees, range [0,45], default 30
        #[unsafe(method(quadratureTolerance))]
        #[unsafe(method_family = none)]
        pub unsafe fn quadratureTolerance(&self) -> VNDegrees;

        #[cfg(feature = "VNTypes")]
        /// Setter for [`quadratureTolerance`][Self::quadratureTolerance].
        #[unsafe(method(setQuadratureTolerance:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setQuadratureTolerance(&self, quadrature_tolerance: VNDegrees);

        /// Specifies the minimum size of the rectangle to be detected, as a proportion of the smallest dimension, range [0.0, 1.0], default .2. Any smaller rectangles that may have been detected will not be returned.
        #[unsafe(method(minimumSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumSize(&self) -> c_float;

        /// Setter for [`minimumSize`][Self::minimumSize].
        #[unsafe(method(setMinimumSize:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumSize(&self, minimum_size: c_float);

        #[cfg(feature = "VNTypes")]
        /// Specifies a minimum confidence score, range [0.0, 1.0], default 0.0. Any rectangles with a lower confidence score will not be returned.
        #[unsafe(method(minimumConfidence))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumConfidence(&self) -> VNConfidence;

        #[cfg(feature = "VNTypes")]
        /// Setter for [`minimumConfidence`][Self::minimumConfidence].
        #[unsafe(method(setMinimumConfidence:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumConfidence(&self, minimum_confidence: VNConfidence);

        /// Specifies the maximum number of rectangles to be returned.  The default is 1.  Setting this property to 0 will allow an unlimited number of observations to be returned.
        #[unsafe(method(maximumObservations))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumObservations(&self) -> NSUInteger;

        /// Setter for [`maximumObservations`][Self::maximumObservations].
        #[unsafe(method(setMaximumObservations:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaximumObservations(&self, maximum_observations: NSUInteger);

        #[cfg(feature = "VNObservation")]
        /// VNRectangleObservation results.
        #[unsafe(method(results))]
        #[unsafe(method_family = none)]
        pub unsafe fn results(&self) -> Option<Retained<NSArray<VNRectangleObservation>>>;
    );
}

/// Methods declared on superclass `VNRequest`.
#[cfg(feature = "VNRequest")]
impl VNDetectRectanglesRequest {
    extern_methods!(
        /// Creates a new VNRequest with no completion handler.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// Creates a new VNRequest with an optional completion handler.
        ///
        ///
        /// 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.
        ///
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer or null.
        #[unsafe(method(initWithCompletionHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCompletionHandler(
            this: Allocated<Self>,
            completion_handler: VNRequestCompletionHandler,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "VNRequest")]
impl VNDetectRectanglesRequest {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectrectanglesrequestrevision1?language=objc)
pub static VNDetectRectanglesRequestRevision1: NSUInteger = 1;