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