Next Page > Hide TOC

CIVector Class Reference

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

Overview

The CIVector class is used for coordinate values and direction vectors. You typically use a CIVector object to pass parameter values to Core Image filters. CIVector objects work in conjunction with other Core Image classes, such as CIFilter, CIContext, CIImage, and CIColor, to process images using the Core Image framework.

Tasks

Creating a Vector

Initializing a Vector

Getting Values From a Vector

Class Methods

vectorWithString:

Creates and returns a vector that is initialized with values provided in a string representation.

+ (CIVector *)vectorWithString:(NSString *)representation

Parameters
representation

A string that is in one of the formats returned by the stringRepresentation method.

Discussion

Some typical string representations for vectors are:

@"[1.0 0.5 0.3]"

which specifies a vec3 vector whose components are X = 1.0, Y = 0.5, and Z = 0.3

@"[10.0 23.0]

which specifies a vec2 vector show components are X = 10.0 and Y = 23.0

Availability
See Also
Declared In
CIVector.h

vectorWithValues:count:

Creates and returns a vector that is initialized with the specified values.

+ (CIVector *)vectorWithValues:(const CGFloat *)values count:(size_t)count

Parameters
values

The values to initialize the vector with.

count

The number of values in the vector.

Return Value

A vector initialized with the provided values.

Availability
Declared In
CIVector.h

vectorWithX:

Creates and returns a vector that is initialized with one value.

+ (CIVector *)vectorWithX:(CGFloat)x

Parameters
x

The value to initialize the vector with.

Return Value

A vector initialized with the specified value.

Availability
Declared In
CIVector.h

vectorWithX:Y:

Creates and returns a vector that is initialized with two values.

+ (CIVector *)vectorWithX:(CGFloat)x Y:(CGFloat)y

Parameters
x

The value for the first position in the vector.

y

The value for the second position in the vector.

Return Value

A vector initialized with the specified values.

Availability
Related Sample Code
Declared In
CIVector.h

vectorWithX:Y:Z:

Creates and returns a vector that is initialized with three values.

+ (CIVector *)vectorWithX:(CGFloat)x Y:(CGFloat)y Z:(CGFloat)z

Parameters
x

The value for the first position in the vector.

y

The value for the second position in the vector.

z

The value for the third position in the vector.

Return Value

A vector initialized with the specified values.

Availability
Declared In
CIVector.h

vectorWithX:Y:Z:W:

Creates and returns a vector that is initialized with four values.

+ (CIVector *)vectorWithX:(CGFloat)x Y:(CGFloat)y Z:(CGFloat)z W:(CGFloat)w

Parameters
x

The value for the first position in the vector.

y

The value for the second position in the vector.

z

The value for the third position in the vector.

w

The value for the fourth position in the vector.

Return Value

A vector initialized with the specified values.

Availability
Related Sample Code
Declared In
CIVector.h

Instance Methods

count

Returns the number of items in a vector.

- (size_t)count

Return Value

The number of items in the vector.

Availability
Declared In
CIVector.h

initWithString:

Initializes a vector with values provided in a string representation.

- (id)initWithString:(NSString *)representation;

Parameters
representation

A string that is in one of the formats returned by the stringRepresentation method.

Availability
See Also
Declared In
CIVector.h

initWithValues:count:

Initializes a vector with the provided values.

- (id)initWithValues:(const CGFloat *)values count:(size_t)count

Parameters
values

The values to initialize the vector with.

count

The number of values specified by the values argument.

Availability
Declared In
CIVector.h

initWithX:

Initializes the first position of a vector with the provided values.

- (id)initWithX:(CGFloat)x

Parameters
x

The initialization value.

Availability
Declared In
CIVector.h

initWithX:Y:

Initializes the first two positions of a vector with the provided values.

- (id)initWithX:(CGFloat)x Y:(CGFloat)y

Parameters
x

The initialization value for the first position.

y

The initialization value for the second position.

Availability
Declared In
CIVector.h

initWithX:Y:Z:

Initializes the first three positions of a vector with the provided values.

- (id)initWithX:(CGFloat)x Y:(CGFloat)y Z:(CGFloat)z

Parameters
x

The initialization value for the first position.

y

The initialization value for the second position.

z

The initialization value for the third position.

Availability
Declared In
CIVector.h

initWithX:Y:Z:W:

Initializes four positions of a vector with the provided values.

- (id)initWithX:(CGFloat)x Y:(CGFloat)y Z:(CGFloat)z W:(CGFloat)w

Parameters
x

The initialization value for the first position.

y

The initialization value for the second position.

z

The initialization value for the third position.

w

The initialization value for the fourth position.

Availability
Declared In
CIVector.h

stringRepresentation

Returns a string representation for a vector.

- (NSString *)stringRepresentation

Return Value

A string object.

Discussion

You convert the string representation returned by this method to a vector by supplying it as a parameter to the vectorWithString: method.

Some typical string representations for vectors are:

@"[1.0 0.5 0.3]"

which specifies a vec3 vector whose components are X = 1.0, Y = 0.5, and Z = 0.3

@"[10.0 23.0]

which specifies a vec2 vector show components are X = 10.0 and Y = 23.0

Availability
See Also
Declared In
CIVector.h

valueAtIndex:

Returns a value from a specific position in a vector.

- (CGFloat)valueAtIndex:(size_t)index

Parameters
index

The position in the vector of the value that you want to retrieve.

Return Value

The value retrieved from the vector or 0 if the position is undefined.

Discussion

The numbering of elements in a vector begins with zero.

Availability
Declared In
CIVector.h

W

Returns the value located in the fourth position in a vector.

- (CGFloat)W

Return Value

The value retrieved from the vector.

Availability
Declared In
CIVector.h

X

Returns the value located in the first position in a vector.

- (CGFloat)X

Return Value

The value retrieved from the vector.

Availability
Related Sample Code
Declared In
CIVector.h

Y

Returns the value located in the second position in a vector.

- (CGFloat)Y

Return Value

The value retrieved from the vector.

Availability
Related Sample Code
Declared In
CIVector.h

Z

Returns the value located in the third position in a vector.

- (CGFloat)Z

Return Value

The value retrieved from the vector.

Availability
Declared In
CIVector.h

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-12-07)


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.