objc2_core_image/generated/
CIKernel.rs1use 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::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14#[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
16pub type CIKernelROICallback = *mut block2::DynBlock<dyn Fn(c_int, CGRect) -> CGRect>;
17
18extern_class!(
19 #[unsafe(super(NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 pub struct CIKernel;
23);
24
25unsafe impl Send for CIKernel {}
26
27unsafe impl Sync for CIKernel {}
28
29extern_conformance!(
30 unsafe impl NSObjectProtocol for CIKernel {}
31);
32
33impl CIKernel {
34 extern_methods!(
35 #[deprecated = "Core Image Kernel Language API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)"]
36 #[unsafe(method(kernelsWithString:))]
37 #[unsafe(method_family = none)]
38 pub unsafe fn kernelsWithString(string: &NSString) -> Option<Retained<NSArray<CIKernel>>>;
39
40 #[unsafe(method(kernelsWithMetalString:error:_))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn kernelsWithMetalString_error(
43 source: &NSString,
44 ) -> Result<Retained<NSArray<CIKernel>>, Retained<NSError>>;
45
46 #[deprecated = "Core Image Kernel Language API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)"]
47 #[unsafe(method(kernelWithString:))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn kernelWithString(string: &NSString) -> Option<Retained<Self>>;
50
51 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:error:_))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_error(
54 name: &NSString,
55 data: &NSData,
56 ) -> Result<Retained<Self>, Retained<NSError>>;
57
58 #[cfg(feature = "CIImage")]
59 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:outputPixelFormat:error:_))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_outputPixelFormat_error(
62 name: &NSString,
63 data: &NSData,
64 format: CIFormat,
65 ) -> Result<Retained<Self>, Retained<NSError>>;
66
67 #[unsafe(method(kernelNamesFromMetalLibraryData:))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn kernelNamesFromMetalLibraryData(data: &NSData)
70 -> Retained<NSArray<NSString>>;
71
72 #[unsafe(method(name))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn name(&self) -> Retained<NSString>;
75
76 #[unsafe(method(setROISelector:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn setROISelector(&self, method: Sel);
82
83 #[cfg(all(
84 feature = "CIImage",
85 feature = "block2",
86 feature = "objc2-core-foundation"
87 ))]
88 #[unsafe(method(applyWithExtent:roiCallback:arguments:))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn applyWithExtent_roiCallback_arguments(
95 &self,
96 extent: CGRect,
97 callback: CIKernelROICallback,
98 args: &NSArray<AnyObject>,
99 ) -> Option<Retained<CIImage>>;
100 );
101}
102
103impl CIKernel {
105 extern_methods!(
106 #[unsafe(method(init))]
107 #[unsafe(method_family = init)]
108 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
109
110 #[unsafe(method(new))]
111 #[unsafe(method_family = new)]
112 pub unsafe fn new() -> Retained<Self>;
113 );
114}
115
116extern_class!(
117 #[unsafe(super(CIKernel, NSObject))]
119 #[derive(Debug, PartialEq, Eq, Hash)]
120 pub struct CIColorKernel;
121);
122
123unsafe impl Send for CIColorKernel {}
124
125unsafe impl Sync for CIColorKernel {}
126
127extern_conformance!(
128 unsafe impl NSObjectProtocol for CIColorKernel {}
129);
130
131impl CIColorKernel {
132 extern_methods!(
133 #[deprecated = "Core Image Kernel Language API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)"]
134 #[unsafe(method(kernelWithString:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn kernelWithString(string: &NSString) -> Option<Retained<Self>>;
137
138 #[cfg(all(feature = "CIImage", feature = "objc2-core-foundation"))]
139 #[unsafe(method(applyWithExtent:arguments:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn applyWithExtent_arguments(
145 &self,
146 extent: CGRect,
147 args: &NSArray<AnyObject>,
148 ) -> Option<Retained<CIImage>>;
149 );
150}
151
152impl CIColorKernel {
154 extern_methods!(
155 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:error:_))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_error(
158 name: &NSString,
159 data: &NSData,
160 ) -> Result<Retained<Self>, Retained<NSError>>;
161
162 #[cfg(feature = "CIImage")]
163 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:outputPixelFormat:error:_))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_outputPixelFormat_error(
166 name: &NSString,
167 data: &NSData,
168 format: CIFormat,
169 ) -> Result<Retained<Self>, Retained<NSError>>;
170 );
171}
172
173impl CIColorKernel {
175 extern_methods!(
176 #[unsafe(method(init))]
177 #[unsafe(method_family = init)]
178 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179
180 #[unsafe(method(new))]
181 #[unsafe(method_family = new)]
182 pub unsafe fn new() -> Retained<Self>;
183 );
184}
185
186extern_class!(
187 #[unsafe(super(CIKernel, NSObject))]
189 #[derive(Debug, PartialEq, Eq, Hash)]
190 pub struct CIWarpKernel;
191);
192
193unsafe impl Send for CIWarpKernel {}
194
195unsafe impl Sync for CIWarpKernel {}
196
197extern_conformance!(
198 unsafe impl NSObjectProtocol for CIWarpKernel {}
199);
200
201impl CIWarpKernel {
202 extern_methods!(
203 #[deprecated = "Core Image Kernel Language API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)"]
204 #[unsafe(method(kernelWithString:))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn kernelWithString(string: &NSString) -> Option<Retained<Self>>;
207
208 #[cfg(all(
209 feature = "CIImage",
210 feature = "block2",
211 feature = "objc2-core-foundation"
212 ))]
213 #[unsafe(method(applyWithExtent:roiCallback:inputImage:arguments:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn applyWithExtent_roiCallback_inputImage_arguments(
220 &self,
221 extent: CGRect,
222 callback: CIKernelROICallback,
223 image: &CIImage,
224 args: &NSArray<AnyObject>,
225 ) -> Option<Retained<CIImage>>;
226 );
227}
228
229impl CIWarpKernel {
231 extern_methods!(
232 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:error:_))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_error(
235 name: &NSString,
236 data: &NSData,
237 ) -> Result<Retained<Self>, Retained<NSError>>;
238
239 #[cfg(feature = "CIImage")]
240 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:outputPixelFormat:error:_))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_outputPixelFormat_error(
243 name: &NSString,
244 data: &NSData,
245 format: CIFormat,
246 ) -> Result<Retained<Self>, Retained<NSError>>;
247 );
248}
249
250impl CIWarpKernel {
252 extern_methods!(
253 #[unsafe(method(init))]
254 #[unsafe(method_family = init)]
255 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
256
257 #[unsafe(method(new))]
258 #[unsafe(method_family = new)]
259 pub unsafe fn new() -> Retained<Self>;
260 );
261}
262
263extern_class!(
264 #[unsafe(super(CIColorKernel, CIKernel, NSObject))]
266 #[derive(Debug, PartialEq, Eq, Hash)]
267 pub struct CIBlendKernel;
268);
269
270unsafe impl Send for CIBlendKernel {}
271
272unsafe impl Sync for CIBlendKernel {}
273
274extern_conformance!(
275 unsafe impl NSObjectProtocol for CIBlendKernel {}
276);
277
278impl CIBlendKernel {
279 extern_methods!(
280 #[deprecated = "Core Image Kernel Language API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)"]
281 #[unsafe(method(kernelWithString:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn kernelWithString(string: &NSString) -> Option<Retained<Self>>;
284
285 #[cfg(feature = "CIImage")]
286 #[unsafe(method(applyWithForeground:background:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn applyWithForeground_background(
289 &self,
290 foreground: &CIImage,
291 background: &CIImage,
292 ) -> Option<Retained<CIImage>>;
293
294 #[cfg(all(feature = "CIImage", feature = "objc2-core-graphics"))]
295 #[unsafe(method(applyWithForeground:background:colorSpace:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn applyWithForeground_background_colorSpace(
298 &self,
299 foreground: &CIImage,
300 background: &CIImage,
301 color_space: &CGColorSpace,
302 ) -> Option<Retained<CIImage>>;
303 );
304}
305
306impl CIBlendKernel {
308 extern_methods!(
309 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:error:_))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_error(
312 name: &NSString,
313 data: &NSData,
314 ) -> Result<Retained<Self>, Retained<NSError>>;
315
316 #[cfg(feature = "CIImage")]
317 #[unsafe(method(kernelWithFunctionName:fromMetalLibraryData:outputPixelFormat:error:_))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn kernelWithFunctionName_fromMetalLibraryData_outputPixelFormat_error(
320 name: &NSString,
321 data: &NSData,
322 format: CIFormat,
323 ) -> Result<Retained<Self>, Retained<NSError>>;
324 );
325}
326
327impl CIBlendKernel {
329 extern_methods!(
330 #[unsafe(method(init))]
331 #[unsafe(method_family = init)]
332 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
333
334 #[unsafe(method(new))]
335 #[unsafe(method_family = new)]
336 pub unsafe fn new() -> Retained<Self>;
337 );
338}
339
340impl CIBlendKernel {
342 extern_methods!(
343 #[unsafe(method(componentAdd))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn componentAdd() -> Retained<CIBlendKernel>;
346
347 #[unsafe(method(componentMultiply))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn componentMultiply() -> Retained<CIBlendKernel>;
350
351 #[unsafe(method(componentMin))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn componentMin() -> Retained<CIBlendKernel>;
354
355 #[unsafe(method(componentMax))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn componentMax() -> Retained<CIBlendKernel>;
358
359 #[unsafe(method(clear))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn clear() -> Retained<CIBlendKernel>;
362
363 #[unsafe(method(source))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn source() -> Retained<CIBlendKernel>;
366
367 #[unsafe(method(destination))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn destination() -> Retained<CIBlendKernel>;
370
371 #[unsafe(method(sourceOver))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn sourceOver() -> Retained<CIBlendKernel>;
374
375 #[unsafe(method(destinationOver))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn destinationOver() -> Retained<CIBlendKernel>;
378
379 #[unsafe(method(sourceIn))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn sourceIn() -> Retained<CIBlendKernel>;
382
383 #[unsafe(method(destinationIn))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn destinationIn() -> Retained<CIBlendKernel>;
386
387 #[unsafe(method(sourceOut))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn sourceOut() -> Retained<CIBlendKernel>;
390
391 #[unsafe(method(destinationOut))]
392 #[unsafe(method_family = none)]
393 pub unsafe fn destinationOut() -> Retained<CIBlendKernel>;
394
395 #[unsafe(method(sourceAtop))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn sourceAtop() -> Retained<CIBlendKernel>;
398
399 #[unsafe(method(destinationAtop))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn destinationAtop() -> Retained<CIBlendKernel>;
402
403 #[unsafe(method(exclusiveOr))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn exclusiveOr() -> Retained<CIBlendKernel>;
406
407 #[unsafe(method(multiply))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn multiply() -> Retained<CIBlendKernel>;
410
411 #[unsafe(method(screen))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn screen() -> Retained<CIBlendKernel>;
414
415 #[unsafe(method(overlay))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn overlay() -> Retained<CIBlendKernel>;
418
419 #[unsafe(method(darken))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn darken() -> Retained<CIBlendKernel>;
422
423 #[unsafe(method(lighten))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn lighten() -> Retained<CIBlendKernel>;
426
427 #[unsafe(method(colorDodge))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn colorDodge() -> Retained<CIBlendKernel>;
430
431 #[unsafe(method(colorBurn))]
432 #[unsafe(method_family = none)]
433 pub unsafe fn colorBurn() -> Retained<CIBlendKernel>;
434
435 #[unsafe(method(hardLight))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn hardLight() -> Retained<CIBlendKernel>;
438
439 #[unsafe(method(softLight))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn softLight() -> Retained<CIBlendKernel>;
442
443 #[unsafe(method(difference))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn difference() -> Retained<CIBlendKernel>;
446
447 #[unsafe(method(exclusion))]
448 #[unsafe(method_family = none)]
449 pub unsafe fn exclusion() -> Retained<CIBlendKernel>;
450
451 #[unsafe(method(hue))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn hue() -> Retained<CIBlendKernel>;
454
455 #[unsafe(method(saturation))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn saturation() -> Retained<CIBlendKernel>;
458
459 #[unsafe(method(color))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn color() -> Retained<CIBlendKernel>;
462
463 #[unsafe(method(luminosity))]
464 #[unsafe(method_family = none)]
465 pub unsafe fn luminosity() -> Retained<CIBlendKernel>;
466
467 #[unsafe(method(subtract))]
468 #[unsafe(method_family = none)]
469 pub unsafe fn subtract() -> Retained<CIBlendKernel>;
470
471 #[unsafe(method(divide))]
472 #[unsafe(method_family = none)]
473 pub unsafe fn divide() -> Retained<CIBlendKernel>;
474
475 #[unsafe(method(linearBurn))]
476 #[unsafe(method_family = none)]
477 pub unsafe fn linearBurn() -> Retained<CIBlendKernel>;
478
479 #[unsafe(method(linearDodge))]
480 #[unsafe(method_family = none)]
481 pub unsafe fn linearDodge() -> Retained<CIBlendKernel>;
482
483 #[unsafe(method(vividLight))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn vividLight() -> Retained<CIBlendKernel>;
486
487 #[unsafe(method(linearLight))]
488 #[unsafe(method_family = none)]
489 pub unsafe fn linearLight() -> Retained<CIBlendKernel>;
490
491 #[unsafe(method(pinLight))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn pinLight() -> Retained<CIBlendKernel>;
494
495 #[unsafe(method(hardMix))]
496 #[unsafe(method_family = none)]
497 pub unsafe fn hardMix() -> Retained<CIBlendKernel>;
498
499 #[unsafe(method(darkerColor))]
500 #[unsafe(method_family = none)]
501 pub unsafe fn darkerColor() -> Retained<CIBlendKernel>;
502
503 #[unsafe(method(lighterColor))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn lighterColor() -> Retained<CIBlendKernel>;
506 );
507}