objc2_av_foundation/generated/
AVSemanticSegmentationMatte.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7#[cfg(feature = "objc2-core-video")]
8use objc2_core_video::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13/// AVSemanticSegmentationMatteType string constants
14///
15///
16/// AVSemanticSegmentationMatteType string constants describe specific types of semantic segmentation matting images that may be captured and stored along with a primary image and may be used to improve the rendering of various effects on that image.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetype?language=objc)
19// NS_TYPED_ENUM
20pub type AVSemanticSegmentationMatteType = NSString;
21
22extern "C" {
23    /// A matting image segmenting all skin from all persons in the visible field-of-view of an image.
24    ///
25    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypeskin?language=objc)
26    pub static AVSemanticSegmentationMatteTypeSkin: &'static AVSemanticSegmentationMatteType;
27}
28
29extern "C" {
30    /// A matting image segmenting all hair from all persons in the visible field-of-view of an image.
31    ///
32    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypehair?language=objc)
33    pub static AVSemanticSegmentationMatteTypeHair: &'static AVSemanticSegmentationMatteType;
34}
35
36extern "C" {
37    /// A matting image segmenting all teeth from all persons in the visible field-of-view of an image.
38    ///
39    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypeteeth?language=objc)
40    pub static AVSemanticSegmentationMatteTypeTeeth: &'static AVSemanticSegmentationMatteType;
41}
42
43extern "C" {
44    /// A matting image segmenting all glasses ( e.g. eyeglasses, sunglasses ) from all persons wearing glasses in the visible field-of-view of an image.
45    ///
46    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypeglasses?language=objc)
47    pub static AVSemanticSegmentationMatteTypeGlasses: &'static AVSemanticSegmentationMatteType;
48}
49
50extern_class!(
51    /// An object wrapping a matting image for a particular semantic segmentation.
52    ///
53    ///
54    /// The pixel data in the matting image is represented in CVPixelBuffers as kCVPixelFormatType_OneComponent8 ('L008'). It is stored in image files as an auxiliary image, accessible using CGImageSourceCopyAuxiliaryDataInfoAtIndex using data types defined in
55    /// <ImageIO
56    /// /CGImageProperties.h>.
57    ///
58    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmatte?language=objc)
59    #[unsafe(super(NSObject))]
60    #[derive(Debug, PartialEq, Eq, Hash)]
61    pub struct AVSemanticSegmentationMatte;
62);
63
64unsafe impl NSObjectProtocol for AVSemanticSegmentationMatte {}
65
66impl AVSemanticSegmentationMatte {
67    extern_methods!(
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71
72        #[unsafe(method(new))]
73        #[unsafe(method_family = new)]
74        pub unsafe fn new() -> Retained<Self>;
75
76        #[cfg(feature = "objc2-core-foundation")]
77        /// Returns an AVSemanticSegmentationMatte instance from auxiliary image information in an image file.
78        ///
79        ///
80        /// Parameter `imageSourceAuxiliaryDataType`: The kCGImageAuxiliaryDataType constant corresponding to the semantic segmentation matte being created (see
81        /// <ImageIO
82        /// /CGImageProperties.h>.
83        ///
84        /// Parameter `imageSourceAuxiliaryDataInfoDictionary`: A dictionary of primitive semantic segmentation matte related information obtained from CGImageSourceCopyAuxiliaryDataInfoAtIndex.
85        ///
86        /// Parameter `outError`: On return, if the semantic segmentation matte cannot be created, points to an NSError describing the problem.
87        ///
88        /// Returns: An AVSemanticSegmentationMatte instance, or nil if the auxiliary data info dictionary was malformed.
89        ///
90        ///
91        /// When using ImageIO framework's CGImageSource API to read from a HEIF or JPEG file containing a semantic segmentation matte, AVSemanticSegmentationMatte can be instantiated using the result of CGImageSourceCopyAuxiliaryDataInfoAtIndex, which returns a CFDictionary of primitive segmentation matte information.
92        #[unsafe(method(semanticSegmentationMatteFromImageSourceAuxiliaryDataType:dictionaryRepresentation:error:_))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn semanticSegmentationMatteFromImageSourceAuxiliaryDataType_dictionaryRepresentation_error(
95            image_source_auxiliary_data_type: &CFString,
96            image_source_auxiliary_data_info_dictionary: &NSDictionary,
97        ) -> Result<Retained<Self>, Retained<NSError>>;
98
99        /// Specifies the receiver's semantic segmentation matting image type.
100        ///
101        ///
102        /// An AVSemanticSegmentationMatte's matteType is immutable for the life of the object.
103        #[unsafe(method(matteType))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn matteType(&self) -> Retained<AVSemanticSegmentationMatteType>;
106
107        #[cfg(feature = "objc2-core-video")]
108        /// Returns an AVSemanticSegmentationMatte instance wrapping the replacement pixel buffer.
109        ///
110        ///
111        /// Parameter `pixelBuffer`: A pixel buffer containing a semantic segmentation matting image, represented as kCVPixelFormatType_OneComponent8 with a kCVImageBufferTransferFunction_Linear transfer function.
112        ///
113        /// Parameter `outError`: On return, if the AVSemanticSegmentationMatte cannot be created, points to an NSError describing the problem.
114        ///
115        /// Returns: An AVSemanticSegmentationMatte instance, or nil if the pixel buffer is malformed.
116        ///
117        ///
118        /// When applying complex edits to media containing a semantic segmentation matte, you may create a derivative matte with arbitrary transforms applied to it, then use this initializer to create a new AVSemanticSegmentationMatte.
119        #[unsafe(method(semanticSegmentationMatteByReplacingSemanticSegmentationMatteWithPixelBuffer:error:_))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn semanticSegmentationMatteByReplacingSemanticSegmentationMatteWithPixelBuffer_error(
122            &self,
123            pixel_buffer: &CVPixelBuffer,
124        ) -> Result<Retained<Self>, Retained<NSError>>;
125
126        /// Returns a dictionary of primitive map information to be used when writing an image file with a semantic segmentation matte.
127        ///
128        ///
129        /// Parameter `outAuxDataType`: On output, the auxiliary data type to be used when calling CGImageDestinationAddAuxiliaryDataInfo. Currently supported auxiliary data types are enumerated in
130        /// <ImageIO
131        /// /CGImageProperties.h>
132        ///
133        /// Returns: A dictionary of CGImageDestination compatible semantic segmentation matte information, or nil if the auxDataType is unsupported.
134        ///
135        ///
136        /// When using ImageIO framework's CGImageDestination API to write semantic segmentation matte information to a HEIF or JPEG file, you may use this method to generate a dictionary of primitive map information consumed by CGImageDestinationAddAuxiliaryDataInfo.
137        #[unsafe(method(dictionaryRepresentationForAuxiliaryDataType:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn dictionaryRepresentationForAuxiliaryDataType(
140            &self,
141            out_aux_data_type: Option<&mut Option<Retained<NSString>>>,
142        ) -> Option<Retained<NSDictionary>>;
143
144        /// Specifies the pixel format type of this object's internal matting image.
145        ///
146        ///
147        /// Currently the only supported CV pixel format type for the matting image is kCVPixelFormatType_OneComponent8.
148        #[unsafe(method(pixelFormatType))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn pixelFormatType(&self) -> OSType;
151
152        #[cfg(feature = "objc2-core-video")]
153        /// Provides access to the semantic segmentation matte's internal image.
154        ///
155        ///
156        /// The pixel format can be queried using the pixelFormatType property.
157        #[unsafe(method(mattingImage))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn mattingImage(&self) -> Retained<CVPixelBuffer>;
160    );
161}