$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER HANDLE1, HANDLE2
      INTEGER STATUS
      INTEGER*4 BUFFER1, BUFFER2
      INTEGER FG_LOADPCX, FG_VBALLOC, FG_VBOPEN
      INTEGER*4 FG_VBADDR

      CALL FG_INITPM
      CALL FG_SETMODE(19)
      CALL FG_VBINIT

      HANDLE1 = FG_VBALLOC(320,200)
      HANDLE2 = FG_VBALLOC(80,50)
      IF (HANDLE1 .LT. 0 .OR. HANDLE2 .LT. 0) THEN
         CALL FG_SETMODE(3)
         CALL FG_RESET
         STOP 'Could not create the virtual buffers.'
      END IF
      BUFFER1 = FG_VBADDR(HANDLE1)
      BUFFER2 = FG_VBADDR(HANDLE2)

      STATUS = FG_VBOPEN(HANDLE1)
      STATUS = FG_LOADPCX('CORAL.PCX'//CHAR(0),0)
      CALL FG_VBPASTE(0,319,0,199,0,199)
      CALL FG_WAITKEY

      CALL FG_SCALE(BUFFER1,BUFFER2,320,200,80,50)
      STATUS = FG_VBOPEN(HANDLE2)
      CALL FG_VBPASTE(0,79,0,49,0,199)
      CALL FG_WAITKEY

      CALL FG_VBCLOSE
      CALL FG_VBFREE(HANDLE1)
      CALL FG_VBFREE(HANDLE2)
      CALL FG_SETMODE(3)
      CALL FG_RESET

      STOP ' '
      END
