ARCed.Core.QColorMatrix.Multiply C# (CSharp) Method

Multiply() public method

Multiply the given matrix using the specified matrix order.
public Multiply ( QColorMatrix matrix, MatrixOrder order ) : void
matrix QColorMatrix Matrix to multiply
order MatrixOrder Order to multiply with
return void
        public void Multiply(QColorMatrix matrix, MatrixOrder order)
        {
            if (matrix == null) throw new ArgumentException();
            float[,] a, b;
            if (order == MatrixOrder.MatrixOrderAppend)
            {
                a = matrix._matrix;
                b = this._matrix;
            }
            else
            {
                a = this._matrix;
                b = matrix._matrix;
            }

            var temp = new float[MATRIX_LENGTH, MATRIX_LENGTH];
            for (int y = 0; y < MATRIX_LENGTH; y++)
            {
                for (int x = 0; x < MATRIX_LENGTH; x++)
                {
                    float t = 0;
                    for (int i = 0; i < MATRIX_LENGTH; i++)
                    {
                        t += b[y, i] * a[i, x];
                    }
                    temp[y, x] = t;
                }
            }
            for (int y = 0; y < MATRIX_LENGTH; y++)
            {
                for (int x = 0; x < MATRIX_LENGTH; x++)
                {
                    this._matrix[y, x] = temp[y, x];
                }
            }
        }

Same methods

QColorMatrix::Multiply ( QColorMatrix matrix ) : void