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#[cfg(feature = "objc2-image-io")]
11use objc2_image_io::*;
12
13use crate::*;
14
15/// AVSemanticSegmentationMatteType string constants
16///
17///
18/// 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.
19///
20/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetype?language=objc)
21// NS_TYPED_ENUM
22pub type AVSemanticSegmentationMatteType = NSString;
23
24extern "C" {
25    /// A matting image segmenting all skin from all persons in the visible field-of-view of an image.
26    ///
27    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypeskin?language=objc)
28    pub static AVSemanticSegmentationMatteTypeSkin: &'static AVSemanticSegmentationMatteType;
29}
30
31extern "C" {
32    /// A matting image segmenting all hair from all persons in the visible field-of-view of an image.
33    ///
34    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypehair?language=objc)
35    pub static AVSemanticSegmentationMatteTypeHair: &'static AVSemanticSegmentationMatteType;
36}
37
38extern "C" {
39    /// A matting image segmenting all teeth from all persons in the visible field-of-view of an image.
40    ///
41    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypeteeth?language=objc)
42    pub static AVSemanticSegmentationMatteTypeTeeth: &'static AVSemanticSegmentationMatteType;
43}
44
45extern "C" {
46    /// A matting image segmenting all glasses ( e.g. eyeglasses, sunglasses ) from all persons wearing glasses in the visible field-of-view of an image.
47    ///
48    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmattetypeglasses?language=objc)
49    pub static AVSemanticSegmentationMatteTypeGlasses: &'static AVSemanticSegmentationMatteType;
50}
51
52extern_class!(
53    /// An object wrapping a matting image for a particular semantic segmentation.
54    ///
55    ///
56    /// 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
57    /// <ImageIO
58    /// /CGImageProperties.h>.
59    ///
60    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avsemanticsegmentationmatte?language=objc)
61    #[unsafe(super(NSObject))]
62    #[derive(Debug, PartialEq, Eq, Hash)]
63    pub struct AVSemanticSegmentationMatte;
64);
65
66extern_conformance!(
67    unsafe impl NSObjectProtocol for AVSemanticSegmentationMatte {}
68);
69
70impl AVSemanticSegmentationMatte {
71    extern_methods!(
72        #[unsafe(method(init))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
75
76        #[unsafe(method(new))]
77        #[unsafe(method_family = new)]
78        pub unsafe fn new() -> Retained<Self>;
79
80        #[cfg(feature = "objc2-core-foundation")]
81        /// Returns an AVSemanticSegmentationMatte instance from auxiliary image information in an image file.
82        ///
83        ///
84        /// Parameter `imageSourceAuxiliaryDataType`: The kCGImageAuxiliaryDataType constant corresponding to the semantic segmentation matte being created (see
85        /// <ImageIO
86        /// /CGImageProperties.h>.
87        ///
88        /// Parameter `imageSourceAuxiliaryDataInfoDictionary`: A dictionary of primitive semantic segmentation matte related information obtained from CGImageSourceCopyAuxiliaryDataInfoAtIndex.
89        ///
90        /// Parameter `outError`: On return, if the semantic segmentation matte cannot be created, points to an NSError describing the problem.
91        ///
92        /// Returns: An AVSemanticSegmentationMatte instance, or nil if the auxiliary data info dictionary was malformed.
93        ///
94        ///
95        /// 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.
96        ///
97        /// # Safety
98        ///
99        /// `image_source_auxiliary_data_info_dictionary` generic should be of the correct type.
100        #[unsafe(method(semanticSegmentationMatteFromImageSourceAuxiliaryDataType:dictionaryRepresentation:error:_))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn semanticSegmentationMatteFromImageSourceAuxiliaryDataType_dictionaryRepresentation_error(
103            image_source_auxiliary_data_type: &CFString,
104            image_source_auxiliary_data_info_dictionary: &NSDictionary,
105        ) -> Result<Retained<Self>, Retained<NSError>>;
106
107        /// Specifies the receiver's semantic segmentation matting image type.
108        ///
109        ///
110        /// An AVSemanticSegmentationMatte's matteType is immutable for the life of the object.
111        #[unsafe(method(matteType))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn matteType(&self) -> Retained<AVSemanticSegmentationMatteType>;
114
115        #[cfg(feature = "objc2-image-io")]
116        /// Returns a derivative AVSemanticSegmentationMatte instance in which the specified Exif orientation has been applied.
117        ///
118        ///
119        /// Parameter `exifOrientation`: One of the 8 standard Exif orientation tags expressing how the matte should be rotated / mirrored.
120        ///
121        /// Returns: An AVSemanticSegmentationMatte's instance.
122        ///
123        ///
124        /// When applying simple 90 degree rotation or mirroring edits to media containing a semantic segmentation matte, you may use this initializer to create a derivative copy of the matte in which the specified orientation is applied. This method throws an NSInvalidArgumentException if you pass an unrecognized exifOrientation.
125        #[unsafe(method(semanticSegmentationMatteByApplyingExifOrientation:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn semanticSegmentationMatteByApplyingExifOrientation(
128            &self,
129            exif_orientation: CGImagePropertyOrientation,
130        ) -> Retained<Self>;
131
132        #[cfg(feature = "objc2-core-video")]
133        /// Returns an AVSemanticSegmentationMatte instance wrapping the replacement pixel buffer.
134        ///
135        ///
136        /// Parameter `pixelBuffer`: A pixel buffer containing a semantic segmentation matting image, represented as kCVPixelFormatType_OneComponent8 with a kCVImageBufferTransferFunction_Linear transfer function.
137        ///
138        /// Parameter `outError`: On return, if the AVSemanticSegmentationMatte cannot be created, points to an NSError describing the problem.
139        ///
140        /// Returns: An AVSemanticSegmentationMatte instance, or nil if the pixel buffer is malformed.
141        ///
142        ///
143        /// 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.
144        #[unsafe(method(semanticSegmentationMatteByReplacingSemanticSegmentationMatteWithPixelBuffer:error:_))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn semanticSegmentationMatteByReplacingSemanticSegmentationMatteWithPixelBuffer_error(
147            &self,
148            pixel_buffer: &CVPixelBuffer,
149        ) -> Result<Retained<Self>, Retained<NSError>>;
150
151        /// Returns a dictionary of primitive map information to be used when writing an image file with a semantic segmentation matte.
152        ///
153        ///
154        /// Parameter `outAuxDataType`: On output, the auxiliary data type to be used when calling CGImageDestinationAddAuxiliaryDataInfo. Currently supported auxiliary data types are enumerated in
155        /// <ImageIO
156        /// /CGImageProperties.h>
157        ///
158        /// Returns: A dictionary of CGImageDestination compatible semantic segmentation matte information, or nil if the auxDataType is unsupported.
159        ///
160        ///
161        /// 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.
162        #[unsafe(method(dictionaryRepresentationForAuxiliaryDataType:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn dictionaryRepresentationForAuxiliaryDataType(
165            &self,
166            out_aux_data_type: Option<&mut Option<Retained<NSString>>>,
167        ) -> Option<Retained<NSDictionary>>;
168
169        /// Specifies the pixel format type of this object's internal matting image.
170        ///
171        ///
172        /// Currently the only supported CV pixel format type for the matting image is kCVPixelFormatType_OneComponent8.
173        #[unsafe(method(pixelFormatType))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn pixelFormatType(&self) -> OSType;
176
177        #[cfg(feature = "objc2-core-video")]
178        /// Provides access to the semantic segmentation matte's internal image.
179        ///
180        ///
181        /// The pixel format can be queried using the pixelFormatType property.
182        #[unsafe(method(mattingImage))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn mattingImage(&self) -> Retained<CVPixelBuffer>;
185    );
186}