CIKernel Class Reference
| Inherits from | |
| Conforms to | |
| Framework | Library/Frameworks/QuartzCore.framework |
| Availability | OS X v10.4 and later |
| Declared in | CIKernel.h |
| Companion guides | |
Overview
The CIKernel class maintains kernel routines that process individual pixels. The kernel routines in a CIKernel object use a subset of the OpenGL Shading Language and Core Image extensions to this language. You use a CIKernel object in conjunction with other Core Image classes, such as CIFilter, CIFilterShape, and CISampler, to create custom filters.
Class Methods
kernelsWithString:
Creates and returns and array of CIKernel objects.
Parameters
- s
A program in the Core Image dialect of the OpenGL Shading Language that contains one or more routines, each of which is marked using the
kernelkeyword.
Return Value
An array of CIKernel objects. The array contains one CIKernel objects for each kernel routine in the supplied string.
Discussion
See Core Image Kernel Language Reference for more details.
Availability
- OS X v10.4 and later.
Declared In
CIKernel.hInstance Methods
name
Returns the name of a kernel routine.
Return Value
The name of the kernel routine.
Availability
- OS X v10.4 and later.
Declared In
CIKernel.hsetROISelector:
Sets the selector used to query the region of interest of the kernel.
Parameters
- aMethod
A selector name.
Discussion
The aMethod argument must use the signature that is defined for the regionOf:destRect:userInfo: method, which is as follows:
- (CGRect) regionOf:(int)samplerIndex destRect:(CGRect)r userInfo:obj;
where:
samplerIndexdefines the sampler to querydestRectis the extent of the region, in working space coordinates, to render.userInfois the object associated with thekCIApplyOptionUserInfooption when the kernel is applied to its arguments. TheuserInfois important because instance variables can’t be used by the defining class. Instance variables must be passed through theuserInfoargument.
The regionOf:destRect:userInfo: method of the CIFilter object is called by the framework. This method returns the rectangle that contains the region of the sampler that the kernel needs to render the specified destination rectangle.
A sample regionOf:destRect:userInfo: method might look as follows:
- (CGRect)regionOf:(int)sampler destRect:(CGRect)r userInfo:params |
{ |
float scale = fabs ([params X]); |
return CGRectInset (r, scale * -1.3333, scale * -1.3333); |
} |
In the filter code, you set the selector using the following:
kernel setROISelector:@selector(regionOf:destRect:userInfo:)]
Availability
- OS X v10.4 and later.
Declared In
CIKernel.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-12-05)