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
9use crate::*;
10
11extern_class!(
12 /// 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).
13 ///
14 ///
15 /// 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
16 /// <ImageIO
17 /// /CGImageProperties.h>).
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avportraiteffectsmatte?language=objc)
20 #[unsafe(super(NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 pub struct AVPortraitEffectsMatte;
23);
24
25unsafe impl NSObjectProtocol for AVPortraitEffectsMatte {}
26
27impl AVPortraitEffectsMatte {
28 extern_methods!(
29 #[unsafe(method(init))]
30 #[unsafe(method_family = init)]
31 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
32
33 #[unsafe(method(new))]
34 #[unsafe(method_family = new)]
35 pub unsafe fn new() -> Retained<Self>;
36
37 /// Returns an AVPortraitEffectsMatte instance from auxiliary image information in an image file.
38 ///
39 ///
40 /// Parameter `imageSourceAuxDataInfoDictionary`: A dictionary of primitive portrait effects matte related information obtained from CGImageSourceCopyAuxiliaryDataInfoAtIndex.
41 ///
42 /// Parameter `outError`: On return, if the portrait effects matte cannot be created, points to an NSError describing the problem.
43 ///
44 /// Returns: An AVPortraitEffectsMatte instance, or nil if the auxiliary data info dictionary was malformed.
45 ///
46 ///
47 /// 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.
48 #[unsafe(method(portraitEffectsMatteFromDictionaryRepresentation:error:_))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn portraitEffectsMatteFromDictionaryRepresentation_error(
51 image_source_aux_data_info_dictionary: &NSDictionary,
52 ) -> Result<Retained<Self>, Retained<NSError>>;
53
54 #[cfg(feature = "objc2-core-video")]
55 /// Returns an AVPortraitEffectsMatte instance wrapping the replacement pixel buffer.
56 ///
57 ///
58 /// Parameter `pixelBuffer`: A pixel buffer containing a portrait effects matting image, represented as kCVPixelFormatType_OneComponent8 with a kCVImageBufferTransferFunction_Linear transfer function.
59 ///
60 /// Parameter `outError`: On return, if the AVPortraitEffectsMatte cannot be created, points to an NSError describing the problem.
61 ///
62 /// Returns: An AVPortraitEffectsMatte instance, or nil if the pixel buffer is malformed.
63 ///
64 ///
65 /// 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.
66 #[unsafe(method(portraitEffectsMatteByReplacingPortraitEffectsMatteWithPixelBuffer:error:_))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn portraitEffectsMatteByReplacingPortraitEffectsMatteWithPixelBuffer_error(
69 &self,
70 pixel_buffer: &CVPixelBuffer,
71 ) -> Result<Retained<Self>, Retained<NSError>>;
72
73 /// Returns a dictionary of primitive map information to be used when writing an image file with a portrait effects matte.
74 ///
75 ///
76 /// Parameter `outAuxDataType`: On output, the auxiliary data type to be used when calling CGImageDestinationAddAuxiliaryDataInfo. Currently the only supported auxiliary data type is kCGImageAuxiliaryDataTypePortraitEffectsMatte.
77 ///
78 /// Returns: A dictionary of CGImageDestination compatible portrait effects matte information, or nil if the auxDataType is unsupported.
79 ///
80 ///
81 /// 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.
82 #[unsafe(method(dictionaryRepresentationForAuxiliaryDataType:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn dictionaryRepresentationForAuxiliaryDataType(
85 &self,
86 out_aux_data_type: Option<&mut Option<Retained<NSString>>>,
87 ) -> Option<Retained<NSDictionary>>;
88
89 /// Specifies the pixel format type of this object's internal matting image.
90 ///
91 ///
92 /// Currently the only supported CV pixel format type for the matting image is kCVPixelFormatType_OneComponent8.
93 #[unsafe(method(pixelFormatType))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn pixelFormatType(&self) -> OSType;
96
97 #[cfg(feature = "objc2-core-video")]
98 /// Provides access to the portrait effects matte's internal image.
99 ///
100 ///
101 /// The pixel format can be queried using the pixelFormatType property.
102 #[unsafe(method(mattingImage))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn mattingImage(&self) -> Retained<CVPixelBuffer>;
105 );
106}