PXColorTransform Class Reference
| 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
-
redMultiplierThe red multiplier value ranging between 0.0f and 1.0f.
property -
greenMultiplierThe green multiplier value ranging between 0.0f and 1.0f.
property -
blueMultiplierThe blue multiplier value ranging between 0.0f and 1.0f.
property -
alphaMultiplierThe alpha multiplier value ranging between 0.0f and 1.0f.
property -
– initWithRedMult:greenMult:blueMult:alphaMult:Initializes the color transform with the multipliers specified.
-
– setMultipliersWithRed:green:blue:alpha:Sets the multipliers to their corresponding values.
-
– 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.
-
+ colorTransformWithRedMult:greenMult:blueMult:alphaMult:Creates a color transform with the multipliers specified.
Properties
alphaMultiplier
The alpha multiplier value ranging between 0.0f and 1.0f.
@property (nonatomic, assign) float alphaMultiplierDeclared In
PXColorTransform.hblueMultiplier
The blue multiplier value ranging between 0.0f and 1.0f.
@property (nonatomic, assign) float blueMultiplierDeclared In
PXColorTransform.hClass 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)aParameters
- 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.mInstance 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)aParameters
- 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.msetMultipliersWithRed:green:blue:alpha:
Sets the multipliers to their corresponding values.
- (void)setMultipliersWithRed:(float)red green:(float)green blue:(float)blue alpha:(float)alphaParameters
- 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.msetMultipliersWithRedValue: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)alphaParameters
- 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