C fgraph.fd - declare constants and functions for graphics library
C
C     Copyright (c) 1987-1993 Microsoft Corporation.  All rights reserved.
C
C Purpose:
C     This file declares the graphics library functions and
C     the constants that are used with them.
C
C

$NOTRUNCATE        ! required for some names to be significant
$NOTSTRICT         ! uses structures which are non-standard conforming

C     User-visible declarations for FORTRAN Graphics Library

C     Structure for getvideoconfig() as visible to user
	STRUCTURE/videoconfig/
	  INTEGER*2 numxpixels       ! number of pixels on X axis
	  INTEGER*2 numypixels       ! number of pixels on Y axis
	  INTEGER*2 numtextcols      ! number of text columns available
	  INTEGER*2 numtextrows      ! number of text rows available
	  INTEGER*2 numcolors        ! number of actual colors
	  INTEGER*2 bitsperpixel     ! number of bits per pixel
	  INTEGER*2 numvideopages    ! number of available video pages
	  INTEGER*2 mode             ! current video mode
	  INTEGER*2 adapter          ! active display adapter
	  INTEGER*2 monitor          ! active display monitor
	  INTEGER*2 memory           ! adapter video memory in K bytes
	END STRUCTURE

C     Return value of getcurrentposition(), etc.
	STRUCTURE/xycoord/
	  INTEGER*2 xcoord
	  INTEGER*2 ycoord
	END STRUCTURE

C     Structure for text position
	STRUCTURE/rccoord/
	  INTEGER*2 row
	  INTEGER*2 col
	END STRUCTURE

C     ERROR HANDLING

C     Status info returned by grstatus()
	INTEGER*2 $GRPARAMETERALTERED,$GRCLIPPED,$GRNOOUTPUT,$GROK,
     +            $GRERROR,$GRMODENOTSUPPORTED,$GRNOTINPROPERMODE,
     +            $GRINVALIDPARAMETER,$GRFONTFILENOTFOUND,
     +            $GRINVALIDFONTFILE,$GRCORRUPTEDFONTFILE,
     +            $GRINSUFFICIENTMEMORY,$GRINVALIDIMAGEBUFFER
C     Successful
	PARAMETER($GROK                  = 0)  ! success
C     Warnings
	PARAMETER($GRNOOUTPUT            = 1)  ! nothing drawn
	PARAMETER($GRCLIPPED             = 2)  ! output was partially clipped
	PARAMETER($GRPARAMETERALTERED    = 3)  ! input parameters adjusted
	PARAMETER($GRTEXTNOTSUPPORTED	 = 4)  ! SuperVGA text output may fail
C     Errors
	PARAMETER($GRERROR              = -1)  ! generic graphics error
	PARAMETER($GRMODENOTSUPPORTED   = -2)  ! video mode not supported
	PARAMETER($GRNOTINPROPERMODE    = -3)  ! not supported in current mode
	PARAMETER($GRINVALIDPARAMETER   = -4)  ! bad parameter
	PARAMETER($GRFONTFILENOTFOUND   = -5)  ! font file not found
	PARAMETER($GRINVALIDFONTFILE    = -6)  ! not a font file
	PARAMETER($GRCORRUPTEDFONTFILE  = -7)  ! inconsistent font file
	PARAMETER($GRINSUFFICIENTMEMORY = -8)  ! out of memory
	PARAMETER($GRINVALIDIMAGEBUFFER = -9)  ! bad image buffer detected

C     SETUP AND CONFIGURATION

C     Arguments to setvideomode()
	INTEGER*2 $MAXRESMODE,$MAXCOLORMODE,$DEFAULTMODE,$TEXTBW40,
     +            $TEXTC40,$TEXTBW80,$TEXTC80,$MRES4COLOR,$MRESNOCOLOR,
     +            $HRESBW,$TEXTMONO,$HERCMONO,$MRES16COLOR,$HRES16COLOR,
     +            $ERESNOCOLOR,$ERESCOLOR,$VRES2COLOR,$VRES16COLOR,
     +            $MRES256COLOR,$ORESCOLOR,$SRES16COLOR,$SRES256COLOR,
     +            $XRES16COLOR,$XRES256COLOR,$ZRES16COLOR,$ZRES256COLOR
	PARAMETER($MAXRESMODE   =-3)    ! graphics mode with highest resolution
	PARAMETER($MAXCOLORMODE =-2)    ! graphics mode with most colors
	PARAMETER($DEFAULTMODE  =-1)    ! restore screen to original mode
	PARAMETER($TEXTBW40      =0)    ! 40 x 25 text, 16 grey
	PARAMETER($TEXTC40               =1)    ! 40 x 25 text, 16/8 color
	PARAMETER($TEXTBW80      =2)    ! 80 x 25 text, 16 grey
	PARAMETER($TEXTC80               =3)    ! 80 x 25 text, 16/8 color
	PARAMETER($MRES4COLOR    =4)    ! 320 x 200, 4 color
	PARAMETER($MRESNOCOLOR   =5)    ! 320 x 200, 4 grey
	PARAMETER($HRESBW                =6)    ! 640 x 200, BW
	PARAMETER($TEXTMONO      =7)    ! 80 x 25 text, BW
	PARAMETER($HERCMONO      =8)    ! 720 x 348, BW for HGC
	PARAMETER($MRES16COLOR   =13)   ! 320 x 200, 16 color
	PARAMETER($HRES16COLOR   =14)   ! 640 x 200, 16 color
	PARAMETER($ERESNOCOLOR   =15)   ! 640 x 350, BW
	PARAMETER($ERESCOLOR     =16)   ! 640 x 350, 4 or 16 color
	PARAMETER($VRES2COLOR    =17)   ! 640 x 480, BW
	PARAMETER($VRES16COLOR   =18)   ! 640 x 480, 16 color
	PARAMETER($MRES256COLOR  =19)   ! 320 x 200, 256 color
	PARAMETER($ORESCOLOR     =64)   ! 640 x 400, 1 of 16 colors (Olivetti)

C     The following 8 modes require VESA SuperVGA BIOS extensions
      PARAMETER($ORES256COLOR  =#0100)        ! 640 x 400, 256 color
      PARAMETER($VRES256COLOR  =#0101)        ! 640 x 480, 256 color

C     WARNING: DO NOT attempt to set the following modes without ensuring
C     that your monitor can safely handle that resolution.  Otherwise, you
C     may risk damaging your display monitor!  Consult your owner's manual
C     for details.
C     Note: _MAXRESMODE and _MAXCOLORMODE never select SRES, XRES, or ZRES
C     modes.

C     Requires NEC MultiSync 3D or equivalent, or better
	PARAMETER($SRES16COLOR   =#0102)        ! 800 x 600, 16 color
	PARAMETER($SRES256COLOR  =#0103)        ! 800 x 600, 256 color

C     Requires NEC MultiSync 4D or equivalent, or better
	PARAMETER($XRES16COLOR   =#0104)        ! 1024 x 768, 16 color
	PARAMETER($XRES256COLOR  =#0105)        ! 1024 x 768, 256 color

C     Requires NEC MultiSync 5D or equivalent, or better
	PARAMETER($ZRES16COLOR   =#0106)        ! 1280 x 1024, 16 color
	PARAMETER($ZRES256COLOR  =#0107)        ! 1280 x 1024, 256 color

C     VIDEOCONFIG adapter values

C     These constants can be used to determine the type of the active
C     adapter, using either simple comparisons or the bitwise-AND operator.
      INTEGER*2 $QUICKWIN, $MDPA,$CGA,$EGA,$MCGA,$VGA,$HGC,$OCGA,
     +          $OEGA,$OVGA
      PARAMETER($QUICKWIN =#0000)  ! QuickWin graphics
	PARAMETER($MDPA     =#0001)  ! Monochrome Display Adapter (MDPA)
	PARAMETER($CGA      =#0002)  ! Color Graphics Adapter     (CGA)
	PARAMETER($EGA      =#0004)  ! Enhanced Graphics Adapter  (EGA)
	PARAMETER($VGA      =#0008)  ! Video Graphics Array       (VGA)
	PARAMETER($MCGA     =#0010)  ! MultiColor Graphics Array  (MCGA)
	PARAMETER($HGC      =#0020)  ! Hercules Graphics Card     (HGC)
	PARAMETER($OCGA     =#0042)  ! Olivetti Color Graphics Adapter (OCGA)
	PARAMETER($OEGA     =#0044)  ! Olivetti Enhanced Graphics Adapter (OEGA)
	PARAMETER($OVGA     =#0048)  ! Olivetti Video Graphics Array (OVGA)
      PARAMETER($SVGA     =#0088)  ! Super VGA with VESA BIOS support (SVGA)

C     VIDEOCONFIG monitor values

C     These constants can be used to determine the type of monitor in
C     use, using either simple comparisons or the bitwise-AND operator
	INTEGER*2 $MONO,$COLOR,$ENHCOLOR,$ANALOGMONO,
     +            $ANALOGCOLOR,$ANALOG
	PARAMETER($MONO       =#0001)     ! Monochrome
	PARAMETER($COLOR      =#0002)     ! Color (or Enhanced emulating color)
	PARAMETER($ENHCOLOR   =#0004)     ! Enhanced Color
	PARAMETER($ANALOGMONO =#0008)     ! Analog Monochrome only
	PARAMETER($ANALOGCOLOR=#0010)     ! Analog Color only
      PARAMETER($ANALOG     =#0018)     ! Analog Color + Analog Monochrome

C     COORDINATE SYSTEMS

C     OUTPUT ROUTINES

C     Control parameters for rectangle(), polygon(), ellipse(), and pie()
	INTEGER*2 $GBORDER,$GFILLINTERIOR
	PARAMETER($GBORDER       =2)      ! draw outline only
	PARAMETER($GFILLINTERIOR =3)      ! fill using current fill mask

C     Parameters for clearscreen()
	INTEGER*2 $GCLEARSCREEN,$GVIEWPORT,$GWINDOW
	PARAMETER($GCLEARSCREEN  =0)
	PARAMETER($GVIEWPORT     =1)
	PARAMETER($GWINDOW       =2)

C     TEXT

C     Parameters for displaycursor()
	INTEGER*2 $GCURSOROFF,$GCURSORON
	PARAMETER($GCURSOROFF =0)
	PARAMETER($GCURSORON  =1)

C     Parameters for wrapon()
	INTEGER*2 $GWRAPOFF,$GWRAPON
	PARAMETER($GWRAPOFF  =0)
	PARAMETER($GWRAPON   =1)

C     Parameters for scrolltextwindow()
	INTEGER*2 $GSCROLLUP,$GSCROLLDOWN
	PARAMETER($GSCROLLUP   =1)
	PARAMETER($GSCROLLDOWN =-1)

C     Request maximum number of rows in _settextrows() and _setvideomoderows()
	INTEGER*2 $MAXTEXTROWS
	PARAMETER($MAXTEXTROWS =-1)

C     "Action verbs" for putimage(), setwritemode()
	INTEGER*2 $GPSET,$GPRESET,$GAND,$GOR,$GXOR
	PARAMETER($GPSET         =3)
	PARAMETER($GPRESET       =2)
	PARAMETER($GAND          =1)
	PARAMETER($GOR           =0)
	PARAMETER($GXOR          =4)

C     Color values are used with setbkcolor in graphics modes and also by
C     remappalette abd remapallpalette.  Also known as palette colors.
C     Not to be confused with color indices (aka. color attributes).

C     Universal color values (all color modes):
	INTEGER*4 $BLACK,$BLUE,$GREEN,$CYAN,$RED,$MAGENTA,$BROWN,
     +            $WHITE,$GRAY,$LIGHTBLUE,$LIGHTGREEN,$LIGHTCYAN,
     +            $LIGHTRED,$LIGHTMAGENTA,$YELLOW,$BRIGHTWHITE
	PARAMETER($BLACK         =#000000)
	PARAMETER($BLUE          =#2a0000)
	PARAMETER($GREEN         =#002a00)
	PARAMETER($CYAN          =#2a2a00)
	PARAMETER($RED           =#00002a)
	PARAMETER($MAGENTA       =#2a002a)
	PARAMETER($BROWN         =#00152a)
	PARAMETER($WHITE         =#2a2a2a)
	PARAMETER($GRAY          =#151515)
	PARAMETER($LIGHTBLUE     =#3F1515)
	PARAMETER($LIGHTGREEN    =#153f15)
	PARAMETER($LIGHTCYAN     =#3f3f15)
	PARAMETER($LIGHTRED      =#15153f)
	PARAMETER($LIGHTMAGENTA  =#3f153f)
	PARAMETER($YELLOW        =#153f3f)
	PARAMETER($BRIGHTWHITE   =#3f3f3f)

C     The following is obsolescent and defined only for backwards
C     compatibility.
	INTEGER*4 $LIGHTYELLOW
	PARAMETER($LIGHTYELLOW   =#153f3f)

C     Mono mode F ($ERESNOCOLOR) color values:
	INTEGER*4 $MODEFOFF,$MODEFOFFTOON,$MODEFOFFTOHI,$MODEFONTOOFF,
     +            $MODEFON,$MODEFONTOHI,$MODEFHITOOFF,$MODEFHITOON,
     +            $MODEFHI
	PARAMETER($MODEFOFF      =0)
	PARAMETER($MODEFOFFTOON  =1)
	PARAMETER($MODEFOFFTOHI  =2)
	PARAMETER($MODEFONTOOFF  =3)
	PARAMETER($MODEFON       =4)
	PARAMETER($MODEFONTOHI   =5)
	PARAMETER($MODEFHITOOFF  =6)
	PARAMETER($MODEFHITOON   =7)
	PARAMETER($MODEFHI       =8)

C     Mono mode 7 ($TEXTMONO) color values:
	INTEGER*4 $MODE7OFF,$MODE7ON,$MODE7HI
	PARAMETER($MODE7OFF      =0)
	PARAMETER($MODE7ON       =1)
	PARAMETER($MODE7HI       =2)

C     External function declarations

	INTEGER*2 grstatus[EXTERN]
	INTEGER*2 setvideomode[EXTERN]
	INTEGER*2 setvideomoderows[EXTERN]
	INTEGER*2 setactivepage[EXTERN]
	INTEGER*2 setvisualpage[EXTERN]
	INTEGER*2 getactivepage[EXTERN]
	INTEGER*2 getvisualpage[EXTERN]
	EXTERNAL getvideoconfig
	EXTERNAL setvieworg
	EXTERNAL getviewcoord
	EXTERNAL getphyscoord
	EXTERNAL setcliprgn
	EXTERNAL setviewport
	EXTERNAL clearscreen
	EXTERNAL moveto
	EXTERNAL getcurrentposition
	INTEGER*2 lineto[EXTERN]
	INTEGER*2 rectangle[EXTERN]
	INTEGER*2 polygon[EXTERN]
	INTEGER*2 ellipse[EXTERN]
	INTEGER*2 arc[EXTERN]
	INTEGER*2 pie[EXTERN]
	INTEGER*2 getarcinfo[EXTERN]
	INTEGER*2 setpixel[EXTERN]
	INTEGER*2 getpixel[EXTERN]
	INTEGER*2 floodfill[EXTERN]
	INTEGER*2 setcolor[EXTERN]
	INTEGER*2 getcolor[EXTERN]

	EXTERNAL setlinestyle
	INTEGER*2 getlinestyle[EXTERN]
	INTEGER*2 setwritemode[EXTERN]
	INTEGER*2 getwritemode[EXTERN]
	EXTERNAL setfillmask
	EXTERNAL getfillmask
	INTEGER*4 setbkcolor[EXTERN]
	INTEGER*4 getbkcolor[EXTERN]
	INTEGER*4 remappalette[EXTERN]
	INTEGER*2 remapallpalette[EXTERN]
	INTEGER*2 selectpalette[EXTERN]
	INTEGER*2 settextrows[EXTERN]
	EXTERNAL settextwindow
	EXTERNAL gettextwindow
	EXTERNAL scrolltextwindow
	EXTERNAL outtext
	INTEGER*2 wrapon[EXTERN]
	INTEGER*2 displaycursor[EXTERN]
	INTEGER*2 settextcursor[EXTERN]
	INTEGER*2 gettextcursor[EXTERN]
	EXTERNAL settextposition
	EXTERNAL gettextposition
	INTEGER*2 settextcolor[EXTERN]
	INTEGER*2 gettextcolor[EXTERN]
	EXTERNAL getimage
	EXTERNAL putimage
	INTEGER*4 imagesize[EXTERN]

C     External function declarations for QuickWin Graphics API's
	INTEGER*2 INCHARQQ[EXTERN]
	INTEGER*2 WGOPENQQ[EXTERN]
	INTEGER*2 WGCLOSEQQ[EXTERN]
	INTEGER*2 WGSETACTIVEQQ[EXTERN]
	INTEGER*2 WGGETACTIVEQQ[EXTERN]

C     WINDOW COORDINATE SYSTEM

C     Structure for window coordinate pair
	STRUCTURE/wxycoord/
	  DOUBLE PRECISION wx   ! window x coordinate
	  DOUBLE PRECISION wy   ! window y coordinate
	END STRUCTURE

	INTEGER*2 setwindow[EXTERN]

	EXTERNAL getwindowcoord
	EXTERNAL getviewcoord_w
	EXTERNAL getcurrentposition_w

C     Window coordinate entry points for graphics output routines

	INTEGER*2 arc_w[EXTERN]
	INTEGER*2 ellipse_w[EXTERN]
	INTEGER*2 floodfill_w[EXTERN]
	INTEGER*2 getpixel_w[EXTERN]
	INTEGER*2 lineto_w[EXTERN]
	EXTERNAL moveto_w
	INTEGER*2 pie_w[EXTERN]
	INTEGER*2 rectangle_w[EXTERN]
	INTEGER*2 polygon_w[EXTERN]
	INTEGER*2 setpixel_w[EXTERN]
	EXTERNAL getimage_w
	INTEGER*4 imagesize_w[EXTERN]
	EXTERNAL putimage_w

	STRUCTURE/fontinfo/
	  INTEGER*2 type                ! b0 set = vector,clear = bit map
	  INTEGER*2 ascent      ! pix dist from top to baseline
	  INTEGER*2 pixwidth    ! character width in pixels, 0=prop
	  INTEGER*2 pixheight   ! character height in pixels
	  INTEGER*2 avgwidth    ! average character width in pixels
	  CHARACTER*81 filename   ! file name including path
	  CHARACTER*32 facename   ! font name
	END STRUCTURE

C     Font parameters

	INTEGER*2 $NO_SPACE,$FIXED_SPACE,$PROP_SPACE
	PARAMETER ($NO_SPACE    = 0)
	PARAMETER ($FIXED_SPACE = 1)
	PARAMETER ($PROP_SPACE  = 2)

	INTEGER*2 $NO_FONT_MAP,$VECTOR_MAP,$BIT_MAP
	PARAMETER ($NO_FONT_MAP = 0)
	PARAMETER ($VECTOR_MAP  = 1)
	PARAMETER ($BIT_MAP     = 2)

	INTEGER*2 registerfonts[EXTERN]
	EXTERNAL unregisterfonts
	INTEGER*2 setfont[EXTERN]
	INTEGER*2 getfontinfo[EXTERN]
	EXTERNAL outgtext
	INTEGER*2 getgtextextent[EXTERN]
	EXTERNAL setgtextvector
	EXTERNAL getgtextvector
