procedure DrawGradient(Bmp: TBitmap; TColorArray:
array of TColor);
var
Diff_R, Diff_G, Diff_B: integer;
R_Value, G_Value, B_Value: byte;
Steps, y, x: integer;
begin
Steps := 255;
Bmp.Width := Steps * high(TColorArray);
for x := 0
to (high(TColorArray) -1)
do
begin
R_Value := GetRValue(TColorArray[x]);
G_Value := GetGValue(TColorArray[x]);
B_Value := GetBValue(TColorArray[x]);
Diff_R := round((GetRValue(TColorArray[x + 1]) - GetRValue(TColorArray[x])) / Steps);
Diff_G := round((GetGValue(TColorArray[x + 1]) - GetGValue(TColorArray[x])) / Steps);
Diff_B := round((GetBValue(TColorArray[x + 1]) - GetBValue(TColorArray[x])) / Steps);
for y := x * Steps
to Steps * (x + 1)
do
begin
R_Value := R_Value + Diff_R;
G_Value := G_Value + Diff_G;
B_Value := B_Value + Diff_B;
Bmp.Canvas.Pen.Color :=
RGB(R_Value, G_Value, B_Value);
Bmp.Canvas.MoveTo(y, 0);
Bmp.Canvas.LineTo(y, Bmp.Height);
end;
end;
end;