home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL3.ZIP / PATINC.ZIP / GRAPHICS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  12.5 KB  |  388 lines

  1. /*    graphics.h
  2.  
  3.     Definitions for Graphics Package.
  4.  
  5.         Copyright (c) Borland International 1987,1988,1990,1991
  6.     All Rights Reserved.
  7. */
  8.  
  9. #if defined( _Windows )
  10. #error BGI graphics not supported under Windows
  11. #endif
  12.  
  13. #if !defined( __DEFS_H )
  14. #include <_defs.h>
  15. #endif
  16.  
  17. #if     !defined(__GRAPHX_DEF_)
  18. #define __GRAPHX_DEF_
  19.  
  20. enum graphics_errors {        /* graphresult error return codes */
  21.     grOk           =   0,
  22.     grNoInitGraph       =  -1,
  23.     grNotDetected       =  -2,
  24.     grFileNotFound       =  -3,
  25.     grInvalidDriver    =  -4,
  26.     grNoLoadMem       =  -5,
  27.     grNoScanMem       =  -6,
  28.     grNoFloodMem       =  -7,
  29.     grFontNotFound       =  -8,
  30.     grNoFontMem       =  -9,
  31.     grInvalidMode       = -10,
  32.     grError        = -11,   /* generic error */
  33.     grIOerror       = -12,
  34.     grInvalidFont       = -13,
  35.     grInvalidFontNum   = -14,
  36.     grInvalidVersion   = -18
  37. };
  38.  
  39. enum graphics_drivers {     /* define graphics drivers */
  40.     DETECT,         /* requests autodetection */
  41.     CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514,    /* 1 - 6 */
  42.     HERCMONO, ATT400, VGA, PC3270,            /* 7 - 10 */
  43.     CURRENT_DRIVER = -1
  44. };
  45.  
  46. enum graphics_modes {        /* graphics modes for each driver */
  47.     CGAC0      = 0,  /* 320x200 palette 0; 1 page    */
  48.     CGAC1      = 1,  /* 320x200 palette 1; 1 page    */
  49.     CGAC2      = 2,  /* 320x200 palette 2: 1 page    */
  50.     CGAC3      = 3,  /* 320x200 palette 3; 1 page    */
  51.     CGAHI      = 4,  /* 640x200 1 page            */
  52.     MCGAC0     = 0,  /* 320x200 palette 0; 1 page    */
  53.     MCGAC1     = 1,  /* 320x200 palette 1; 1 page    */
  54.     MCGAC2     = 2,  /* 320x200 palette 2; 1 page    */
  55.     MCGAC3     = 3,  /* 320x200 palette 3; 1 page    */
  56.     MCGAMED    = 4,  /* 640x200 1 page            */
  57.     MCGAHI     = 5,  /* 640x480 1 page            */
  58.     EGALO      = 0,  /* 640x200 16 color 4 pages    */
  59.     EGAHI      = 1,  /* 640x350 16 color 2 pages    */
  60.     EGA64LO    = 0,  /* 640x200 16 color 1 page     */
  61.     EGA64HI    = 1,  /* 640x350 4 color  1 page     */
  62.     EGAMONOHI  = 0,  /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
  63.     HERCMONOHI = 0,  /* 720x348 2 pages         */
  64.     ATT400C0   = 0,  /* 320x200 palette 0; 1 page    */
  65.     ATT400C1   = 1,  /* 320x200 palette 1; 1 page    */
  66.     ATT400C2   = 2,  /* 320x200 palette 2; 1 page    */
  67.     ATT400C3   = 3,  /* 320x200 palette 3; 1 page    */
  68.     ATT400MED  = 4,  /* 640x200 1 page            */
  69.     ATT400HI   = 5,  /* 640x400 1 page            */
  70.     VGALO      = 0,  /* 640x200 16 color 4 pages    */
  71.     VGAMED     = 1,  /* 640x350 16 color 2 pages    */
  72.     VGAHI      = 2,  /* 640x480 16 color 1 page     */
  73.     PC3270HI   = 0,  /* 720x350 1 page            */
  74.     IBM8514LO  = 0,  /* 640x480 256 colors        */
  75.     IBM8514HI  = 1   /*1024x768 256 colors        */
  76. };
  77.  
  78. /* Colors for setpalette and setallpalette */
  79.  
  80. #if    !defined(__COLORS)
  81. #define __COLORS
  82.  
  83. enum COLORS {
  84.     BLACK,            /* dark colors */
  85.     BLUE,
  86.     GREEN,
  87.     CYAN,
  88.     RED,
  89.     MAGENTA,
  90.     BROWN,
  91.     LIGHTGRAY,
  92.     DARKGRAY,            /* light colors */
  93.     LIGHTBLUE,
  94.     LIGHTGREEN,
  95.     LIGHTCYAN,
  96.     LIGHTRED,
  97.     LIGHTMAGENTA,
  98.     YELLOW,
  99.     WHITE
  100. };
  101. #endif
  102.  
  103. enum CGA_COLORS {
  104.     CGA_LIGHTGREEN     = 1,        /* Palette C0 Color Names    */
  105.     CGA_LIGHTRED       = 2,
  106.     CGA_YELLOW           = 3,
  107.  
  108.     CGA_LIGHTCYAN      = 1,        /* Palette C1 Color Names    */
  109.     CGA_LIGHTMAGENTA   = 2,
  110.     CGA_WHITE           = 3,
  111.  
  112.     CGA_GREEN           = 1,        /* Palette C2 Color Names    */
  113.     CGA_RED           = 2,
  114.     CGA_BROWN           = 3,
  115.  
  116.     CGA_CYAN           = 1,        /* Palette C3 Color Names    */
  117.     CGA_MAGENTA        = 2,
  118.     CGA_LIGHTGRAY      = 3
  119. };
  120.  
  121.  
  122. enum EGA_COLORS {
  123.     EGA_BLACK         =  0,        /* dark colors */
  124.     EGA_BLUE         =  1,
  125.     EGA_GREEN         =  2,
  126.     EGA_CYAN         =  3,
  127.     EGA_RED         =  4,
  128.     EGA_MAGENTA      =  5,
  129.     EGA_BROWN         =  20,
  130.     EGA_LIGHTGRAY     =  7,
  131.     EGA_DARKGRAY     =  56,     /* light colors */
  132.     EGA_LIGHTBLUE     =  57,
  133.     EGA_LIGHTGREEN     =  58,
  134.     EGA_LIGHTCYAN     =  59,
  135.     EGA_LIGHTRED     =  60,
  136.     EGA_LIGHTMAGENTA     =  61,
  137.     EGA_YELLOW         =  62,
  138.     EGA_WHITE         =  63
  139. };
  140.  
  141. enum line_styles {        /* Line styles for get/setlinestyle */
  142.     SOLID_LINE   = 0,
  143.     DOTTED_LINE  = 1,
  144.     CENTER_LINE  = 2,
  145.     DASHED_LINE  = 3,
  146.     USERBIT_LINE = 4,    /* User defined line style */
  147. };
  148.  
  149. enum line_widths {        /* Line widths for get/setlinestyle */
  150.     NORM_WIDTH  = 1,
  151.     THICK_WIDTH = 3,
  152. };
  153.  
  154. enum font_names {
  155.     DEFAULT_FONT    = 0,    /* 8x8 bit mapped font */
  156.     TRIPLEX_FONT    = 1,    /* "Stroked" fonts */
  157.     SMALL_FONT    = 2,
  158.     SANS_SERIF_FONT = 3,
  159.     GOTHIC_FONT    = 4
  160. };
  161.  
  162. #define HORIZ_DIR    0    /* left to right */
  163. #define VERT_DIR    1    /* bottom to top */
  164.  
  165. #define USER_CHAR_SIZE    0    /* user-defined char size */
  166.  
  167. enum fill_patterns {        /* Fill patterns for get/setfillstyle */
  168.     EMPTY_FILL,        /* fills area in background color */
  169.     SOLID_FILL,        /* fills area in solid fill color */
  170.     LINE_FILL,        /* --- fill */
  171.     LTSLASH_FILL,        /* /// fill */
  172.     SLASH_FILL,        /* /// fill with thick lines */
  173.     BKSLASH_FILL,        /* \\\ fill with thick lines */
  174.     LTBKSLASH_FILL,     /* \\\ fill */
  175.     HATCH_FILL,        /* light hatch fill */
  176.     XHATCH_FILL,        /* heavy cross hatch fill */
  177.     INTERLEAVE_FILL,    /* interleaving line fill */
  178.     WIDE_DOT_FILL,        /* Widely spaced dot fill */
  179.     CLOSE_DOT_FILL,     /* Closely spaced dot fill */
  180.     USER_FILL        /* user defined fill */
  181. };
  182.  
  183. enum putimage_ops {        /* BitBlt operators for putimage */
  184.     COPY_PUT,        /* MOV */
  185.     XOR_PUT,        /* XOR */
  186.     OR_PUT,         /* OR  */
  187.     AND_PUT,        /* AND */
  188.     NOT_PUT         /* NOT */
  189. };
  190.  
  191. enum text_just {        /* Horizontal and vertical justification
  192.                    for settextjustify */
  193.     LEFT_TEXT    = 0,
  194.     CENTER_TEXT    = 1,
  195.     RIGHT_TEXT    = 2,
  196.  
  197.     BOTTOM_TEXT    = 0,
  198.      /* CENTER_TEXT    = 1,  already defined above */
  199.     TOP_TEXT    = 2
  200. };
  201.  
  202.  
  203. #define MAXCOLORS 15
  204.  
  205. struct palettetype {
  206.     unsigned char size;
  207.     signed char colors[MAXCOLORS+1];
  208. };
  209.  
  210. struct linesettingstype {
  211.     int linestyle;
  212.     unsigned upattern;
  213.     int thickness;
  214. };
  215.  
  216. struct textsettingstype {
  217.     int font;
  218.     int direction;
  219.     int charsize;
  220.     int horiz;
  221.     int vert;
  222. };
  223.  
  224. struct fillsettingstype {
  225.     int pattern;
  226.     int color;
  227. };
  228.  
  229. struct pointtype {
  230.     int x, y;
  231. };
  232.  
  233. struct viewporttype {
  234.     int left, top, right, bottom;
  235.     int clip;
  236. };
  237.  
  238. struct arccoordstype {
  239.     int x, y;
  240.     int xstart, ystart, xend, yend;
  241. };
  242.  
  243. #ifdef __cplusplus
  244. extern "C" {
  245. #endif
  246. void       far _Cdecl arc(int __x, int __y, int __stangle, int __endangle,
  247.               int __radius);
  248. void       far _Cdecl bar(int __left, int __top, int __right, int __bottom);
  249. void       far _Cdecl bar3d(int __left, int __top, int __right, int __bottom,
  250.                 int __depth, int __topflag);
  251. void       far _Cdecl circle(int __x, int __y, int __radius);
  252. void       far _Cdecl cleardevice(void);
  253. void       far _Cdecl clearviewport(void);
  254. void       far _Cdecl closegraph(void);
  255. void       far _Cdecl detectgraph(int far *__graphdriver,int far *__graphmode);
  256. void       far _Cdecl drawpoly(int __numpoints, const int far *__polypoints);
  257. void       far _Cdecl ellipse(int __x, int __y, int __stangle, int __endangle,
  258.                   int __xradius, int __yradius);
  259. void       far _Cdecl fillellipse( int __x, int __y, int __xradius, int __yradius );
  260. void       far _Cdecl fillpoly(int __numpoints, const int far *__polypoints);
  261. void       far _Cdecl floodfill(int __x, int __y, int __border);
  262. void       far _Cdecl getarccoords(struct arccoordstype far *__arccoords);
  263. void       far _Cdecl getaspectratio(int far *__xasp, int far *__yasp);
  264. int       far _Cdecl getbkcolor(void);
  265. int       far _Cdecl getcolor(void);
  266. struct palettetype far * far _Cdecl getdefaultpalette( void );
  267. char *       far _Cdecl getdrivername( void );
  268. void       far _Cdecl getfillpattern(char far *__pattern);
  269. void       far _Cdecl getfillsettings(struct fillsettingstype far *__fillinfo);
  270. int       far _Cdecl getgraphmode(void);
  271. void       far _Cdecl getimage(int __left, int __top, int __right, int __bottom,
  272.                    void far *__bitmap);
  273. void       far _Cdecl getlinesettings(struct linesettingstype far *__lineinfo);
  274. int       far _Cdecl getmaxcolor(void);
  275. int       far _Cdecl getmaxmode(void);
  276. int       far _Cdecl getmaxx(void);
  277. int       far _Cdecl getmaxy(void);
  278. char *       far _Cdecl getmodename( int __mode_number );
  279. void       far _Cdecl getmoderange(int __graphdriver, int far *__lomode,
  280.                    int far *__himode);
  281. unsigned   far _Cdecl getpixel(int __x, int __y);
  282. void       far _Cdecl getpalette(struct palettetype far *__palette);
  283. int       far _Cdecl getpalettesize( void );
  284. void       far _Cdecl gettextsettings(struct textsettingstype far *__texttypeinfo);
  285. void       far _Cdecl getviewsettings(struct viewporttype far *__viewport);
  286. int       far _Cdecl getx(void);
  287. int       far _Cdecl gety(void);
  288. void       far _Cdecl graphdefaults(void);
  289. char *       far _Cdecl grapherrormsg(int __errorcode);
  290. void       far _Cdecl _graphfreemem(void far *__ptr, unsigned __size);
  291. void far * far _Cdecl _graphgetmem(unsigned __size);
  292. int       far _Cdecl graphresult(void);
  293. unsigned   far _Cdecl imagesize(int __left, int __top, int __right, int __bottom);
  294. void       far _Cdecl initgraph(int  far *__graphdriver,
  295.                 int  far *__graphmode,
  296.                 const char far *__pathtodriver);
  297. int       far _Cdecl installuserdriver( const char far *__name,
  298.                 int huge (*detect)(void) );
  299. int       far _Cdecl installuserfont( const char far *__name );
  300. void       far _Cdecl line(int __x1, int __y1, int __x2, int __y2);
  301. void       far _Cdecl linerel(int __dx, int __dy);
  302. void       far _Cdecl lineto(int __x, int __y);
  303. void       far _Cdecl moverel(int __dx, int __dy);
  304. void       far _Cdecl moveto(int __x, int __y);
  305. void       far _Cdecl outtext(const char far *__textstring);
  306. void       far _Cdecl outtextxy(int __x, int __y, const char far *__textstring);
  307. void       far _Cdecl pieslice(int __x, int __y, int __stangle, int __endangle,
  308.                    int __radius);
  309. void       far _Cdecl putimage(int __left, int __top, const void far *__bitmap,
  310.                 int __op);
  311. void       far _Cdecl putpixel(int __x, int __y, int __color);
  312. void       far _Cdecl rectangle(int __left, int __top, int __right, int __bottom);
  313. void       far _Cdecl restorecrtmode(void);
  314. void       far _Cdecl sector( int __X, int __Y, int __StAngle, int __EndAngle,
  315.                   int __XRadius, int __YRadius );
  316. void       far _Cdecl setactivepage(int __page);
  317. void       far _Cdecl setallpalette(const struct palettetype far *__palette);
  318. void       far _Cdecl setaspectratio( int __xasp, int __yasp );
  319. void       far _Cdecl setbkcolor(int __color);
  320. void       far _Cdecl setcolor(int __color);
  321. void       far _Cdecl setfillpattern(const char far *__upattern, int __color);
  322. void       far _Cdecl setfillstyle(int __pattern, int __color);
  323. unsigned   far _Cdecl setgraphbufsize(unsigned __bufsize);
  324. void       far _Cdecl setgraphmode(int __mode);
  325. void       far _Cdecl setlinestyle(int __linestyle, unsigned __upattern,
  326.                    int __thickness);
  327. void       far _Cdecl setpalette(int __colornum, int __color);
  328. void       far _Cdecl setrgbpalette(int __colornum,
  329.                     int __red, int __green, int __blue);
  330. void       far _Cdecl settextjustify(int __horiz, int __vert);
  331. void       far _Cdecl settextstyle(int __font, int __direction, int __charsize);
  332. void       far _Cdecl setusercharsize(int __multx, int __divx,
  333.                       int __multy, int __divy);
  334. void       far _Cdecl setviewport(int __left, int __top, int __right, int __bottom,
  335.                   int __clip);
  336. void       far _Cdecl setvisualpage(int __page);
  337. void       far _Cdecl setwritemode( int __mode );
  338. int       far _Cdecl textheight(const char far *__textstring);
  339. int       far _Cdecl textwidth(const char far *__textstring);
  340.  
  341. /***** graphics drivers *****/
  342.  
  343. int           _Cdecl registerbgidriver(void (*driver)(void));
  344. int       far _Cdecl registerfarbgidriver(void far *__driver);
  345.  
  346. /* !!         These "functions" are NOT user-callable          !! */
  347. /* !! They are there just so you can link in graphics drivers !! */
  348.  
  349. void           _Cdecl CGA_driver(void);
  350. void           _Cdecl EGAVGA_driver(void);
  351. void           _Cdecl IBM8514_driver(void);
  352. void           _Cdecl Herc_driver(void);
  353. void           _Cdecl ATT_driver(void);
  354. void           _Cdecl PC3270_driver(void);
  355.  
  356. extern int far _Cdecl CGA_driver_far[];
  357. extern int far _Cdecl EGAVGA_driver_far[];
  358. extern int far _Cdecl IBM8514_driver_far[];
  359. extern int far _Cdecl Herc_driver_far[];
  360. extern int far _Cdecl ATT_driver_far[];
  361. extern int far _Cdecl PC3270_driver_far[];
  362.  
  363.  
  364. /***** graphics fonts *****/
  365.  
  366. int           _Cdecl registerbgifont(void (*font)(void));
  367. int       far _Cdecl registerfarbgifont(void far *__font);
  368.  
  369. /* !!    These "functions" are NOT user-callable,   !! */
  370. /* !! they are there just so you can link in fonts !! */
  371.  
  372. void           _Cdecl    triplex_font(void);
  373. void           _Cdecl      small_font(void);
  374. void           _Cdecl sansserif_font(void);
  375. void           _Cdecl     gothic_font(void);
  376.  
  377. extern int far _Cdecl    triplex_font_far[];
  378. extern int far _Cdecl      small_font_far[];
  379. extern int far _Cdecl sansserif_font_far[];
  380. extern int far _Cdecl     gothic_font_far[];
  381.  
  382. #ifdef __cplusplus
  383. }
  384. #endif
  385.  
  386.  
  387. #endif
  388.