{--------------------------------------------------------------}
{                           Hatcher                            }
{                                                              }
{           Graphics window demonstration program              }
{                                                              }
{                             by Jeff Duntemann                }
{                             Turbo Pascal V3.0                }
{                             Last update 3/7/86               }
{                                                              }
{    From the book, COMPLETE TURBO PASCAL, by Jeff Duntemann   }
{    Scott, Foresman & Co. (c) 1986,1987  ISBN 0-673-18600-8   }
{--------------------------------------------------------------}

PROGRAM Hatcher;

VAR
  X,J : Integer;

PROCEDURE Border;

BEGIN
  Draw(0,0,319,0,3); Draw(0,0,0,199,3);
  Draw(319,0,319,199,3); Draw(0,199,319,199,3);
END;

BEGIN
  GraphColorMode;   { Use color graphics mode }
  X := 0;           { Set initial X figures }
  J := X-180;
  { Note that in both cases we draw well outside the window area!}
  WHILE (X < 319) OR (J < 319) DO   { Draw red full-screen hatch }
    BEGIN
      DRAW(X,0,J,199,2);
      X := X+8; J := X-180
    END;
  Border;                      { Draw a border around the screen }
  GraphWindow(80,40,240,160);  { Cut our window down to 160 X 120 }
  X := 320; J := X+180;        { Set initial X figures }
  WHILE (X > 0) OR (J > 0) DO  { Do window hatch in green }
    BEGIN
      Draw(X,0,J,199,1);
      X := X-8; J := X+180
    END;
  Border;     { Draw a yellow border around the graphics window }
  Readln;
  TextMode;   { Don't leave us in text mode! }
END.
