objc2_av_foundation/generated/AVPortraitEffectsMatte.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-video")]
6use objc2_core_video::*;
7use objc2_foundation::*;
8#[cfg(feature = "objc2-image-io")]
9use objc2_image_io::*;
10
11use crate::*;
12
13extern_class!(
14 /// An object wrapping a matting image used for high quality rendering of portrait style effects onto an image (i.e. shallow depth of field, stage lighting, etc).
15 ///
16 ///
17 /// The pixel data in the matting image is represented in CVPixelBuffers as kCVPixelFormatType_OneComponent8 ('L008'). It's stored in image files as an auxiliary image, accessible using CGImageSourceCopyAuxiliaryDataInfoAtIndex with the data type kCGImageAuxiliaryDataTypePortraitEffectsMatte (see
18 /// <ImageIO
19 /// /CGImageProperties.h>).
20 ///
21 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avportraiteffectsmatte?language=objc)
22 #[unsafe(super(NSObject))]
23 #[derive(Debug, PartialEq, Eq, Hash)]
24 pub struct AVPortraitEffectsMatte;
25);
26
27extern_conformance!(
28 unsafe impl NSObjectProtocol for AVPortraitEffectsMatte {}
29);
30
31impl AVPortraitEffectsMatte {
32 extern_methods!(
33 #[unsafe(method(init))]
34 #[unsafe(method_family = init)]
35 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
36
37 #[unsafe(method(new))]
38 #[unsafe(method_family = new)]
39 pub unsafe fn new() -> Retained<Self>;
40
41 /// Returns an AVPortraitEffectsMatte instance from auxiliary image information in an image file.
42 ///
43 ///
44 /// Parameter `imageSourceAuxDataInfoDictionary`: A dictionary of primitive portrait effects matte related information obtained from CGImageSourceCopyAuxiliaryDataInfoAtIndex.
45 ///
46 /// Parameter `outError`: On return, if the portrait effects matte cannot be created, points to an NSError describing the problem.
47 ///
48 /// Returns: An AVPortraitEffectsMatte instance, or nil if the auxiliary data info dictionary was malformed.
49 ///
50 ///
51 /// When using ImageIO framework's CGImageSource API to read from a HEIF or JPEG file containing a portrait effects matte, AVPortraitEffectsMatte can be instantiated using the result of CGImageSourceCopyAuxiliaryDataInfoAtIndex, which returns a CFDictionary of primitive map information.
52 ///
53 /// # Safety
54 ///
55 /// `image_source_aux_data_info_dictionary` generic should be of the correct type.
56 #[unsafe(method(portraitEffectsMatteFromDictionaryRepresentation:error:_))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn portraitEffectsMatteFromDictionaryRepresentation_error(
59 image_source_aux_data_info_dictionary: &NSDictionary,
60 ) -> Result<Retained<Self>, Retained<NSError>>;
61
62 #[cfg(feature = "objc2-image-io")]
63 /// Returns a derivative AVPortraitEffectsMatte instance in which the specified Exif orientation has been applied.
64 ///
65 ///
66 /// Parameter `exifOrientation`: One of the 8 standard Exif orientation tags expressing how the portrait effects matte should be rotated / mirrored.
67 ///
68 /// Returns: An AVPortraitEffectsMatte instance.
69 ///
70 ///
71 /// When applying simple 90 degree rotation or mirroring edits to media containing a portrait effects matte, you may use this initializer to create a derivative copy of the portrait effects matte in which the specified orientation is applied. This method throws an NSInvalidArgumentException if you pass an unrecognized exifOrientation.
72 #[unsafe(method(portraitEffectsMatteByApplyingExifOrientation:))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn portraitEffectsMatteByApplyingExifOrientation(
75 &self,
76 exif_orientation: CGImagePropertyOrientation,
77 ) -> Retained<Self>;
78
79 #[cfg(feature = "objc2-core-video")]
80 /// Returns an AVPortraitEffectsMatte instance wrapping the replacement pixel buffer.
81 ///
82 ///
83 /// Parameter `pixelBuffer`: A pixel buffer containing a portrait effects matting image, represented as kCVPixelFormatType_OneComponent8 with a kCVImageBufferTransferFunction_Linear transfer function.
84 ///
85 /// Parameter `outError`: On return, if the AVPortraitEffectsMatte cannot be created, points to an NSError describing the problem.
86 ///
87 /// Returns: An AVPortraitEffectsMatte instance, or nil if the pixel buffer is malformed.
88 ///
89 ///
90 /// When applying complex edits to media containing a portrait effects matte, you may create a derivative matte with arbitrary transforms applied to it, then use this initializer to create a new AVPortraitEffectsMatte.
91 #[unsafe(method(portraitEffectsMatteByReplacingPortraitEffectsMatteWithPixelBuffer:error:_))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn portraitEffectsMatteByReplacingPortraitEffectsMatteWithPixelBuffer_error(
94 &self,
95 pixel_buffer: &CVPixelBuffer,
96 ) -> Result<Retained<Self>, Retained<NSError>>;
97
98 /// Returns a dictionary of primitive map information to be used when writing an image file with a portrait effects matte.
99 ///
100 ///
101 /// Parameter `outAuxDataType`: On output, the auxiliary data type to be used when calling CGImageDestinationAddAuxiliaryDataInfo. Currently the only supported auxiliary data type is kCGImageAuxiliaryDataTypePortraitEffectsMatte.
102 ///
103 /// Returns: A dictionary of CGImageDestination compatible portrait effects matte information, or nil if the auxDataType is unsupported.
104 ///
105 ///
106 /// When using ImageIO framework's CGImageDestination API to write portrait effects matte information to a HEIF or JPEG file, you may use this method to generate a dictionary of primitive map information consumed by CGImageDestinationAddAuxiliaryDataInfo.
107 #[unsafe(method(dictionaryRepresentationForAuxiliaryDataType:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn dictionaryRepresentationForAuxiliaryDataType(
110 &self,
111 out_aux_data_type: Option<&mut Option<Retained<NSString>>>,
112 ) -> Option<Retained<NSDictionary>>;
113
114 /// Specifies the pixel format type of this object's internal matting image.
115 ///
116 ///
117 /// Currently the only supported CV pixel format type for the matting image is kCVPixelFormatType_OneComponent8.
118 #[unsafe(method(pixelFormatType))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn pixelFormatType(&self) -> OSType;
121
122 #[cfg(feature = "objc2-core-video")]
123 /// Provides access to the portrait effects matte's internal image.
124 ///
125 ///
126 /// The pixel format can be queried using the pixelFormatType property.
127 #[unsafe(method(mattingImage))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn mattingImage(&self) -> Retained<CVPixelBuffer>;
130 );
131}