home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / INCLUDE.ZIP / GRAPHICS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  13.7 KB  |  395 lines

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