graph.mh

来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 462 行 · 第 1/2 页

MH
462
字号
/*
 *  graph.h     Graphics functions
 *
:include crwat.sp
 */
#ifndef _GRAPH_H_INCLUDED
#define _GRAPH_H_INCLUDED
:include readonly.sp
:include cpluspro.sp

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#endif

:include pshpackl.sp

:segment QNX | LINUX
#if !defined(__386__)
    #pragma library (graph);
#elif defined(__SW_3S)
    #pragma library (graph3s);
#else
    #pragma library (graph3r);
#endif
:elsesegment DOS
#pragma library (graph);
:elsesegment NEC
#pragma library (graph98);
:endsegment

struct xycoord {                /* structure for pixel position */
        short   xcoord;
        short   ycoord;
};

struct _wxycoord {              /* structure for window position*/
        double  wx;
        double  wy;
};

struct rccoord {                /* structure for text position  */
        short   row;
        short   col;
};

struct videoconfig {            /* structure for _getvideoconfig */
        short   numxpixels;
        short   numypixels;
        short   numtextcols;
        short   numtextrows;
        short   numcolors;
        short   bitsperpixel;
        short   numvideopages;
        short   mode;
        short   adapter;
        short   monitor;
        short   memory;
};

struct textsettings {           /* structure for _gettextsettings */
        short   basevectorx;
        short   basevectory;
        short   txpath;
        short   height;
        short   width;
        short   spacing;
        short   horizalign;
        short   vertalign;
};

struct _fontinfo {              /* structure for _getfontinfo */
        short   type;
        short   ascent;
        short   pixwidth;
        short   pixheight;
        short   avgwidth;
        char    filename[ 81 ];
        char    facename[ 32 ];
};

/* Calling conventions for -fpi(87) are different than for -fpc */
#if defined( __FPI__ )
    #define _arc_w              _arc_w_87
    #define _ellipse_w          _ellipse_w_87
    #define _floodfill_w        _floodfill_w_87
    #define _getimage_w         _getimage_w_87
    #define _getpixel_w         _getpixel_w_87
    #define _getviewcoord_w     _getviewcoord_w_87
    #define _grtext_w           _grtext_w_87
    #define _imagesize_w        _imagesize_w_87
    #define _lineto_w           _lineto_w_87
    #define _moveto_w           _moveto_w_87
    #define _pie_w              _pie_w_87
    #define _putimage_w         _putimage_w_87
    #define _rectangle_w        _rectangle_w_87
    #define _setcharsize_w      _setcharsize_w_87
    #define _setcharspacing_w   _setcharspacing_w_87
    #define _setpixel_w         _setpixel_w_87
    #define _setwindow          _setwindow_87
#endif

/* Video Setup and Query Functions */

short _WCI86FAR         _setvideomode( short );
short _WCI86FAR         _setvideomoderows( short, short );
struct videoconfig _WCI86FAR * _WCI86FAR
                        _getvideoconfig( struct videoconfig _WCI86FAR * );
short _WCI86FAR         _grstatus( void );
short _WCI86FAR         _setactivepage( short );
short _WCI86FAR         _getactivepage( void );
short _WCI86FAR         _setvisualpage( short );
short _WCI86FAR         _getvisualpage( void );

#define _MAXRESMODE     (-3)    /* graphics mode with highest res. */
#define _MAXCOLORMODE   (-2)    /* graphics mode with most colours */
#define _DEFAULTMODE    (-1)    /* restore screen to original mode */
:segment DOS | QNX | LINUX
#define _TEXTBW40       0       /* 40 x 25 text, 16 grey           */
#define _TEXTC40        1       /* 40 x 25 text, 16/8 color        */
#define _TEXTBW80       2       /* 80 x 25 text, 16 grey           */
#define _TEXTC80        3       /* 80 x 25 text, 16/8 color        */
#define _MRES4COLOR     4       /* 320 x 200, 4 color              */
#define _MRESNOCOLOR    5       /* 320 x 200, 4 grey               */
#define _HRESBW         6       /* 640 x 200, BW                   */
#define _TEXTMONO       7       /* 80 x 25 text, BW                */
#define _HERCMONO       11      /* 720 x 350, BW                   */
#define _MRES16COLOR    13      /* 320 x 200, 16 color             */
#define _HRES16COLOR    14      /* 640 x 200, 16 color             */
#define _ERESNOCOLOR    15      /* 640 x 350, BW                   */
#define _ERESCOLOR      16      /* 640 x 350, 4 or 16 color        */
#define _VRES2COLOR     17      /* 640 x 480, BW                   */
#define _VRES16COLOR    18      /* 640 x 480, 16 color             */
#define _MRES256COLOR   19      /* 320 x 200, 256 color            */
#define _URES256COLOR   0x100   /* 640 x 400, 256 color            */
#define _VRES256COLOR   0x101   /* 640 x 480, 256 color            */
#define _SVRES16COLOR   0x102   /* 800 x 600, 16 color             */
#define _SVRES256COLOR  0x103   /* 800 x 600, 256 color            */
#define _XRES16COLOR    0x104   /* 1024 x 768, 16 color            */
#define _XRES256COLOR   0x105   /* 1024 x 768, 256 color           */
#define _YRES16COLOR    0x106   /* 1280 x 1024, 16 color           */
#define _YRES256COLOR   0x107   /* 1280 x 1024, 256 color          */
#define _SVTEXTC80X60   0x108   /* 80 x 60 text                    */
#define _SVTEXTC132X25  0x109   /* 132 x 25 text                   */
#define _SVTEXTC132X43  0x10A   /* 132 x 43 text                   */
#define _SVTEXTC132X50  0x10B   /* 132 x 50 text                   */
#define _SVTEXTC132X60  0x10C   /* 132 x 60 text                   */
#define _MRES32KCOLOR   0x10D   /* 320 x 200, 32K color            */
#define _MRES64KCOLOR   0x10E   /* 320 x 200, 64K color            */
#define _MRESTRUECOLOR  0x10F   /* 320 x 200, TRUE color           */
#define _VRES32KCOLOR   0x110   /* 640 x 480, 32K color            */
#define _VRES64KCOLOR   0x111   /* 640 x 480, 64K color            */
#define _VRESTRUECOLOR  0x112   /* 640 x 480, 16.8M color          */
#define _SVRES32KCOLOR  0x113   /* 800 x 600, 32K color            */
#define _SVRES64KCOLOR  0x114   /* 800 x 600, 64K color            */
#define _SVRESTRUECOLOR 0x115   /* 800 x 600, 16.8M color          */
#define _XRES32KCOLOR   0x116   /* 1024 x 768, 32K color           */
#define _XRES64KCOLOR   0x117   /* 1024 x 768, 64K color           */
#define _XRESTRUECOLOR  0x118   /* 1024 x 768, 16.8M color         */
#define _YRES32KCOLOR   0x119   /* 1280 x 1024, 32K color          */
#define _YRES64KCOLOR   0x11A   /* 1280 x 1024, 64K color          */
#define _YRESTRUECOLOR  0x11B   /* 1280 x 1024, 16.8M color        */
#define _ZRES256COLOR   0x11C   /* 1600 x 1200, 256 color          */
#define _ZRES32KCOLOR   0x11D   /* 1600 x 1200, 32K color          */
#define _ZRES64KCOLOR   0x11E   /* 1600 x 1200, 64K color          */
#define _ZRESTRUECOLOR  0x11F   /* 1600 x 1200, 16.8M color        */
:endsegment
:segment NEC
#define _98TEXT80        3      /* 80 column text, 8 color         */
#define _98RESSCOLOR     81     /* 640 x 400, 8 color (superimpose)*/
#define _98RESS8COLOR    84     /* 640 x 400, 8 of 4096 (superimpose)*/
#define _98RESS16COLOR   85     /* 640 x 400, 16 of 4096 (superimpose)*/
#define _98HIRESS16COLOR 93     /* 1120 x 750, 16 of 4096 (superimpose)*/
#define _98RESCOLOR      97     /* 640 x 400, 8 color              */
#define _98RES8COLOR     100    /* 640 x 400, 8 of 4096 color      */
#define _98RES16COLOR    101    /* 640 x 400, 16 of 4096 color     */
#define _98HIRES16COLOR  109    /* 1120 x 750, 16 of 4096 color    */
:endsegment

#define _NODISPLAY      (-1)    /* no display device            */
#define _UNKNOWN        0       /* unknown adapter/monitor type */

:segment DOS | QNX | LINUX
#define _MDPA           1       /* monochrome display/printer adapter */
#define _CGA            2       /* colour/graphics monitor adapter    */
#define _HERCULES       3       /* Hercules monochrome adapter card   */
#define _MCGA           4       /* PS/2 Model 30 monitor              */
#define _EGA            5       /* enhanced graphics adapter          */
#define _VGA            6       /* vector graphics array              */
#define _SVGA           7       /* super VGA                          */
#define _HGC            _HERCULES

#define _MONO           1       /* regular monochrome */
#define _COLOR          2       /* regular color      */
#define _ENHANCED       3       /* enhanced color     */
#define _ANALOGMONO     5       /* analog monochrome  */
#define _ANALOGCOLOR    6       /* analog color       */
:endsegment
:segment NEC
#define _98CGA          0x2000  /* Color Graphics Adapter (digital)   */
#define _98EGA          0x4000  /* Enhanced Graphics Adapter (analog) */

#define _98ANALOG       0x0100  /* Analog color monitor               */
#define _98DIGITAL      0x0200  /* Digital color monitor              */
:endsegment

#define _GROK                   0      /* no error                     */
#define _GRERROR                (-1)   /* graphics error               */
#define _GRMODENOTSUPPORTED     (-2)   /* video mode not supported     */
#define _GRNOTINPROPERMODE      (-3)   /* function n/a in this mode    */
#define _GRINVALIDPARAMETER     (-4)   /* invalid parameter(s)         */
#define _GRINSUFFICIENTMEMORY   (-5)   /* out of memory                */
#define _GRFONTFILENOTFOUND     (-6)   /* can't open font file         */
#define _GRINVALIDFONTFILE      (-7)   /* font file has invalid format */
#define _GRNOOUTPUT             1      /* nothing was done             */
#define _GRCLIPPED              2      /* output clipped               */

/* Colour Setting and Query Functions */

short _WCI86FAR         _setcolor( short );
short _WCI86FAR         _getcolor( void );
long _WCI86FAR          _setbkcolor( long );
long _WCI86FAR          _getbkcolor( void );
long _WCI86FAR          _remappalette( short, long );
short _WCI86FAR         _remapallpalette( long _WCI86FAR * );
short _WCI86FAR         _selectpalette( short );

:segment DOS | QNX | LINUX
#define _BLACK          0x000000L
#define _BLUE           0x2a0000L
#define _GREEN          0x002a00L
#define _CYAN           0x2a2a00L

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?