Mac Developer Library

Developer

QuartzCore Framework Reference CIVector Class Reference

Options
Deployment Target:

On This Page
Language:

CIVector

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.

Inheritance


Conforms To


Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in OS X v10.4 and later.
  • Creates and returns a vector that is initialized with the specified values.

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Objective-C

    + (CIVector *)vectorWithX:(CGFloat)x

    Parameters

    x

    The value to initialize the vector with.

    Return Value

    A vector initialized with the specified value.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Objective-C

    + (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

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.4 and later.

  • Creates and returns a vector that is initialized with values provided by a CGAffineTransform structure.

    Declaration

    Objective-C

    + (CIVector *)vectorWithCGAffineTransform:(CGAffineTransform)t

    Parameters

    t

    A transform.

    Return Value

    A vector initialized with the specified values.

    Discussion

    The six values that comprise the affine transform fill the first six positions of the resulting CIVector object.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.9 and later.

  • Creates and returns a vector that is initialized with values provided by a CGPoint structure.

    Declaration

    Objective-C

    + (CIVector *)vectorWithCGPoint:(CGPoint)p

    Parameters

    p

    A point.

    Return Value

    A vector initialized with the specified values.

    Discussion

    The CGPoint structure’s X and Y values are stored in the vector’s X and Y properties.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.9 and later.

  • Creates and returns a vector that is initialized with values provided by a CGRect structure.

    Declaration

    Objective-C

    + (CIVector *)vectorWithCGRect:(CGRect)r

    Parameters

    r

    A rect.

    Return Value

    A vector initialized with the specified values.

    Discussion

    The CGRect structure’s X, Y, height and width values are stored in the vector’s X, Y, Z and W properties.

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.9 and later.

  • Initializes a vector with the provided values.

    Declaration

    Swift

    init!(values values: UnsafePointer<CGFloat>, count count: UInt)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    init!(x x: CGFloat)

    Objective-C

    - (id)initWithX:(CGFloat)x

    Parameters

    x

    The initialization value.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    init!(x x: CGFloat, y y: CGFloat)

    Objective-C

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

    Parameters

    x

    The initialization value for the first position.

    y

    The initialization value for the second position.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    init!(x x: CGFloat, y y: CGFloat, z z: CGFloat)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

  • Initializes four positions of a vector with the provided values.

    Declaration

    Swift

    init!(x x: CGFloat, y y: CGFloat, z z: CGFloat, w w: CGFloat)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

  • Initializes a vector with values provided in a string representation.

    Declaration

    Swift

    init!(string representation: String!)

    Objective-C

    - (id)initWithString:(NSString *)representation

    Parameters

    representation

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

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.

  • Initializes a vector that is initialized with values provided by a CGAffineTransform structure.

    Declaration

    Swift

    init!(CGAffineTransform r: CGAffineTransform)

    Objective-C

    - (id)initWithCGAffineTransform:(CGAffineTransform)r

    Parameters

    r

    A transform.

    Discussion

    The six values that comprise the affine transform fill the first six positions of the resulting CIVector object.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.9 and later.

  • Initializes a vector that is initialized with values provided by a CGPoint structure.

    Declaration

    Swift

    init!(CGPoint p: CGPoint)

    Objective-C

    - (id)initWithCGPoint:(CGPoint)p

    Parameters

    p

    A point.

    Discussion

    The CGPoint structure’s X and Y values are stored in the vector’s X and Y properties.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.9 and later.

  • Initializes a vector that is initialized with values provided by a CGRect structure.

    Declaration

    Swift

    init!(CGRect r: CGRect)

    Objective-C

    - (id)initWithCGRect:(CGRect)r

    Parameters

    r

    A rect.

    Discussion

    The CGRect structure’s X, Y, height and width values are stored in the vector’s X, Y, Z and W properties.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.9 and later.

  • Returns a value from a specific position in a vector.

    Declaration

    Swift

    func valueAtIndex(_ index: UInt) -> CGFloat

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

  • Returns the number of items in a vector.

    Declaration

    Swift

    func count() -> UInt

    Objective-C

    - (size_t)count

    Return Value

    The number of items in the vector.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    func X() -> CGFloat

    Objective-C

    - (CGFloat)X

    Return Value

    The value retrieved from the vector.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    func Y() -> CGFloat

    Objective-C

    - (CGFloat)Y

    Return Value

    The value retrieved from the vector.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    func Z() -> CGFloat

    Objective-C

    - (CGFloat)Z

    Return Value

    The value retrieved from the vector.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    func W() -> CGFloat

    Objective-C

    - (CGFloat)W

    Return Value

    The value retrieved from the vector.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

  • Returns a string representation for a vector.

    Declaration

    Swift

    func stringRepresentation() -> String!

    Objective-C

    - (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

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.4 and later.

  • Returns the values stored in the CIVector object as an affine transform.

    Declaration

    Swift

    func CGAffineTransformValue() -> CGAffineTransform

    Objective-C

    - (CGAffineTransform)CGAffineTransformValue

    Return Value

    A transform.

    Discussion

    The first six values in the vector become the values that comprise the affine transform.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.9 and later.

  • Returns the values stored in the CIVector object as a point.

    Declaration

    Swift

    func CGPointValue() -> CGPoint

    Objective-C

    - (CGPoint)CGPointValue

    Return Value

    A point.

    Discussion

    The vector’s X and Y property values become the CGPoint structure’s X and Y values.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.9 and later.

  • Returns the values stored in the CIVector object as an rect.

    Declaration

    Swift

    func CGRectValue() -> CGRect

    Objective-C

    - (CGRect)CGRectValue

    Return Value

    A rect.

    Discussion

    The vector’s X, Y, Z and W property values become the CGRect structure’s X, Y, height and width values.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.9 and later.