ColorMatrix is a 4x5 matrix containing color multiplication and offset values for tinting and other kinds of color manipulation. In addition to using the multiplier, offset and color properties, it can be edited directly as a Float32Array

Constructor

new (?data:Float32Array)

Creates a new ColorMatrix instance

Parameters:

data

(Optional) Initial Float32Array data to use

Variables

alphaMultiplier:Float

The current alpha multiplication value (default is 1.0)

alphaOffset:Float

The current alpha offset value (default is 0)

blueMultiplier:Float

The current blue multiplication value (default is 1.0)

blueOffset:Float

The current blue offset value (default is 0)

color:Int

Gets or sets a color offset for tinting.

This will change the red, green and blue multipliers to zero, and affect the red, green and blue offset values.

greenMultiplier:Float

The current green multiplication value (default is 1.0)

greenOffset:Float

The current green offset value (default is 0)

redMultiplier:Float

The current red multiplication value (default is 1.0)

redOffset:Float

The current red offset value (default is 0)

Methods

clone ():ColorMatrix

Creates a duplicate of the current ColorMatrix instance

Returns:

A new ColorMatrix instance

concat (second:ColorMatrix):Void

Adds the color multipliers from a second ColorMatrix to the current one

Parameters:

second

The ColorMatrix to concat to the current one

copyFrom (other:ColorMatrix):Void

Sets the current ColorMatrix values to the same as another one

Parameters:

other

The ColorMatrix to copy from

getAlphaTable ():UInt8Array

Returns a reference to a UInt8Array table for transforming alpha values using the current matrix.

The table is 256 values in length, and includes values based on the alphaMultipler and alphaOffset values of the matrix.

The values are constrained within 0 and 255.

For example:

var colorMatrix = new ColorMatrix ();
colorMatrix.alphaOffset = 12;

var alphaTable = colorMatrix.getAlphaTable ();
trace (alphaTable[0]); // 12
trace (alphaTable[1]); // 13

getBlueTable ():UInt8Array

Returns a reference to a UInt8Array table for transforming blue values using the current matrix.

The table is 256 values in length, and includes values based on the blueMultiplier and blueOffset values of the matrix.

The values are constrained within 0 and 255.

For example:

var colorMatrix = new ColorMatrix ();
colorMatrix.blueOffset = 16;

var blueTable = colorMatrix.getBlueTable ();
trace (blueTable[0]); // 16
trace (blueTable[1]); // 17

getGreenTable ():UInt8Array

Returns a reference to a UInt8Array table for transforming green values using the current matrix.

The table is 256 values in length, and includes values based on the greenMultiplier and greenOffset values of the matrix.

The values are constrained within 0 and 255.

For example:

var colorMatrix = new ColorMatrix ();
colorMatrix.greenOffset = 16;

var greenTable = colorMatrix.getGreenTable ();
trace (greenTable[0]); // 16
trace (greenTable[1]); // 17

getRedTable ():UInt8Array

Returns a reference to a UInt8Array table for transforming red values using the current matrix.

The table is 256 values in length, and includes values based on the redMultiplier and redOffset values of the matrix.

The values are constrained within 0 and 255.

For example:

var colorMatrix = new ColorMatrix ();
colorMatrix.redOffset = 16;

var redTable = colorMatrix.getRedTable ();
trace (redTable[0]); // 16
trace (redTable[1]); // 17

identity ():Void

Resets to default values