home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / GRAPH.H < prev    next >
C/C++ Source or Header  |  1996-07-24  |  15KB  |  368 lines

  1. /*
  2.  *  graph.h     Graphics functions
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _GRAPH_H_INCLUDED
  7. #define _GRAPH_H_INCLUDED
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. #ifndef _COMDEF_H_INCLUDED
  13.  #include <_comdef.h>
  14. #endif
  15.  
  16. #if defined(_M_IX86)
  17.   #pragma pack(__push,1);
  18. #else
  19.   #pragma pack(__push,8);
  20. #endif
  21.  
  22. #pragma library (graph);
  23.  
  24. struct xycoord {                /* structure for pixel position */
  25.     short   xcoord;
  26.     short   ycoord;
  27. };
  28.  
  29. struct _wxycoord {              /* structure for window position*/
  30.     double  wx;
  31.     double  wy;
  32. };
  33.  
  34. struct rccoord {                /* structure for text position  */
  35.     short   row;
  36.     short   col;
  37. };
  38.  
  39. struct videoconfig {            /* structure for _getvideoconfig */
  40.     short   numxpixels;
  41.     short   numypixels;
  42.     short   numtextcols;
  43.     short   numtextrows;
  44.     short   numcolors;
  45.     short   bitsperpixel;
  46.     short   numvideopages;
  47.     short   mode;
  48.     short   adapter;
  49.     short   monitor;
  50.     short   memory;
  51. };
  52.  
  53. struct textsettings {           /* structure for _gettextsettings */
  54.     short   basevectorx;
  55.     short   basevectory;
  56.     short   txpath;
  57.     short   height;
  58.     short   width;
  59.     short   spacing;
  60.     short   horizalign;
  61.     short   vertalign;
  62. };
  63.  
  64. struct _fontinfo {              /* structure for _getfontinfo */
  65.     short   type;
  66.     short   ascent;
  67.     short   pixwidth;
  68.     short   pixheight;
  69.     short   avgwidth;
  70.     char    filename[ 81 ];
  71.     char    facename[ 32 ];
  72. };
  73.  
  74. /* Calling conventions for -fpi(87) are different than for -fpc */
  75. #if defined( __FPI__ )
  76.     #define _arc_w              _arc_w_87
  77.     #define _ellipse_w          _ellipse_w_87
  78.     #define _floodfill_w        _floodfill_w_87
  79.     #define _getimage_w         _getimage_w_87
  80.     #define _getpixel_w         _getpixel_w_87
  81.     #define _getviewcoord_w     _getviewcoord_w_87
  82.     #define _grtext_w           _grtext_w_87
  83.     #define _imagesize_w        _imagesize_w_87
  84.     #define _lineto_w           _lineto_w_87
  85.     #define _moveto_w           _moveto_w_87
  86.     #define _pie_w              _pie_w_87
  87.     #define _putimage_w         _putimage_w_87
  88.     #define _rectangle_w        _rectangle_w_87
  89.     #define _setcharsize_w      _setcharsize_w_87
  90.     #define _setcharspacing_w   _setcharspacing_w_87
  91.     #define _setpixel_w         _setpixel_w_87
  92.     #define _setwindow          _setwindow_87
  93. #endif
  94.  
  95. /* Video Setup and Query Functions */
  96.  
  97. short _WCI86FAR         _setvideomode( short );
  98. short _WCI86FAR         _setvideomoderows( short, short );
  99. struct videoconfig _WCI86FAR * _WCI86FAR
  100.             _getvideoconfig( struct videoconfig _WCI86FAR * );
  101. short _WCI86FAR         _grstatus( void );
  102. short _WCI86FAR         _setactivepage( short );
  103. short _WCI86FAR         _getactivepage( void );
  104. short _WCI86FAR         _setvisualpage( short );
  105. short _WCI86FAR         _getvisualpage( void );
  106.  
  107. #define _MAXRESMODE     (-3)    /* graphics mode with highest res. */
  108. #define _MAXCOLORMODE   (-2)    /* graphics mode with most colours */
  109. #define _DEFAULTMODE    (-1)    /* restore screen to original mode */
  110. #define _TEXTBW40       0       /* 40 x 25 text, 16 grey           */
  111. #define _TEXTC40        1       /* 40 x 25 text, 16/8 color        */
  112. #define _TEXTBW80       2       /* 80 x 25 text, 16 grey           */
  113. #define _TEXTC80        3       /* 80 x 25 text, 16/8 color        */
  114. #define _MRES4COLOR     4       /* 320 x 200, 4 color              */
  115. #define _MRESNOCOLOR    5       /* 320 x 200, 4 grey               */
  116. #define _HRESBW         6       /* 640 x 200, BW                   */
  117. #define _TEXTMONO       7       /* 80 x 25 text, BW                */
  118. #define _HERCMONO       11      /* 720 x 350, BW                   */
  119. #define _MRES16COLOR    13      /* 320 x 200, 16 color             */
  120. #define _HRES16COLOR    14      /* 640 x 200, 16 color             */
  121. #define _ERESNOCOLOR    15      /* 640 x 350, BW                   */
  122. #define _ERESCOLOR      16      /* 640 x 350, 4 or 16 color        */
  123. #define _VRES2COLOR     17      /* 640 x 480, BW                   */
  124. #define _VRES16COLOR    18      /* 640 x 480, 16 color             */
  125. #define _MRES256COLOR   19      /* 320 x 200, 256 color            */
  126. #define _URES256COLOR   0x100   /* 640 x 400, 256 color            */
  127. #define _VRES256COLOR   0x101   /* 640 x 480, 256 color            */
  128. #define _SVRES16COLOR   0x102   /* 800 x 600, 16 color             */
  129. #define _SVRES256COLOR  0x103   /* 800 x 600, 256 color            */
  130. #define _XRES16COLOR    0x104   /* 1024 x 768, 16 color            */
  131. #define _XRES256COLOR   0x105   /* 1024 x 768, 256 color           */
  132.  
  133. #define _NODISPLAY      (-1)    /* no display device            */
  134. #define _UNKNOWN        0       /* unknown adapter/monitor type */
  135.  
  136. #define _MDPA           1       /* monochrome display/printer adapter */
  137. #define _CGA            2       /* colour/graphics monitor adapter    */
  138. #define _HERCULES       3       /* Hercules monochrome adapter card   */
  139. #define _MCGA           4       /* PS/2 Model 30 monitor              */
  140. #define _EGA            5       /* enhanced graphics adapter          */
  141. #define _VGA            6       /* vector graphics array              */
  142. #define _SVGA           7       /* super VGA                          */
  143. #define _HGC            _HERCULES
  144.  
  145. #define _MONO           1       /* regular monochrome */
  146. #define _COLOR          2       /* regular color      */
  147. #define _ENHANCED       3       /* enhanced color     */
  148. #define _ANALOGMONO     5       /* analog monochrome  */
  149. #define _ANALOGCOLOR    6       /* analog color       */
  150.  
  151. #define _GROK                   0      /* no error                     */
  152. #define _GRERROR                (-1)   /* graphics error               */
  153. #define _GRMODENOTSUPPORTED     (-2)   /* video mode not supported     */
  154. #define _GRNOTINPROPERMODE      (-3)   /* function n/a in this mode    */
  155. #define _GRINVALIDPARAMETER     (-4)   /* invalid parameter(s)         */
  156. #define _GRINSUFFICIENTMEMORY   (-5)   /* out of memory                */
  157. #define _GRFONTFILENOTFOUND     (-6)   /* can't open font file         */
  158. #define _GRINVALIDFONTFILE      (-7)   /* font file has invalid format */
  159. #define _GRNOOUTPUT             1      /* nothing was done             */
  160. #define _GRCLIPPED              2      /* output clipped               */
  161.  
  162. /* Colour Setting and Query Functions */
  163.  
  164. short _WCI86FAR         _setcolor( short );
  165. short _WCI86FAR         _getcolor( void );
  166. long _WCI86FAR          _setbkcolor( long );
  167. long _WCI86FAR          _getbkcolor( void );
  168. long _WCI86FAR          _remappalette( short, long );
  169. short _WCI86FAR         _remapallpalette( long _WCI86FAR * );
  170. short _WCI86FAR         _selectpalette( short );
  171.  
  172. #define _BLACK          0x000000L
  173. #define _BLUE           0x2a0000L
  174. #define _GREEN          0x002a00L
  175. #define _CYAN           0x2a2a00L
  176. #define _RED            0x00002aL
  177. #define _MAGENTA        0x2a002aL
  178. #define _BROWN          0x00152aL
  179. #define _WHITE          0x2a2a2aL
  180. #define _GRAY           0x151515L
  181. #define _LIGHTBLUE      0x3F1515L
  182. #define _LIGHTGREEN     0x153f15L
  183. #define _LIGHTCYAN      0x3f3f15L
  184. #define _LIGHTRED       0x15153fL
  185. #define _LIGHTMAGENTA   0x3f153fL
  186. #define _YELLOW         0x153f3fL
  187. #define _BRIGHTWHITE    0x3f3f3fL
  188. #define _LIGHTYELLOW    _YELLOW
  189.  
  190. /* Shape and Curve Drawing Functions */
  191.  
  192. short _WCI86FAR         _lineto( short, short );
  193. short _WCI86FAR         _lineto_w( double, double );
  194. short _WCI86FAR         _rectangle( short, short, short, short, short );
  195. short _WCI86FAR         _rectangle_w( short, double, double, double, double );
  196. short _WCI86FAR         _rectangle_wxy( short, struct _wxycoord _WCI86FAR *,
  197.                            struct _wxycoord _WCI86FAR * );
  198. short _WCI86FAR         _arc( short, short, short, short, short, short,
  199.                   short, short );
  200. short _WCI86FAR         _arc_w( double, double, double, double, double,
  201.                 double, double, double );
  202. short _WCI86FAR         _arc_wxy( struct _wxycoord _WCI86FAR *,
  203.                   struct _wxycoord _WCI86FAR *,
  204.                   struct _wxycoord _WCI86FAR *,
  205.                   struct _wxycoord _WCI86FAR * );
  206. short _WCI86FAR         _ellipse( short, short, short, short, short );
  207. short _WCI86FAR         _ellipse_w( short, double, double, double, double );
  208. short _WCI86FAR         _ellipse_wxy( short, struct _wxycoord _WCI86FAR *,
  209.                       struct _wxycoord _WCI86FAR * );
  210. short _WCI86FAR         _pie( short, short, short, short, short, short,
  211.                   short, short, short );
  212. short _WCI86FAR         _pie_w( short, double, double, double, double,
  213.                 double, double, double, double );
  214. short _WCI86FAR         _pie_wxy( short, struct _wxycoord _WCI86FAR *,
  215.                   struct _wxycoord _WCI86FAR *,
  216.                   struct _wxycoord _WCI86FAR *,
  217.                   struct _wxycoord _WCI86FAR * );
  218. short _WCI86FAR         _polygon( short, short, struct xycoord _WCI86FAR * );
  219. short _WCI86FAR         _polygon_w( short, short, double _WCI86FAR * );
  220. short _WCI86FAR         _polygon_wxy( short, short, struct _wxycoord _WCI86FAR * );
  221. short _WCI86FAR         _floodfill( short, short, short );
  222. short _WCI86FAR         _floodfill_w( double, double, short );
  223. short _WCI86FAR         _setpixel( short, short );
  224. short _WCI86FAR         _setpixel_w( double, double );
  225. short _WCI86FAR         _getpixel( short, short );
  226. short _WCI86FAR         _getpixel_w( double, double );
  227. short _WCI86FAR         _getarcinfo( struct xycoord _WCI86FAR *,
  228.                      struct xycoord _WCI86FAR *,
  229.                      struct xycoord _WCI86FAR * );
  230.  
  231. /* Position Determination Functions */
  232.  
  233. struct xycoord _WCI86FAR   _getcurrentposition( void );
  234. struct _wxycoord _WCI86FAR _getcurrentposition_w( void );
  235. struct xycoord _WCI86FAR   _getviewcoord( short, short );
  236. struct xycoord _WCI86FAR   _getviewcoord_w( double, double );
  237. struct xycoord _WCI86FAR   _getviewcoord_wxy( struct _wxycoord _WCI86FAR * );
  238. struct xycoord _WCI86FAR   _getphyscoord( short, short );
  239. struct _wxycoord _WCI86FAR _getwindowcoord( short, short );
  240. struct xycoord _WCI86FAR   _moveto( short, short );
  241. struct _wxycoord _WCI86FAR _moveto_w( double, double );
  242. struct xycoord _WCI86FAR   _setvieworg( short, short );
  243.  
  244. #define _getlogcoord    _getviewcoord        /* for compatibility */
  245. #define _setlogorg      _setvieworg
  246.  
  247. /* Output Determination Functions */
  248.  
  249. void _WCI86FAR           _setfillmask( unsigned char _WCI86FAR * );
  250. unsigned char _WCI86FAR * _WCI86FAR
  251.              _getfillmask( unsigned char _WCI86FAR * );
  252. void _WCI86FAR           _setlinestyle( unsigned short );
  253. unsigned short _WCI86FAR _getlinestyle( void );
  254. short _WCI86FAR          _setplotaction( short );
  255. short _WCI86FAR          _getplotaction( void );
  256.  
  257. #define _setwritemode   _setplotaction      /* for compatibility */
  258. #define _getwritemode   _getplotaction
  259.  
  260. enum {                          /* plotting action */
  261.     _GOR, _GAND, _GPRESET, _GPSET, _GXOR
  262. };
  263.  
  264. /* Screen Manipulation Functions */
  265.  
  266. void _WCI86FAR          _clearscreen( short );
  267. void _WCI86FAR          _setviewport( short, short, short, short );
  268. void _WCI86FAR          _setcliprgn( short, short, short, short );
  269. void _WCI86FAR          _getcliprgn( short _WCI86FAR *, short _WCI86FAR *,
  270.                      short _WCI86FAR *, short _WCI86FAR * );
  271. short _WCI86FAR         _displaycursor( short );
  272. short _WCI86FAR         _wrapon( short );
  273. short _WCI86FAR         _setwindow( short, double, double, double, double );
  274.  
  275. #define _GCLEARSCREEN   0
  276. #define _GVIEWPORT      1
  277. #define _GWINDOW        2
  278.  
  279. #define _GBORDER        2
  280. #define _GFILLINTERIOR  3
  281.  
  282. enum {                          /* cursor display */
  283.     _GCURSOROFF, _GCURSORON
  284. };
  285.  
  286. enum {                          /* text wrapping */
  287.     _GWRAPOFF, _GWRAPON
  288. };
  289.  
  290. /* Graphics Text Manipulation Functions and Constants */
  291.  
  292. struct textsettings _WCI86FAR * _WCI86FAR
  293.             _gettextsettings( struct textsettings _WCI86FAR * );
  294. void _WCI86FAR          _gettextextent( short, short, char _WCI86FAR *,
  295.                struct xycoord _WCI86FAR *, struct xycoord _WCI86FAR * );
  296. void _WCI86FAR          _setcharsize( short, short );
  297. void _WCI86FAR          _setcharsize_w( double, double );
  298. void _WCI86FAR          _settextalign( short, short );
  299. void _WCI86FAR          _settextpath( short );
  300. void _WCI86FAR          _settextorient( short, short );
  301. void _WCI86FAR          _setcharspacing( short );
  302. void _WCI86FAR          _setcharspacing_w( double );
  303. short _WCI86FAR         _grtext( short, short, char _WCI86FAR * );
  304. short _WCI86FAR         _grtext_w( double, double, char _WCI86FAR * );
  305.  
  306. enum {                          /* horizontal alignment */
  307.     _NORMAL, _LEFT, _CENTER, _RIGHT
  308. };
  309.  
  310. enum {                          /* vertical alignment */
  311.     _TOP=1, _CAP, _HALF, _BASE, _BOTTOM
  312. };
  313.  
  314. enum {                          /* text path */
  315.     _PATH_RIGHT, _PATH_LEFT, _PATH_UP, _PATH_DOWN
  316. };
  317.  
  318. /* Text Manipulation Functions */
  319.  
  320. #define _GSCROLLUP      1
  321. #define _GSCROLLDOWN    (-1)
  322. #define _MAXTEXTROWS    (-1)
  323.  
  324. void _WCI86FAR           _settextwindow( short, short, short, short );
  325. void _WCI86FAR           _outtext( char _WCI86FAR * );
  326. short _WCI86FAR          _settextcolor( short );
  327. short _WCI86FAR          _gettextcolor( void );
  328. struct rccoord _WCI86FAR _settextposition( short, short );
  329. struct rccoord _WCI86FAR _gettextposition( void );
  330. void _WCI86FAR           _scrolltextwindow( short );
  331. void _WCI86FAR           _gettextwindow( short _WCI86FAR *, short _WCI86FAR *,
  332.                      short _WCI86FAR *, short _WCI86FAR * );
  333. short _WCI86FAR          _gettextcursor( void );
  334. short _WCI86FAR          _settextcursor( short );
  335. void _WCI86FAR           _outmem( unsigned char _WCI86FAR *, short );
  336. short _WCI86FAR          _settextrows( short );
  337.  
  338. /* Image Manipulation Functions */
  339.  
  340. void _WCI86FAR           _getimage( short, short, short, short, char _WCI86HUGE * );
  341. void _WCI86FAR           _getimage_w( double, double, double, double, char _WCI86HUGE * );
  342. void _WCI86FAR           _getimage_wxy( struct _wxycoord _WCI86FAR *,
  343.                         struct _wxycoord _WCI86FAR *, 
  344.                     char _WCI86HUGE * );
  345. void _WCI86FAR           _putimage( short, short, char _WCI86HUGE *, short );
  346. void _WCI86FAR           _putimage_w( double, double, char _WCI86HUGE *, short );
  347. long _WCI86FAR           _imagesize( short, short, short, short );
  348. long _WCI86FAR           _imagesize_w( double, double, double, double );
  349. long _WCI86FAR           _imagesize_wxy( struct _wxycoord _WCI86FAR *,
  350.                      struct _wxycoord _WCI86FAR * );
  351.  
  352. /* Font Manipulation Functions */
  353.  
  354. short _WCI86FAR          _registerfonts( char _WCI86FAR * );
  355. void _WCI86FAR           _unregisterfonts( void );
  356. short _WCI86FAR          _setfont( char _WCI86FAR * );
  357. short _WCI86FAR          _getfontinfo( struct _fontinfo _WCI86FAR * );
  358. void _WCI86FAR           _outgtext( char _WCI86FAR * );
  359. short _WCI86FAR          _getgtextextent( char _WCI86FAR * );
  360. struct xycoord _WCI86FAR _setgtextvector( short, short );
  361. struct xycoord _WCI86FAR _getgtextvector( void );
  362.  
  363. #pragma pack(__pop);
  364. #ifdef __cplusplus
  365. };
  366. #endif
  367. #endif
  368.