| Inherits from | |
| Conforms to | |
| Framework | Library/Frameworks/QuartzCore.framework |
| Availability | Mac OS X v10.4 and later
|
| Declared in | CIKernel.h |
| Companion guides |
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.
Creates and returns and array of CIKernel objects.
+ (NSArray *)kernelsWithString:(NSString *)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 kernel keyword.
An array of CIKernel objects. The array contains one CIKernel objects for each kernel routine in the supplied string.
See Core Image Kernel Language Reference for more details.
CIKernel.hReturns the name of a kernel routine.
- (NSString *)name
The name of the kernel routine.
CIKernel.hSets the selector used to query the region of interest of the kernel.
- (void)setROISelector:(SEL)aMethod
A selector name.
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:
samplerIndex defines the sampler to query
destRect is the extent of the region, in working space coordinates, to render.
userInfo is the object associated with the kCIApplyOptionUserInfo option when the kernel is applied to its arguments. The userInfo is important because instance variables can’t be used by the defining class. Instance variables must be passed through the userInfo argument.
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:)]
CIKernel.h
Last updated: 2006-12-05