objc2_core_image/generated/
CIRenderDestination.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10#[cfg(feature = "objc2-core-video")]
11use objc2_core_video::*;
12use objc2_foundation::*;
13#[cfg(feature = "objc2-io-surface")]
14use objc2_io_surface::*;
15#[cfg(feature = "objc2-metal")]
16use objc2_metal::*;
17
18use crate::*;
19
20/// [Apple's documentation](https://developer.apple.com/documentation/coreimage/cirenderdestinationalphamode?language=objc)
21// NS_ENUM
22#[repr(transparent)]
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
24pub struct CIRenderDestinationAlphaMode(pub NSUInteger);
25impl CIRenderDestinationAlphaMode {
26    #[doc(alias = "CIRenderDestinationAlphaNone")]
27    pub const None: Self = Self(0);
28    #[doc(alias = "CIRenderDestinationAlphaPremultiplied")]
29    pub const Premultiplied: Self = Self(1);
30    #[doc(alias = "CIRenderDestinationAlphaUnpremultiplied")]
31    pub const Unpremultiplied: Self = Self(2);
32}
33
34unsafe impl Encode for CIRenderDestinationAlphaMode {
35    const ENCODING: Encoding = NSUInteger::ENCODING;
36}
37
38unsafe impl RefEncode for CIRenderDestinationAlphaMode {
39    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42extern_class!(
43    /// [Apple's documentation](https://developer.apple.com/documentation/coreimage/cirenderdestination?language=objc)
44    #[unsafe(super(NSObject))]
45    #[derive(Debug, PartialEq, Eq, Hash)]
46    pub struct CIRenderDestination;
47);
48
49extern_conformance!(
50    unsafe impl NSObjectProtocol for CIRenderDestination {}
51);
52
53impl CIRenderDestination {
54    extern_methods!(
55        #[cfg(feature = "objc2-core-video")]
56        #[unsafe(method(initWithPixelBuffer:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithPixelBuffer(
59            this: Allocated<Self>,
60            pixel_buffer: &CVPixelBuffer,
61        ) -> Retained<Self>;
62
63        #[cfg(feature = "objc2-io-surface")]
64        #[unsafe(method(initWithIOSurface:))]
65        #[unsafe(method_family = init)]
66        pub unsafe fn initWithIOSurface(
67            this: Allocated<Self>,
68            surface: &IOSurface,
69        ) -> Retained<Self>;
70
71        #[cfg(feature = "objc2-metal")]
72        /// # Safety
73        ///
74        /// - `texture` may need to be synchronized.
75        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
76        #[unsafe(method(initWithMTLTexture:commandBuffer:))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn initWithMTLTexture_commandBuffer(
79            this: Allocated<Self>,
80            texture: &ProtocolObject<dyn MTLTexture>,
81            command_buffer: Option<&ProtocolObject<dyn MTLCommandBuffer>>,
82        ) -> Retained<Self>;
83
84        #[cfg(all(feature = "block2", feature = "objc2-metal"))]
85        /// # Safety
86        ///
87        /// `block` block's return must be a valid pointer.
88        #[unsafe(method(initWithWidth:height:pixelFormat:commandBuffer:mtlTextureProvider:))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn initWithWidth_height_pixelFormat_commandBuffer_mtlTextureProvider(
91            this: Allocated<Self>,
92            width: NSUInteger,
93            height: NSUInteger,
94            pixel_format: MTLPixelFormat,
95            command_buffer: Option<&ProtocolObject<dyn MTLCommandBuffer>>,
96            block: Option<&block2::DynBlock<dyn Fn() -> NonNull<ProtocolObject<dyn MTLTexture>>>>,
97        ) -> Retained<Self>;
98
99        #[unsafe(method(initWithGLTexture:target:width:height:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithGLTexture_target_width_height(
102            this: Allocated<Self>,
103            texture: c_uint,
104            target: c_uint,
105            width: NSUInteger,
106            height: NSUInteger,
107        ) -> Retained<Self>;
108
109        #[cfg(feature = "CIImage")]
110        /// # Safety
111        ///
112        /// `data` must be a valid pointer.
113        #[unsafe(method(initWithBitmapData:width:height:bytesPerRow:format:))]
114        #[unsafe(method_family = init)]
115        pub unsafe fn initWithBitmapData_width_height_bytesPerRow_format(
116            this: Allocated<Self>,
117            data: NonNull<c_void>,
118            width: NSUInteger,
119            height: NSUInteger,
120            bytes_per_row: NSUInteger,
121            format: CIFormat,
122        ) -> Retained<Self>;
123
124        #[unsafe(method(width))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn width(&self) -> NSUInteger;
127
128        #[unsafe(method(height))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn height(&self) -> NSUInteger;
131
132        #[unsafe(method(alphaMode))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn alphaMode(&self) -> CIRenderDestinationAlphaMode;
135
136        /// Setter for [`alphaMode`][Self::alphaMode].
137        #[unsafe(method(setAlphaMode:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setAlphaMode(&self, alpha_mode: CIRenderDestinationAlphaMode);
140
141        #[unsafe(method(isFlipped))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn isFlipped(&self) -> bool;
144
145        /// Setter for [`isFlipped`][Self::isFlipped].
146        #[unsafe(method(setFlipped:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setFlipped(&self, flipped: bool);
149
150        #[unsafe(method(isDithered))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn isDithered(&self) -> bool;
153
154        /// Setter for [`isDithered`][Self::isDithered].
155        #[unsafe(method(setDithered:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setDithered(&self, dithered: bool);
158
159        #[unsafe(method(isClamped))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn isClamped(&self) -> bool;
162
163        /// Setter for [`isClamped`][Self::isClamped].
164        #[unsafe(method(setClamped:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn setClamped(&self, clamped: bool);
167
168        #[cfg(feature = "objc2-core-graphics")]
169        #[unsafe(method(colorSpace))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn colorSpace(&self) -> Option<Retained<CGColorSpace>>;
172
173        #[cfg(feature = "objc2-core-graphics")]
174        /// Setter for [`colorSpace`][Self::colorSpace].
175        #[unsafe(method(setColorSpace:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setColorSpace(&self, color_space: Option<&CGColorSpace>);
178
179        #[cfg(feature = "CIKernel")]
180        #[unsafe(method(blendKernel))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn blendKernel(&self) -> Option<Retained<CIBlendKernel>>;
183
184        #[cfg(feature = "CIKernel")]
185        /// Setter for [`blendKernel`][Self::blendKernel].
186        #[unsafe(method(setBlendKernel:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setBlendKernel(&self, blend_kernel: Option<&CIBlendKernel>);
189
190        #[unsafe(method(blendsInDestinationColorSpace))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn blendsInDestinationColorSpace(&self) -> bool;
193
194        /// Setter for [`blendsInDestinationColorSpace`][Self::blendsInDestinationColorSpace].
195        #[unsafe(method(setBlendsInDestinationColorSpace:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn setBlendsInDestinationColorSpace(
198            &self,
199            blends_in_destination_color_space: bool,
200        );
201
202        /// Tell the next render using this destination to capture a Metal trace.
203        ///
204        /// If this property is set to a file-based URL, then the next render using this
205        /// destination will capture a Metal trace, deleting any existing file if present.
206        /// This property is nil by default.
207        #[unsafe(method(captureTraceURL))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn captureTraceURL(&self) -> Option<Retained<NSURL>>;
210
211        /// Setter for [`captureTraceURL`][Self::captureTraceURL].
212        #[unsafe(method(setCaptureTraceURL:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn setCaptureTraceURL(&self, capture_trace_url: Option<&NSURL>);
215    );
216}
217
218/// Methods declared on superclass `NSObject`.
219impl CIRenderDestination {
220    extern_methods!(
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
224
225        #[unsafe(method(new))]
226        #[unsafe(method_family = new)]
227        pub unsafe fn new() -> Retained<Self>;
228    );
229}
230
231extern_class!(
232    /// [Apple's documentation](https://developer.apple.com/documentation/coreimage/cirenderinfo?language=objc)
233    #[unsafe(super(NSObject))]
234    #[derive(Debug, PartialEq, Eq, Hash)]
235    pub struct CIRenderInfo;
236);
237
238extern_conformance!(
239    unsafe impl NSObjectProtocol for CIRenderInfo {}
240);
241
242impl CIRenderInfo {
243    extern_methods!(
244        #[unsafe(method(kernelExecutionTime))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn kernelExecutionTime(&self) -> NSTimeInterval;
247
248        #[unsafe(method(kernelCompileTime))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn kernelCompileTime(&self) -> NSTimeInterval;
251
252        #[unsafe(method(passCount))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn passCount(&self) -> NSInteger;
255
256        #[unsafe(method(pixelsProcessed))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn pixelsProcessed(&self) -> NSInteger;
259    );
260}
261
262/// Methods declared on superclass `NSObject`.
263impl CIRenderInfo {
264    extern_methods!(
265        #[unsafe(method(init))]
266        #[unsafe(method_family = init)]
267        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
268
269        #[unsafe(method(new))]
270        #[unsafe(method_family = new)]
271        pub unsafe fn new() -> Retained<Self>;
272    );
273}
274
275extern_class!(
276    /// [Apple's documentation](https://developer.apple.com/documentation/coreimage/cirendertask?language=objc)
277    #[unsafe(super(NSObject))]
278    #[derive(Debug, PartialEq, Eq, Hash)]
279    pub struct CIRenderTask;
280);
281
282extern_conformance!(
283    unsafe impl NSObjectProtocol for CIRenderTask {}
284);
285
286impl CIRenderTask {
287    extern_methods!(
288        #[unsafe(method(waitUntilCompletedAndReturnError:_))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn waitUntilCompletedAndReturnError(
291            &self,
292        ) -> Result<Retained<CIRenderInfo>, Retained<NSError>>;
293    );
294}
295
296/// Methods declared on superclass `NSObject`.
297impl CIRenderTask {
298    extern_methods!(
299        #[unsafe(method(init))]
300        #[unsafe(method_family = init)]
301        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
302
303        #[unsafe(method(new))]
304        #[unsafe(method_family = new)]
305        pub unsafe fn new() -> Retained<Self>;
306    );
307}
308
309/// CIRenderDestination.
310#[cfg(feature = "CIContext")]
311impl CIContext {
312    extern_methods!(
313        #[cfg(all(feature = "CIImage", feature = "objc2-core-foundation"))]
314        #[unsafe(method(startTaskToRender:fromRect:toDestination:atPoint:error:_))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn startTaskToRender_fromRect_toDestination_atPoint_error(
317            &self,
318            image: &CIImage,
319            from_rect: CGRect,
320            destination: &CIRenderDestination,
321            at_point: CGPoint,
322        ) -> Result<Retained<CIRenderTask>, Retained<NSError>>;
323
324        #[cfg(feature = "CIImage")]
325        #[unsafe(method(startTaskToRender:toDestination:error:_))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn startTaskToRender_toDestination_error(
328            &self,
329            image: &CIImage,
330            destination: &CIRenderDestination,
331        ) -> Result<Retained<CIRenderTask>, Retained<NSError>>;
332
333        #[cfg(all(feature = "CIImage", feature = "objc2-core-foundation"))]
334        #[unsafe(method(prepareRender:fromRect:toDestination:atPoint:error:_))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn prepareRender_fromRect_toDestination_atPoint_error(
337            &self,
338            image: &CIImage,
339            from_rect: CGRect,
340            destination: &CIRenderDestination,
341            at_point: CGPoint,
342        ) -> Result<(), Retained<NSError>>;
343
344        #[unsafe(method(startTaskToClear:error:_))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn startTaskToClear_error(
347            &self,
348            destination: &CIRenderDestination,
349        ) -> Result<Retained<CIRenderTask>, Retained<NSError>>;
350    );
351}