{============================================================}
{       Тест графических процедур                            }
{============================================================}

var  x, y, x2, y2, i, j : integer;
     r : word;  cs : byte;
     c : byte;  ch : char;
     fill : boolean;
     l : longint;

label  1;

begin
   {---------------------------------------------------------}
   {    PutPixel / GetPixel Test                             }
   ClrScr;  ClrGScr;  Randomize;
   GotoXY(20,1);  write ( 'PutPixel / GetPixel Test' );
   SetColor(2);  Rectangle(140, 8,368,40,true);
   SetColor(1);  Rectangle(149,12,359,36,true);
   GotoXY(45,15);  write ( 'Press any key...' );
   l:=0;
   while  true
   do  begin
         Inc(l);
         x:=Random(312);  c:=Random(8);  y:=Random(70);
         x:=x+100;  y:=y+70;
         SetColor(c);  PutPixel(x,y);
         if  KeyPressed
         then  begin  ch:=ReadKey;  goto 1;  end;
       end;
1: GotoXY(45,15);  write ( '                ' );
   GotoXY(23,3);  write ( l,' pixels setted' );
   SetColor(7);  Rectangle(239,100,272,105,false);
   for  i:=1  to  4
   do  for  j:=1  to  32
       do  begin
             GotoXY((j-1)*2,8+i);
             write(GetPixel(239+j,100+i):2);
             GotoXY(0,0);
           end;
   GotoXY(12,14);
   write ( '*** End of PutPixel / GetPixel Test ***' );
   GotoXY(45,15);  write ( 'Press any key...' );
   GotoXY(0,0);  ch:=ReadKey;

   {---------------------------------------------------------}
   {    Line Test                                            }
   ClrScr;  ClrGScr;
   GotoXY(27,1);  write ( 'Line  Test' );  GotoXY(0,0);
   SetColor(2);  Rectangle(196, 8,312,40,true);
   SetColor(1);  Rectangle(205,12,303,36,true);
   for  i:=-10  to  522
   do  begin  SetColor(i mod 8);  Line(i,-10,i,266);  end;
   for  i:=-10  to  266
   do  begin  SetColor(i mod 8);  Line(-10,i,522,i);  end;
   for  i:=0  to  511
   do  begin  SetColor(i mod 2);  Line(i,0,511-i,255);  end;
   for  i:=0  to  255
   do  begin  SetColor(i mod 2);  Line(0,i,511,255-i);  end;
   GotoXY(45,15);  write ( 'Press any key...' );
   GotoXY(0,0);  ch:=ReadKey;

   {---------------------------------------------------------}
   {    Rectangle Test                                       }
   ClrScr;  ClrGScr;
   GotoXY(25,1);  write ( 'Rectangle Test' );   GotoXY(0,0);
   SetColor(2);  Rectangle(180, 8,328,40,true);
   SetColor(1);  Rectangle(189,12,319,36,true);
   for  i:=1  to  90
   do begin
        SetColor(i mod 8);
     Rectangle(256-(180-2*i),150-i,256+(180-2*i),150+i,false);
        Delay(50);
      end;
   Delay(1000);
   for  i:=90  downto  1
   do  begin
         SetColor(i mod 8);
         Rectangle(256-2*i,150-i,256+2*i,150+i,true);
         Delay(100);
       end;
   GotoXY(45,15);  write ( 'Press any key...' );
   GotoXY(0,0);  ch:=ReadKey;

   {---------------------------------------------------------}
   {    Circle Test                                          }
   ClrScr;  ClrGScr;
   GotoXY(27,1);  write ( 'Circle Test' );   GotoXY(0,0);
   SetColor(2);  Rectangle(196, 8,320,40,true);
   SetColor(1);  Rectangle(205,12,311,36,true);
   for  i:=100  to  221
   do begin SetColor(i mod 8); Circle(i,0+i,20,false); end;
   for  i:=361  downto  221
   do begin SetColor(i mod 8); Circle(i,442-i,20,true); end;
   for  i:=60  downto  1
   do begin SetColor(i mod 2); Circle(255,128,5*i,true); end;
   GotoXY(45,15);  write ( 'Press any key...' );
   GotoXY(0,0);  ch:=ReadKey;
end.

d 2); Circle(255,128,5*i,true); end;
   GotoXY(45,15);  write ( 'Press any key...' );
   GotoXY(0,0); 