CC  FIGURE.FOR - Illustrates graphics drawing functions including:
CC               setpixel   lineto     moveto     rectangle
CC               ellipse    arc        pie
CC
CC  Window versions of graphics drawing functions (such as rectangle_w,
CC  ellipse_w, and lineto_w) are illustrated in WINDOW.FOR and MAGNIFY.FOR.

      INCLUDE  'FGRAPH.FI'
      INCLUDE  'FGRAPH.FD'

      INTEGER*2        dummy, x, y
      INTEGER*4        ncolor
      RECORD /xycoord/ xy

C
C     Find graphics mode.
C
      IF( setvideomode( $MAXRESMODE ) .EQ. 0 )
     +   STOP 'Error:  cannot set graphics mode'

      WRITE (*,*) ' Press ENTER to continue'

C
C     Draw pixels.
C
      ncolor = 2
      dummy  = setcolor( ncolor )
      x      = 10
      DO y = 50, 89, 3
         dummy = setpixel( x, y )
         x     = x + 2
      END DO
      READ (*,*)
C
C     Draw lines.
C
      ncolor = ncolor + 1
      dummy  = setcolor( ncolor )
      x      = 60
      DO y = 50, 89, 3
         CALL moveto( x, y, xy )
         dummy = lineto( x + 20, y )
      END DO
      READ (*,*)
C
C     Draw rectangles.
C
      ncolor = ncolor + 1
      dummy  = setcolor( ncolor )
      x      = 110
      y      = 70
      dummy  = rectangle( $GBORDER,       x - 20, y - 20, x, y )
      dummy  = rectangle( $GFILLINTERIOR, x + 20, y + 20, x, y )
      READ (*,*)
C
C     Draw ellipses.
C
      ncolor = ncolor + 1
      dummy  = setcolor( ncolor )
      x      = 160
      dummy  = ellipse( $GBORDER,       x - 20, y - 20, x, y )
      dummy  = ellipse( $GFILLINTERIOR, x + 20, y + 20, x, y )
      READ (*,*)
C
C     Draw arcs.
C
      ncolor = ncolor + 1
      dummy  = setcolor( ncolor )
      x      = 210
      dummy  = arc( x - 20, y - 20, x, y, x     , y - 10, x - 10, y )
      dummy  = arc( x + 20, y + 20, x, y, x + 10, y + 20, x + 20,
     +              y + 10 )
      READ (*,*)
C
C     Draw pies.
C
      ncolor = ncolor + 1
      dummy  = setcolor( ncolor )
      x      = 260
      dummy  = pie( $GBORDER,       x - 20, y - 20, x, y, x     ,
     +              y - 10, x - 10, y      )
      dummy  = pie( $GFILLINTERIOR, x + 20, y + 20, x, y, x + 10,
     +              y + 20, x + 20, y + 10 )
      READ (*,*)
      dummy = setvideomode( $DEFAULTMODE )
      END
