Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

CIKernel Class Reference

Inherits from
Conforms to
Framework
Library/Frameworks/QuartzCore.framework
Availability
Mac 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.

Tasks

Creating a Kernel

Getting a Kernel Name

Setting a Selector

Class Methods

kernelsWithString:

Creates and returns and array of CIKernel objects.

+ (NSArray *)kernelsWithString:(NSString *)s

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 kernel keyword.

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
Declared In
CIKernel.h

Instance Methods

name

Returns the name of a kernel routine.

- (NSString *)name

Return Value

The name of the kernel routine.

Availability
Declared In
CIKernel.h

setROISelector:

Sets the selector used to query the region of interest of the kernel.

- (void)setROISelector:(SEL)aMethod

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:

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
Declared In
CIKernel.h

Next Page > Hide TOC


Last updated: 2006-12-05




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice