BlendColors

Prototype

Matrix BlendColors( Matrix mColors, Matrix mTotalColors )

Return Value

The return value is an (mTotalColors x 3) matrix, each row of which represents an RGB color created by a linear interpolation of the colors contained in mColors.

Parameters

Matrix mColors
An n x 3 matrix, each row of which represents an RGB color. Each entry of the matrix must be an integer in the range [0, 255]. Example: the matrix { 0 0 0, 255 0 0 } is a matrix whose first row represents black and whose second row represents red.

Matrix mTotalColors
A scalar that specifies the number of colors desired in the returned matrix.

Remarks

This module creates a matrix of colors (a "color map") based on the interpolation of the rows of the n x 3 matrix mColors.

Example
mTotalColors = 7;
mColors = {   0   0 255,   /* blue = low values     */
              0 255   0,   /* green = medium values */
            255   0   0 }; /* red = high values     */
colorBlend = BlendColors( mColors, mTotalColors );
print colorBlend;
See Also

ColorCodeObs