|
DrawColorMatrix Statement:
Change all colors using color transformation matrix
| Object.DrawColorMatrix dstImage,
srcImage, dstX, dstY, srcX, srcY, dstWidth,
dstHeight, srcWidth, srcHeight
|
Parametrs:
dstImage- destination image index [0..9]. The parameter selects the
image where a part of the source image will be copied to.
srcImage- source image index [0..9]. The parameter selects the image
where a part of the image will be copied from.
dstX - destination X coordinate defines where image part will be
copied in the destination image
dstY - destination Y coordinate defines where image part will be
copied in the destination image
srcX- source X coordinate defines where image part is to be copied
from.
srcY- source Y coordinate defines where image part is to be copied
from.
dstWidth, dstHeight - new width and new height of the image part in
destination image
srcWidth,srcHeight-width and height of the image part in source image
|
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:
|