You've already forked lazarus-ccr
* Optimize the case where FNumberColors = 1
* Code reformatting git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1076 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -440,7 +440,6 @@ begin
|
|||||||
Rp := GetClientRect;
|
Rp := GetClientRect;
|
||||||
{ Extract the begin RGB values }
|
{ Extract the begin RGB values }
|
||||||
case FDirection of
|
case FDirection of
|
||||||
|
|
||||||
fdLeftToRight, ftTopToBottom: begin
|
fdLeftToRight, ftTopToBottom: begin
|
||||||
{ Set the Red, Green and Blue colors }
|
{ Set the Red, Green and Blue colors }
|
||||||
BeginRGBValue[0] := GetRValue (ColorToRGB (FBeginColor));
|
BeginRGBValue[0] := GetRValue (ColorToRGB (FBeginColor));
|
||||||
@ -488,14 +487,19 @@ begin
|
|||||||
ColorBand.Left := 0;
|
ColorBand.Left := 0;
|
||||||
ColorBand.Right := Width;
|
ColorBand.Right := Width;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Perform the fill }
|
{ Perform the fill }
|
||||||
|
if FNumberOfColors = 1 then
|
||||||
|
begin
|
||||||
|
Canvas.Brush.Color := FBeginColor;
|
||||||
|
Canvas.FillRect(rp);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
for I := 0 to FNumberOfColors do
|
for I := 0 to FNumberOfColors do
|
||||||
begin
|
begin
|
||||||
case FDirection of
|
case FDirection of
|
||||||
|
|
||||||
{ Calculate the color band's left and right coordinates }
|
{ Calculate the color band's left and right coordinates }
|
||||||
fdLeftToRight, fdRightToLeft:
|
fdLeftToRight, fdRightToLeft:
|
||||||
begin
|
begin
|
||||||
@ -508,27 +512,16 @@ begin
|
|||||||
ColorBand.Bottom := MulDiv (I + 1, Height, FNumberOfColors);
|
ColorBand.Bottom := MulDiv (I + 1, Height, FNumberOfColors);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Calculate the color band's color }
|
{ Calculate the color band's color }
|
||||||
if FNumberOfColors > 1 then
|
|
||||||
begin
|
|
||||||
R := BeginRGBValue[0] + MulDiv (I, RGBDifference[0], FNumberOfColors - 1);
|
R := BeginRGBValue[0] + MulDiv (I, RGBDifference[0], FNumberOfColors - 1);
|
||||||
G := BeginRGBValue[1] + MulDiv (I, RGBDifference[1], FNumberOfColors - 1);
|
G := BeginRGBValue[1] + MulDiv (I, RGBDifference[1], FNumberOfColors - 1);
|
||||||
B := BeginRGBValue[2] + MulDiv (I, RGBDifference[2], FNumberOfColors - 1);
|
B := BeginRGBValue[2] + MulDiv (I, RGBDifference[2], FNumberOfColors - 1);
|
||||||
end
|
|
||||||
else
|
|
||||||
{ Set to the Begin Color if set to only one color }
|
|
||||||
begin
|
|
||||||
R := BeginRGBValue[0];
|
|
||||||
G := BeginRGBValue[1];
|
|
||||||
B := BeginRGBValue[2];
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ Select the brush and paint the color band }
|
{ Select the brush and paint the color band }
|
||||||
Canvas.Brush.Color := RGB (R, G, B);
|
Canvas.Brush.Color := RGB (R, G, B);
|
||||||
Canvas.FillRect (ColorBand);
|
Canvas.FillRect (ColorBand);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Copy the working bitmap to the main canvas }
|
{ Copy the working bitmap to the main canvas }
|
||||||
Canvas.Draw(0, 0, WorkBmp);
|
Canvas.Draw(0, 0, WorkBmp);
|
||||||
|
Reference in New Issue
Block a user