procedure
TForm1.FormCreate(Sender: TObject);
Var
Max, Xo, Yo, Radius, C, R, H, W, L : Integer;
Angle, Step : Real;
begin
{ Get form size }
H:=Image1.Height;
W:=Image1.Width;
{ Fill area with form
color }
Image1.Canvas.Pen.Color:=Form1.Color;
Image1.Canvas.Brush.Color:=Form1.Color;
Image1.Canvas.Rectangle(0,0,W,H);
Max:=360;
Image1.Canvas.Pen.Width:=5;
{ Set fill size }
L:=Max Div 4;
{ Set fill step size
}
Step:=255/L;
{ Set circle coodinates
}
Xo:=W Div 2;
Yo:=H Div 2;
Radius:=(H Div 2)-30;
C:=0;
Angle:=0;
For R:=0 To Max Do
Begin
{
Select color for gradient starting from RED
to YELLOW }
{ Change fill color }
If R<=L Then
Begin
C:=Round(R*Step);
{
Red -> Green }
Image1.Canvas.Pen.Color:=RGB(255-C,C,0)
End
Else If R<=2*L
Then
Begin
C:=Round((R-L)*Step);
{
Green -> Blue }
Image1.Canvas.Pen.Color:=RGB(0,255-C,C)
End
Else If R<=3*L
Then
Begin
C:=Round((R-2*L)*Step);
{
Blue -> Yellow }
Image1.Canvas.Pen.Color:=RGB(C,C,255-C);
End
Else If R<=4*L
Then
Begin
C:=Round((R-3*L)*Step);
{
Yellow -> Red }
Image1.Canvas.Pen.Color:=RGB(255,255-C,0);
End;
{
Fill area by drawing lines }
Image1.Canvas.MoveTo(Xo,Yo);
Image1.Canvas.LineTo(Xo+Round(Radius*Sin(R*(Pi/180))),
Yo-Round(Radius*Cos(R*(Pi/180))));
End;
end;