home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c034 / 4.ddi / INCLUDE / GRAPH.H$ / GRAPH.bin
Encoding:
Text File  |  1990-01-22  |  15.1 KB  |  428 lines

  1. /***
  2. *graph.h - declare constants, functions, and macros for graphics library
  3. *
  4. *   Copyright (c) 1987 - 1990, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *   This file declares the graphics library functions and the
  8. *   structures and manifest constants that are used with them.
  9. *
  10. ***************************************************************************/
  11.  
  12.  
  13. /* force word packing to avoid possible -Zp override */
  14. #pragma pack(2)
  15.  
  16. /* user-visible declarations for Quick-C Graphics Library */
  17.  
  18. #ifndef _VIDEOCONFIG_DEFINED
  19. /* structure for _getvideoconfig() as visible to user */
  20. struct videoconfig {
  21.     short numxpixels;    /* number of pixels on X axis */
  22.     short numypixels;    /* number of pixels on Y axis */
  23.     short numtextcols;    /* number of text columns available */
  24.     short numtextrows;    /* number of text rows available */
  25.     short numcolors;    /* number of actual colors */
  26.     short bitsperpixel;    /* number of bits per pixel */
  27.     short numvideopages;    /* number of available video pages */
  28.     short mode;        /* current video mode */
  29.     short adapter;        /* active display adapter */
  30.     short monitor;        /* active display monitor */
  31.     short memory;        /* adapter video memory in K bytes */
  32. };
  33. #define _VIDEOCONFIG_DEFINED
  34. #endif
  35.  
  36.  
  37. #ifndef _XYCOORD_DEFINED
  38. /* return value of _setvieworg(), etc. */
  39. struct xycoord {
  40.     short xcoord;
  41.     short ycoord;
  42. };
  43. #define _XYCOORD_DEFINED
  44. #endif
  45.  
  46.  
  47. /* structure for text position */
  48. #ifndef _RCCOORD_DEFINED
  49. struct rccoord {
  50.     short row;
  51.     short col;
  52. };
  53. #define _RCCOORD_DEFINED
  54. #endif
  55.  
  56.  
  57.  
  58. /* ERROR HANDLING */
  59. short _far _cdecl _grstatus(void);
  60.  
  61. /* Error Status Information returned by _grstatus() */
  62.  
  63. /* successful */
  64. #define    _GROK                        0
  65.  
  66. /* errors */
  67. #define _GRERROR                    (-1)
  68. #define    _GRMODENOTSUPPORTED        (-2)
  69. #define    _GRNOTINPROPERMODE          (-3)
  70. #define _GRINVALIDPARAMETER         (-4)
  71. #define    _GRFONTFILENOTFOUND         (-5)
  72. #define    _GRINVALIDFONTFILE          (-6)
  73. #define _GRCORRUPTEDFONTFILE        (-7)
  74. #define _GRINSUFFICIENTMEMORY       (-8)
  75. #define _GRINVALIDIMAGEBUFFER       (-9)
  76.  
  77. /* warnings */
  78. #define _GRNOOUTPUT                  1
  79. #define _GRCLIPPED                   2
  80. #define _GRPARAMETERALTERED          3
  81.  
  82.  
  83. /* SETUP AND CONFIGURATION */
  84.  
  85. short _far _cdecl _setvideomode(short);
  86. short _far _cdecl _setvideomoderows(short,short); /* return rows; 0 if error */
  87.  
  88. /* arguments to _setvideomode() */
  89. #define _MAXRESMODE    (-3)    /* graphics mode with highest resolution */
  90. #define _MAXCOLORMODE    (-2)    /* graphics mode with most colors */
  91. #define _DEFAULTMODE    (-1)    /* restore screen to original mode */
  92. #define _TEXTBW40    0    /* 40-column text, 16 grey */
  93. #define _TEXTC40    1    /* 40-column text, 16/8 color */
  94. #define _TEXTBW80    2    /* 80-column text, 16 grey */
  95. #define _TEXTC80    3    /* 80-column text, 16/8 color */
  96. #define _MRES4COLOR    4    /* 320 x 200, 4 color */
  97. #define _MRESNOCOLOR    5    /* 320 x 200, 4 grey */
  98. #define _HRESBW        6    /* 640 x 200, BW */
  99. #define _TEXTMONO    7    /* 80-column text, BW */
  100. #define _HERCMONO    8    /* 720 x 348, BW for HGC */
  101. #define _MRES16COLOR    13    /* 320 x 200, 16 color */
  102. #define _HRES16COLOR    14    /* 640 x 200, 16 color */
  103. #define _ERESNOCOLOR    15    /* 640 x 350, BW */
  104. #define _ERESCOLOR    16    /* 640 x 350, 4 or 16 color */
  105. #define _VRES2COLOR    17    /* 640 x 480, BW */
  106. #define _VRES16COLOR    18    /* 640 x 480, 16 color */
  107. #define _MRES256COLOR    19    /* 320 x 200, 256 color */
  108. #define _ORESCOLOR    64    /* 640 x 400, 1 of 16 colors (Olivetti) */
  109.  
  110. short _far _cdecl _setactivepage(short);
  111. short _far _cdecl _setvisualpage(short);
  112. short _far _cdecl _getactivepage(void);
  113. short _far _cdecl _getvisualpage(void);
  114.  
  115. /* videoconfig adapter values */
  116. /* these manifest constants can be used to determine the type of the active  */
  117. /* adapter, using either simple comparisons or the bitwise-AND operator (&)  */
  118. #define _MDPA        0x0001    /* Monochrome Display Adapter          (MDPA) */
  119. #define _CGA        0x0002    /* Color Graphics Adapter          (CGA)  */
  120. #define _EGA        0x0004    /* Enhanced Graphics Adapter          (EGA)  */
  121. #define _VGA        0x0008    /* Video Graphics Array              (VGA)  */
  122. #define _MCGA        0x0010    /* MultiColor Graphics Array          (MCGA) */
  123. #define _HGC        0x0020    /* Hercules Graphics Card          (HGC)  */
  124. #define _OCGA        0x0042    /* Olivetti Color Graphics Adapter    (OCGA) */
  125. #define _OEGA        0x0044    /* Olivetti Enhanced Graphics Adapter (OEGA) */
  126. #define _OVGA        0x0048    /* Olivetti Video Graphics Array      (OVGA) */
  127.  
  128. /* videoconfig monitor values */
  129. /* these manifest constants can be used to determine the type of monitor in */
  130. /* use, using either simple comparisons or the bitwise-AND operator (&) */
  131. #define _MONO        0x0001    /* Monochrome */
  132. #define _COLOR        0x0002    /* Color (or Enhanced emulating color) */
  133. #define _ENHCOLOR    0x0004    /* Enhanced Color */
  134. #define _ANALOGMONO    0x0008    /* Analog Monochrome only */
  135. #define _ANALOGCOLOR    0x0010    /* Analog Color only */
  136. #define _ANALOG        0x0018    /* Analog Monochrome and Color modes */
  137.  
  138. struct videoconfig _far * _far _cdecl _getvideoconfig(struct videoconfig _far *);
  139.  
  140.  
  141.  
  142. /* COORDINATE SYSTEMS */
  143.  
  144. struct xycoord _far _cdecl _setvieworg(short, short);
  145. #define _setlogorg _setvieworg        /* obsolescent */
  146.  
  147. struct xycoord _far _cdecl _getviewcoord(short, short);
  148. #define _getlogcoord _getviewcoord    /* obsolescent */
  149.  
  150. struct xycoord _far _cdecl _getphyscoord(short, short);
  151.  
  152. void _far _cdecl _setcliprgn(short, short, short, short);
  153. void _far _cdecl _setviewport(short, short, short, short);
  154.  
  155.  
  156. /* OUTPUT ROUTINES */
  157.  
  158. /* control parameters for _ellipse, _rectangle, _pie and _polygon */
  159. #define _GBORDER    2    /* draw outline only */
  160. #define _GFILLINTERIOR    3    /* fill using current fill mask */
  161.  
  162. /* parameters for _clearscreen */
  163. #define _GCLEARSCREEN    0
  164. #define _GVIEWPORT    1
  165. #define _GWINDOW    2
  166.  
  167. void _far _cdecl _clearscreen(short);
  168.  
  169. struct xycoord _far _cdecl _moveto(short, short);
  170. struct xycoord _far _cdecl _getcurrentposition(void);
  171.  
  172. short _far _cdecl _lineto(short, short);
  173. short _far _cdecl _rectangle(short, short, short, short, short);
  174. short _far _cdecl _polygon(short, const struct xycoord _far *, short);
  175. short _far _cdecl _arc(short, short, short, short, short, short, short, short);
  176. short _far _cdecl _ellipse(short, short, short, short, short);
  177. short _far _cdecl _pie(short, short, short, short, short, short, short, short, short);
  178.  
  179. short _far _cdecl _getarcinfo(struct xycoord _far *, struct xycoord _far *, struct xycoord _far *);
  180.  
  181. short _far _cdecl _setpixel(short, short);
  182. short _far _cdecl _getpixel(short, short);
  183. short _far _cdecl _floodfill(short, short, short);
  184.  
  185.  
  186. /* PEN COLOR, LINE STYLE, WRITE MODE, FILL PATTERN */
  187.  
  188. short _far _cdecl _setcolor(short);
  189. short _far _cdecl _getcolor(void);
  190.  
  191. void _far _cdecl _setlinestyle(unsigned short);
  192. unsigned short _far _cdecl _getlinestyle(void);
  193.  
  194. short _far _cdecl _setwritemode(short);
  195. short _far _cdecl _getwritemode(void);
  196.  
  197. void _far _cdecl _setfillmask(const unsigned char _far *);
  198. unsigned char _far * _far _cdecl _getfillmask(unsigned char _far *);
  199.  
  200. /* COLOR SELECTION */
  201.  
  202. long _far _cdecl _setbkcolor(long);
  203. long _far _cdecl _getbkcolor(void);
  204.  
  205. long _far _cdecl _remappalette(short, long);
  206. short _far _cdecl _remapallpalette(const long _far *);
  207. short _far _cdecl _selectpalette(short);
  208.  
  209.  
  210. /* TEXT */
  211. /* parameters for _displaycursor */
  212. #define _GCURSOROFF    0
  213. #define _GCURSORON    1
  214.  
  215. /* parameters for _wrapon */
  216. #define _GWRAPOFF    0
  217. #define _GWRAPON    1
  218.  
  219.  
  220. /* direction parameters for _scrolltextwindow */
  221. #define _GSCROLLUP    1
  222. #define _GSCROLLDOWN    (-1)
  223.  
  224. /* request maximum number of rows in _settextrows and _setvideomoderows */
  225. #define _MAXTEXTROWS    (-1)
  226.  
  227. short _far _cdecl _settextrows(short); /* returns # rows set; 0 if error */
  228. void _far _cdecl _settextwindow(short, short, short, short);
  229. void _far _cdecl _gettextwindow(short _far *, short _far *, short _far *, short _far *);
  230. void _far _cdecl _scrolltextwindow(short);
  231. void _far _cdecl _outmem(const unsigned char _far *, short);
  232. void _far _cdecl _outtext(const unsigned char _far *);
  233. short _far _cdecl _wrapon(short);
  234.  
  235. short _far _cdecl _displaycursor(short);
  236. short _far _cdecl _settextcursor(short);
  237. short _far _cdecl _gettextcursor(void);
  238.  
  239. struct rccoord _far _cdecl _settextposition(short, short);
  240. struct rccoord _far _cdecl _gettextposition(void);
  241.  
  242. short _far _cdecl _settextcolor(short);
  243. short _far _cdecl _gettextcolor(void);
  244.  
  245.  
  246. /* SCREEN IMAGES */
  247.  
  248. void _far _cdecl _getimage(short, short, short, short, char _huge *);
  249. void _far _cdecl _putimage(short, short, char _huge *, short);
  250. long _far _cdecl _imagesize(short, short, short, short);
  251.  
  252. /* "action verbs" for _putimage() and _setwritemode() */
  253. #define _GPSET        3
  254. #define _GPRESET    2
  255. #define _GAND        1
  256. #define _GOR        0
  257. #define _GXOR        4
  258.  
  259.  
  260. /* Color values are used with _setbkcolor in graphics modes and also by
  261.    _remappalette and _remapallpalette.  Also known as palette colors.
  262.    Not to be confused with color indices (aka. color attributes).  */
  263.  
  264. /* universal color values (all color modes): */
  265. #define _BLACK        0x000000L
  266. #define _BLUE        0x2a0000L
  267. #define _GREEN        0x002a00L
  268. #define _CYAN        0x2a2a00L
  269. #define _RED        0x00002aL
  270. #define _MAGENTA    0x2a002aL
  271. #define _BROWN        0x00152aL
  272. #define _WHITE        0x2a2a2aL
  273. #define _GRAY        0x151515L
  274. #define _LIGHTBLUE    0x3F1515L
  275. #define _LIGHTGREEN    0x153f15L
  276. #define _LIGHTCYAN    0x3f3f15L
  277. #define _LIGHTRED    0x15153fL
  278. #define _LIGHTMAGENTA    0x3f153fL
  279. #define _YELLOW        0x153f3fL
  280. #define _BRIGHTWHITE    0x3f3f3fL
  281.  
  282. /* the following is obsolescent and defined only for backward compatibility */
  283. #define _LIGHTYELLOW    _YELLOW
  284.  
  285. /* mono mode F (_ERESNOCOLOR) color values: */
  286. #define _MODEFOFF    0L
  287. #define _MODEFOFFTOON    1L
  288. #define _MODEFOFFTOHI    2L
  289. #define _MODEFONTOOFF    3L
  290. #define _MODEFON    4L
  291. #define _MODEFONTOHI    5L
  292. #define _MODEFHITOOFF    6L
  293. #define _MODEFHITOON    7L
  294. #define _MODEFHI    8L
  295.  
  296. /* mono mode 7 (_TEXTMONO) color values: */
  297. #define _MODE7OFF    0L
  298. #define _MODE7ON    1L
  299. #define _MODE7HI    2L
  300.  
  301.  
  302. /* Warning:  these '_xy' entrypoints are undocumented.
  303.    They may or may not be supported in future versions. */
  304. struct xycoord _far _cdecl _moveto_xy(struct xycoord);
  305. short _far _cdecl _lineto_xy(struct xycoord);
  306. short _far _cdecl _rectangle_xy(short,struct xycoord,struct xycoord);
  307. short _far _cdecl _arc_xy(struct xycoord, struct xycoord, struct xycoord, struct xycoord);
  308. short _far _cdecl _ellipse_xy(short, struct xycoord, struct xycoord);
  309. short _far _cdecl _pie_xy(short, struct xycoord, struct xycoord, struct xycoord, struct xycoord);
  310. short _far _cdecl _getpixel_xy(struct xycoord);
  311. short _far _cdecl _setpixel_xy(struct xycoord);
  312. short _far _cdecl _floodfill_xy(struct xycoord, short);
  313. void _far _cdecl _getimage_xy(struct xycoord,struct xycoord, char _huge *);
  314. long _far _cdecl _imagesize_xy(struct xycoord,struct xycoord);
  315. void _far _cdecl _putimage_xy(struct xycoord, char _huge *, short);
  316.  
  317.  
  318. /* WINDOW COORDINATE SYSTEM */
  319.  
  320. #ifndef _WXYCOORD_DEFINED
  321. /* structure for window coordinate pair */
  322. struct _wxycoord {
  323.     double wx;    /* window x coordinate */
  324.     double wy;    /* window y coordinate */
  325.     };
  326. #define _WXYCOORD_DEFINED
  327. #endif
  328.  
  329.  
  330. /* define real coordinate window - returns non-zero if successful */
  331. short _far _cdecl _setwindow(short,double,double,double,double);
  332.  
  333. /* convert from view to window coordinates */
  334. struct _wxycoord _far _cdecl _getwindowcoord(short,short);
  335. struct _wxycoord _far _cdecl _getwindowcoord_xy(struct xycoord);
  336.  
  337. /* convert from window to view coordinates */
  338. struct xycoord _far _cdecl _getviewcoord_w(double,double);
  339. struct xycoord _far _cdecl _getviewcoord_wxy(const struct _wxycoord _far *);
  340.  
  341. /*    return the window coordinates of the current graphics output
  342.     position as an _wxycoord structure. no error return. */
  343. struct _wxycoord _far _cdecl _getcurrentposition_w(void);
  344.  
  345.  
  346. /* window coordinate entry points for graphics output routines */
  347.  
  348. /*    returns nonzero if successful; otherwise 0    */
  349. short _far _cdecl _arc_w(double, double, double, double, double, double, double, double);
  350. short _far _cdecl _arc_wxy(const struct _wxycoord _far *, const struct _wxycoord _far *, const struct _wxycoord _far *, const struct _wxycoord _far *);
  351.  
  352. /*    returns nonzero if successful; otherwise 0    */
  353. short _far _cdecl _ellipse_w(short, double, double, double, double);
  354. short _far _cdecl _ellipse_wxy(short, const struct _wxycoord _far *, const struct _wxycoord _far *);
  355.  
  356. /*    returns nonzero if successful; otherwise 0    */
  357. short _far _cdecl _floodfill_w(double, double, short);
  358.  
  359. /*    returns pixel value at given point; -1 if unsuccessful. */
  360. short _far _cdecl _getpixel_w(double, double);
  361.  
  362. /*    returns nonzero if successful; otherwise 0    */
  363. short _far _cdecl _lineto_w(double, double);
  364.  
  365. /*    returns the view coordinates of the previous output
  366.     position as an _xycoord structure. no error return */
  367. struct _wxycoord _far _cdecl _moveto_w(double, double);
  368.  
  369. /*    returns nonzero if successful; otherwise 0    */
  370. short _far _cdecl _pie_w(short, double, double, double, double, double, double, double, double);
  371. short _far _cdecl _pie_wxy(short, const struct _wxycoord _far *, const struct _wxycoord _far *, const struct _wxycoord _far *, const struct _wxycoord _far *);
  372.  
  373. /*    returns nonzero if successful; otherwise 0    */
  374. short _far _cdecl _rectangle_w(short, double, double, double, double);
  375. short _far _cdecl _rectangle_wxy(short, const struct _wxycoord _far *, const struct _wxycoord _far *);
  376.  
  377. /*    returns nonzero if successful; otherwise 0    */
  378. short _far _cdecl _polygon_w(short, const double _far *, short);
  379. short _far _cdecl _polygon_wxy(short, const struct _wxycoord _far *, short);
  380.  
  381. /*    returns previous color; -1 if unsuccessful */
  382. short _far _cdecl _setpixel_w(double, double);
  383.  
  384.  
  385. /* window coordinate image routines */
  386.  
  387. /*    no return value */
  388. void _far _cdecl _getimage_w(double, double, double, double, char _huge *);
  389. void _far _cdecl _getimage_wxy(const struct _wxycoord _far *, const struct _wxycoord _far *, char _huge *);
  390.  
  391. /*    returns the image's storage size in bytes */
  392. long _far _cdecl _imagesize_w(double, double, double, double);
  393. long _far _cdecl _imagesize_wxy(const struct _wxycoord _far *, const struct _wxycoord _far *);
  394.  
  395. /*    no return value */
  396. void _far _cdecl _putimage_w(double, double ,char _huge * ,short);
  397.  
  398.  
  399. /* FONTS */
  400.  
  401. #ifndef _FONTINFO_DEFINED
  402. /* structure for _getfontinfo() */
  403. struct _fontinfo {
  404.     int    type;        /* b0 set = vector,clear = bit map    */
  405.     int    ascent;        /* pix dist from top to baseline    */
  406.     int    pixwidth;    /* character width in pixels, 0=prop    */
  407.     int    pixheight;    /* character height in pixels        */
  408.     int    avgwidth;    /* average character width in pixels    */
  409.     char    filename[81];    /* file name including path        */
  410.     char    facename[32];    /* font name                */
  411. };
  412. #define _FONTINFO_DEFINED
  413. #endif
  414.  
  415.  
  416. /* font function prototypes */
  417. short    _far _cdecl    _registerfonts( const unsigned char _far *);
  418. void    _far _cdecl    _unregisterfonts( void );
  419. short    _far _cdecl    _setfont( const unsigned char _far * );
  420. short    _far _cdecl    _getfontinfo( struct _fontinfo _far * );
  421. void    _far _cdecl    _outgtext( const unsigned char _far * );
  422. short    _far _cdecl    _getgtextextent( const unsigned char _far * );
  423. struct xycoord _far _cdecl _setgtextvector( short, short );
  424. struct xycoord _far _cdecl _getgtextvector(void);
  425.  
  426. /* restore default packing */
  427. #pragma pack()
  428.