The ColorMatrix class calculates and stores color matrixes based on given values. This class extends the DynamicMatrix class and also supports the ColorMatrixFilter class.

See also:

Constructor

new()

Calculates and stores color matrixes based on given values.

See also:

  • DynamicMatrix

Methods

getFlatArray():Null<Array<Float>>

Calculates and returns a flat array of 20 numerical values representing the four matrixes set in this object.

Returns:

An array of 20 items.

setBrightnessMatrix(value:Float):Void

Calculates and stores a brightness matrix based on the given value.

Parameters:

value

0-255

setContrastMatrix(value:Float):Void

Calculates and stores a contrast matrix based on the given value.

Parameters:

value

0 - 255

setHueMatrix(angle:Float):Void

Calculates and stores a hue matrix based on the given value.

Parameters:

value

0-255

setSaturationMatrix(value:Float):Void

Calculates and stores a saturation matrix based on the given value.

Parameters:

value

0-255

Inherited Variables

Inherited Methods

Defined by DynamicMatrix

add(inMatrix:DynamicMatrix):Bool

Adds the current matrix with a specified matrix. The current matrix becomes the result of the addition (in other words the DynamicMatrix.add() method does not create a new matrix to contain the result).

Parameters:

inMatrix

The matrix to add to the current matrix.

Returns:

A Boolean value indicating whether the addition succeeded (true) or failed (false). If the dimensions of the matrices are not the same, DynamicMatrix.add() returns false.

getHeight():Int

Returns the number of rows in the current matrix.

Returns:

The number of rows.

getValue(row:Int, col:Int):Float

getWidth():Int

Returns the number of columns in the current matrix.

Returns:

The number of columns.

See also:

  • getHeight

loadIdentity():Void

Sets the current matrix to an identity matrix.

See also:

loadZeros():Void

Sets all values in the current matrix to zero.

@:value({ order : 0 })multiply(inMatrix:DynamicMatrix, order:Int = 0):Bool

Multiplies the current matrix with a specified matrix; and either appends or prepends the specified matrix. Use the DynamicMatrix.multiply() method to append

Parameters:

inMatrix

The matrix to add to the current matrix.

order

Specifies whether to append or prepend the matrix from the inMatrix parameter; either MATRIX_ORDER_APPEND or MATRIX_ORDER_PREPEND.

Returns:

A Boolean value indicating whether the multiplication succeeded (true) or failed (false). The value is false if either the current matrix or specified matrix (the inMatrix parameter) is null, or if the order is to append and the current matrix's width is not the same as the supplied matrix's height; or if the order is to prepend and the current matrix's height is not equal to the supplied matrix's width.

See also:

multiplyNumber(value:Float):Bool

Multiplies a number with each item in the matrix and stores the results in the current matrix.

Parameters:

value

A number to multiply by each item in the matrix.

Returns:

A Boolean value indicating whether the multiplication succeeded (true) or failed (false).

setValue(row:Int, col:Int, value:Float):Void

Sets the value at a specified zero-based row and column in the current matrix.

Parameters:

row

The row containing the value you want to set.

col

The column containing the value you want to set.

value

The number to insert into the matrix.