Inherits from NSObject
Conforms to NSCopying
PXPooledObject
Declared in PXColorTransform.h
PXColorTransform.m

Overview

A PXColorTransform object lets you adjust the values of each color channel of a display object.

The color of each pixel of a display object is calculated, right before rendering, like so:

New color value = old color value * colorMultiplier

Example: This sample adjusts an image so that only the red color channel is visible, by setting the multipliers for all the other channels to 0.

PXTexture *myImage = ...

...

PXColorTransform *newTransform = myImage.transform.colorTransform;
newTransform.redMultiplier = 1.0f;
newTransform.greenMultiplier = 0.0f;
newTransform.blueMultiplier = 0.0f;

myImage.transform.colorTransform = newTransform;

Tasks

Properties

alphaMultiplier

The alpha multiplier value ranging between 0.0f and 1.0f.

@property (nonatomic, assign) float alphaMultiplier

Declared In

PXColorTransform.h

blueMultiplier

The blue multiplier value ranging between 0.0f and 1.0f.

@property (nonatomic, assign) float blueMultiplier

Declared In

PXColorTransform.h

greenMultiplier

The green multiplier value ranging between 0.0f and 1.0f.

@property (nonatomic, assign) float greenMultiplier

Declared In

PXColorTransform.h

redMultiplier

The red multiplier value ranging between 0.0f and 1.0f.

@property (nonatomic, assign) float redMultiplier

Declared In

PXColorTransform.h

Class Methods

colorTransformWithRedMult:greenMult:blueMult:alphaMult:

Creates a color transform with the multipliers specified.

+ (PXColorTransform *)colorTransformWithRedMult:(float)r greenMult:(float)g blueMult:(float)b alphaMult:(float)a

Parameters

greenMultiplier

The green multiplier value ranging between 0.0f and 1.0f.

blueMultiplier

The blue multiplier value ranging between 0.0f and 1.0f.

redMultiplier

The red multiplier value ranging between 0.0f and 1.0f.

alphaMultiplier

The alpha multiplier value ranging between 0.0f and 1.0f.

Return Value

The created color transform.

Declared In

PXColorTransform.m

Instance Methods

initWithRedMult:greenMult:blueMult:alphaMult:

Initializes the color transform with the multipliers specified.

- (id)initWithRedMult:(float)r greenMult:(float)g blueMult:(float)b alphaMult:(float)a

Parameters

greenMultiplier

The green multiplier value ranging between 0.0f and 1.0f.

blueMultiplier

The blue multiplier value ranging between 0.0f and 1.0f.

redMultiplier

The red multiplier value ranging between 0.0f and 1.0f.

alphaMultiplier

The alpha multiplier value ranging between 0.0f and 1.0f.

Declared In

PXColorTransform.m

setMultipliersWithRed:green:blue:alpha:

Sets the multipliers to their corresponding values.

- (void)setMultipliersWithRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha

Parameters

red

The red multiplier value ranging between 0.0f and 1.0f.

green

The green multiplier value ranging between 0.0f and 1.0f.

blue

The blue multiplier value ranging between 0.0f and 1.0f.

alpha

The alpha multiplier value ranging between 0.0f and 1.0f.

Declared In

PXColorTransform.m

setMultipliersWithRedValue:greenValue:blueValue:alphaValue:

Accepts color values ranging from 0 to 255 (a simgle byte) and sets the color multipliers by converting them to percent values.

- (void)setMultipliersWithRedValue:(unsigned char)red greenValue:(unsigned char)green blueValue:(unsigned char)blue alphaValue:(unsigned char)alpha

Parameters

red

The red multiplier value ranging between 0 and 255.

green

The green multiplier value ranging between 0 and 255.

blue

The blue multiplier value ranging between 0 and 255.

alpha

The alpha multiplier value ranging between 0 and 255.

Declared In

PXColorTransform.m