procedure Gradiente(Canvas: TCanvas; R: TRect; b: integer);
var
h,s: integer; i,j: integer;
x,y,z: integer;
Bitmap: TBitmap;
begin
Bitmap:= TBitmap.Create;
try
Bitmap.Width:= 360;
Bitmap.Height:= 256;
with Bitmap.Canvas do
begin
Brush.Color:= clBlack;
FillRect(ClipRect);
for h:= 0 to 359 do
begin
i:= ((h mod 60) * b) div 60;
j:= b - i;
for s:= 0 to 255 do
begin
x:= i + ((b-i) * s) div 255;
y:= j + ((b-j) * s) div 255;
z:= (b * s) div 255;
case (h div 60) of
0: Pixels[h,s]:= RGB(b,x,z);
1: Pixels[h,s]:= RGB(y,b,z);
2: Pixels[h,s]:= RGB(z,b,x);
3: Pixels[h,s]:= RGB(z,y,b);
4: Pixels[h,s]:= RGB(x,z,b);
5: Pixels[h,s]:= RGB(b,z,y);
end;
end;
end;
end;
Canvas.StretchDraw(R,Bitmap);
finally
Bitmap.Free;
end;
end;