The DynamicMatrix class calculates and stores a matrix based on given values. This class supports the ColorMatrixFilter and can be extended by the ColorMatrix class.

See also:

Static variables

@:value(1)staticread onlyMATRIX_ORDER_APPEND:Int = 1

Specifies that a matrix is appended for concatenation.

@:value(0)staticread onlyMATRIX_ORDER_PREPEND:Int = 0

Specifies that a matrix is prepended for concatenation.

Constructor

new(width:Int, height:Int)

Constructs a matrix with the given number of rows and columns.

Parameters:

width

Number of columns.

height

Number of rows.

Methods

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.