home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / GRAPHICS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  14.4 KB  |  403 lines

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