分类:
2010-07-09 10:22:40
The matrix coefficients constitute a 5 x 5 linear transformation that is used for transforming ARGB homogeneous values. For example, an ARGB vector is represented as red, green, blue, alpha and w, where w is always 1.
For example, suppose you want to start with the color (0.2, 0.0, 0.4, 1.0) and apply the following transformations:
Double the red component
Add 0.2 to the red, green, and blue components
The following matrix multiplication will perform the pair of transformations in the order listed.
The elements of a color matrix are indexed (zero-based) by row and then column. For example, the entry in the fifth row and third column of matrix M is denoted by M[4][2].
The 5×5 identity matrix (shown in the following illustration) has 1s on the diagonal and 0s everywhere else. If you multiply a color vector by the identity matrix, the color vector does not change. A convenient way to form the matrix of a color transformation is to start with the identity matrix and make a small change that produces the desired transformation.