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