|
SetColorMatrix Statement:
Set color transformation matrix
| Object.SetColorMatrix matrix
|
Parametrs:
matrix -array [4,4].
|
Sample:
Dim matrix(5,5)
object.SetBKColor 255,255,255,0
object.Create 200,100
object.SetColor 255,255,0,255
object.SetLineWidth 5
object.DrawLine 0,0,200,100
object.SetImageIndex 1
object.SetBKColor 255,255,255,0
object.Create 200,100
object.SetColor 0,255,0,255
object.SetLineWidth 10
object.DrawLine 0,100,200,0
For i = 1 to 5
For j = 1 to 5
mc(i,j) = 0.0
next
next
For j = 1 to 5
mc(j,j) = CInt(1)
next
mc(4,4) = 0.5
object.SetColorMatrix mc
object.DrawColorMatrix 0,1,0,0,0,0,200,100
,200,100
object.SetFormat 0
object.SetImageIndex 0
object.SaveToFile "C:\matrix3.png"
You can apply linear transformations (rotation, scaling, and the like) to color
vectors by multiplying by a 4x4 matrix. However, you cannot use a 4x4 matrix to
perform a translation (nonlinear). If you add a dummy fifth coordinate (for
example, the number 1) to each of the color vectors, you can use a 5x5 matrix
to apply any combination of linear transformations and translations. A
transformation consisting of a linear transformation followed by a translation
is called an affine transformation. A 5x5 matrix that represents an affine
transformation is called a homogeneous matrix for a 4-space transformation. The
element in the fifth row and fifth column of a 5x5 homogeneous matrix must be
1, and all of the other entries in the fifth column.
See also
SetColorMatrix,
DrawColorMatrix
More samples:
|