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

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