home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / sampler / 03 / filling / fillcirc.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-12-18  |  1.2 KB  |  63 lines

  1. PROGRAM Fill_Circle;
  2.  
  3. {$M 65520,0,655360}   { Set stack allocation to maximum }
  4.  
  5. uses
  6.    Crt,GDriver,GKernel,Turbo3;
  7.  
  8. {$I FILL.INC}
  9. {$I FLOOD.INC}
  10.  
  11. {  A demonstrator for Fill_Region and Flood_Fill.  }
  12.  
  13. { By Fred Robinson
  14.      Monotreme Software     Copyright (c) 1987 Monotreme Software
  15.      29766 Everett
  16.      Southfield, MI  48076
  17.      USA  }
  18.  
  19. VAR
  20.    I:  Integer;
  21.    X, Y:  Real;
  22.    White:  Boolean;
  23.    Ch:  Char;
  24.  
  25. BEGIN
  26.   Randomize;
  27.   White := True;
  28.   InitGraphic;
  29.   DefineWorld (1, -1, -0.75, 1, 0.75);
  30.   SelectWorld (1);
  31.   SelectWindow (1);
  32.   SetLineStyle (0);
  33.  
  34.   REPEAT
  35.     IF White THEN
  36.       SetColorWhite
  37.     ELSE
  38.       SetColorBlack;
  39.  
  40.     White := NOT White;
  41.  
  42.     FOR I := 1 TO 25 DO
  43.       BEGIN
  44.         SetAspect (2.25*Random);
  45.         DrawCircle (2*Random-1, 1.5*Random-0.75, 1.5*Random)
  46.       END (* FOR *);
  47.  
  48.     FOR I := 1 TO 10 DO
  49.       BEGIN
  50.         REPEAT
  51.           X := Random * 2.0 - 1.0;
  52.           Y := Random * 1.5 - 0.75
  53.         UNTIL NOT PointDrawn (X, Y);
  54.  
  55.         Fill_Region (X, Y)
  56. {       Flood_Fill (X, Y)  }   { Using Flood_Fill exhausts stack space }
  57.       END (* FOR *)
  58.   UNTIL KeyPressed;
  59.  
  60. Read (Kbd, Ch);
  61. LeaveGraphic
  62. END.
  63.