CISampler Class Reference

Inherits from
Conforms to
Framework
Library/Frameworks/QuartzCore.framework
Availability
OS X v10.4 and later
Companion guide
Declared in
CISampler.h
Related sample code

Overview

The CISampler class retrieves samples of images for processing by a CIKernel object. A CISampler object defines a coordinate transform, and modes for interpolation and wrapping. You use CISampler objects in conjunction with other Core Image classes, such as CIFilter, CIKernel, and CIFilterShape, to create custom filters.

Tasks

Creating a Sampler

Initializing a Sampler

Getting Information About the Sampler Object

Class Methods

samplerWithImage:

Creates and returns a sampler that references an image.

+ (CISampler *)samplerWithImage:(CIImage *)im
Parameters
im

The image that you want the sampler to reference.

Return Value

A sampler object that references the image specified by the im argument.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

samplerWithImage:keysAndValues:

Creates and returns a sampler that references an image using options specified as key-value pairs.

+ (CISampler *)samplerWithImage:(CIImage *)im keysAndValues:key0, ...
Parameters
im

The image that you want the sampler to reference.

key0

A list of key-value pairs that represent options. Each key needs to be followed by that appropriate value. You can supply one or more key-value pairs. Use nil to specify the end of the key-value options. See “Sampler Option Keys”.

Return Value

A sampler that references the image specified by the im argument and uses the specified options.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

samplerWithImage:options:

Creates and returns a sampler that references an image using options specified in a dictionary.

+ (CISampler *)samplerWithImage:(CIImage *)im options:(NSDictionary *)dict
Parameters
im

The image that you want the sampler to reference.

dict

A dictionary that contains options specified as key-value pairs. See “Sampler Option Keys”.

Return Value

A sampler that references the image specified by the im argument and uses the options specified in the dictionary.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

Instance Methods

definition

Gets the domain of definition (DOD) of the sampler.

- (CIFilterShape *)definition
Return Value

The filter shape object that contains the DOD.

Discussion

The DOD contains all nontransparent pixels produced by referencing the sampler.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

extent

Gets the rectangle that specifies the extent of the sampler.

- (CGRect)extent
Return Value

The rectangle that specifies the area outside which the wrap mode set for the sampler is invoked.

Availability
  • OS X v10.4 and later.
Related Sample Code
Declared In
CISampler.h

initWithImage:

Initializes a sampler with an image object.

- (id)initWithImage:(CIImage *)im
Parameters
im

The image object to initialize the sampler with.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

initWithImage:keysAndValues:

Initializes the sampler with an image object using options specified as key-value pairs.

- (id)initWithImage:(CIImage *)im keysAndValues:key0, ...
Parameters
im

The image object to initialize the sampler with.

key0

A list of key-value pairs that represent options. Each key needs to be followed by that appropriate value. You can supply one or more key-value pairs. Use nil to specify the end of the key-value options. See “Sampler Option Keys”.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

initWithImage:options:

Initializes the sampler with an image object using options specified in a dictionary.

- (id)initWithImage:(CIImage *)im options:(NSDictionary *)dict
Parameters
im

The image to initialize the sampler with.

dict

A dictionary that contains options specified as key-value pairs. See “Sampler Option Keys”.

Availability
  • OS X v10.4 and later.
Declared In
CISampler.h

Constants

Sampler Option Keys

Keys for creating a sampler.

extern NSString *kCISamplerAffineMatrix;
extern NSString *kCISamplerWrapMode;
extern NSString *kCISamplerFilterMode
extern NSString *kCISamplerColorSpace
Constants
kCISamplerAffineMatrix

The key for an affine matrix. The associated value is an NSArray object ([a b c d tx ty]) that defines the transformation to apply to the sampler.

Available in OS X v10.4 and later.

Declared in CISampler.h.

kCISamplerWrapMode

The key for the sampler wrap mode. The wrap mode specifies how Core Image produces pixels that are outside the extent of the sample. Possible values are kCISamplerWrapBlack and kCISamplerWrapClamp.

Available in OS X v10.4 and later.

Declared in CISampler.h.

kCISamplerFilterMode

The key for the filtering to use when sampling the image. Possible values are kCISamplerFilterNearest and kCISamplerFilterLinear.

Available in OS X v10.4 and later.

Declared in CISampler.h.

kCISamplerColorSpace

The key for the color space to use when sampling the image. The associated value must be an RGB CGColorSpaceRef object. Using this option specifies that samples should be converted to this color space before being passed to a kernel. If not specified, samples will be passed to the kernel in the working color space of the Core Image context used to render the image.

Available in OS X v10.4 and later.

Declared in CISampler.h.

Declared In
CISampler.h

Sampler Option Values

Values for sampler option keys.

extern NSString *kCISamplerWrapBlack;
extern NSString *kCISamplerWrapClamp;
extern NSString *kCISamplerFilterNearest;
extern NSString *kCISamplerFilterLinear;
Constants
kCISamplerWrapBlack

Pixels are transparent black.

Available in OS X v10.4 and later.

Declared in CISampler.h.

kCISamplerWrapClamp

Coordinates are clamped to the extent.

Available in OS X v10.4 and later.

Declared in CISampler.h.

kCISamplerFilterNearest

Nearest neighbor sampling.

Available in OS X v10.4 and later.

Declared in CISampler.h.

kCISamplerFilterLinear

Bilinear interpolation.

Available in OS X v10.4 and later.

Declared in CISampler.h.

Declared In
CISampler.h