home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / TURBOC_1.LZH / INCLUDE / GRAPHICS.H < prev    next >
C/C++ Source or Header  |  1990-03-02  |  12KB  |  427 lines

  1. /*  graphics.h
  2.  
  3.     Definitions for Graphics Package.
  4.  
  5.     Copyright (c) Borland International 1989
  6.     All Rights Reserved.
  7. */
  8.  
  9. #if     !defined(__GRAPHX_DEF_)
  10. #define __GRAPHX_DEF_
  11.  
  12. #define registerbgidriver     regbgidvr
  13. #define registerfarbgidriver  regbgidvr
  14. #define registerbgifont       regbgifnt
  15. #define registerfarbgifont    regbgifnt
  16. #define getpalette            getpalet
  17. #define getpalettesize        getpalsi
  18. #define installuserdriver     installd
  19. #define installuserfont       installf
  20. #define setgraphbufsize       setgrbuf
  21. #define setgraphmode          setgrmod
  22.  
  23.  
  24. /* graphic result error return codes */
  25.  
  26. enum graphics_errors
  27. {
  28.     grOk               =   0,
  29.     grNoInitGraph      =  -1,
  30.     grNotDetected      =  -2,
  31.     grFileNotFound     =  -3,
  32.     grInvalidDriver    =  -4,
  33.     grNoLoadMem        =  -5,
  34.     grNoScanMem        =  -6,
  35.     grNoFloodMem       =  -7,
  36.     grFontNotFound     =  -8,
  37.     grNoFontMem        =  -9,
  38.     grInvalidMode      = -10,
  39.     grError            = -11,
  40.     grIOerror          = -12,
  41.     grInvalidFont      = -13,
  42.     grInvalidFontNum   = -14,
  43.     grInvalidVersion   = -18
  44. };
  45.  
  46.  
  47. /* define graphics drivers */
  48.  
  49. enum graphics_drivers
  50. {
  51.  
  52.     /* drivers supported by the Atari ROM system */
  53.  
  54.     DETECT,                     /* requests autodetection   */
  55.     STGEM,                      /* atari rom default driver */
  56.     CURRENT_DRIVER = -1,
  57.  
  58.  
  59.     /* These drivers are there for compatibility reasons only. */
  60.     /* If one of these drivers is specified on an atari sytem  */
  61.     /* autodetection is executed and the graphic result error  */
  62.     /* is set to grInvalidDriver.                              */
  63.  
  64.     CGA,
  65.     MCGA,
  66.     EGA,
  67.     EGA64,
  68.     EGAMONO,
  69.     IBM8514,
  70.     HERCMONO,
  71.     ATT400,
  72.     VGA,
  73.     PC3270
  74.  
  75. };
  76.  
  77.  
  78. /* graphics modes for each driver */
  79.  
  80. enum graphics_modes
  81. {
  82.     /* graphic modes supported by the various Atari systems */
  83.  
  84.     STLOW      = 0,  /* atari st 320x200 16 standard colors out of 512 */
  85.     STMEDIUM   = 1,  /* atari st 640x200 4 standard colors out of 512  */
  86.     STHIGH     = 2,  /* atari st 640x400 b/w                           */
  87.  
  88.  
  89.     /* These modes are there for compatibility reasons only */
  90.  
  91.     CGAC0      = 0,  /* 320x200 palette 0; 1 page   */
  92.     CGAC1      = 1,  /* 320x200 palette 1; 1 page   */
  93.     CGAC2      = 2,  /* 320x200 palette 2: 1 page   */
  94.     CGAC3      = 3,  /* 320x200 palette 3; 1 page   */
  95.     CGAHI      = 4,  /* 640x200 1 page              */
  96.     MCGAC0     = 0,  /* 320x200 palette 0; 1 page   */
  97.     MCGAC1     = 1,  /* 320x200 palette 1; 1 page   */
  98.     MCGAC2     = 2,  /* 320x200 palette 2; 1 page   */
  99.     MCGAC3     = 3,  /* 320x200 palette 3; 1 page   */
  100.     MCGAMED    = 4,  /* 640x200 1 page              */
  101.     MCGAHI     = 5,  /* 640x480 1 page              */
  102.     EGALO      = 0,  /* 640x200 16 color 4 pages    */
  103.     EGAHI      = 1,  /* 640x350 16 color 2 pages    */
  104.     EGA64LO    = 0,  /* 640x200 16 color 1 page     */
  105.     EGA64HI    = 1,  /* 640x350 4 color  1 page     */
  106.     EGAMONOHI  = 0,  /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
  107.     HERCMONOHI = 0,  /* 720x348 2 pages             */
  108.     ATT400C0   = 0,  /* 320x200 palette 0; 1 page   */
  109.     ATT400C1   = 1,  /* 320x200 palette 1; 1 page   */
  110.     ATT400C2   = 2,  /* 320x200 palette 2; 1 page   */
  111.     ATT400C3   = 3,  /* 320x200 palette 3; 1 page   */
  112.     ATT400MED  = 4,  /* 640x200 1 page              */
  113.     ATT400HI   = 5,  /* 640x400 1 page              */
  114.     VGALO      = 0,  /* 640x200 16 color 4 pages    */
  115.     VGAMED     = 1,  /* 640x350 16 color 2 pages    */
  116.     VGAHI      = 2,  /* 640x480 16 color 1 page     */
  117.     PC3270HI   = 0,  /* 720x350 1 page              */
  118.     IBM8514LO  = 0,  /* 640x480 256 colors          */
  119.     IBM8514HI  = 1  /* 1024x768 256 colors          */
  120.  
  121. };
  122.  
  123.  
  124. #if !defined(__COLORS)
  125. #define __COLORS
  126.  
  127. enum COLORS
  128. {
  129.  
  130.     BLACK,
  131.     BLUE,
  132.     GREEN,
  133.     CYAN,
  134.     RED,
  135.     MAGENTA,
  136.     BROWN,
  137.     LIGHTGRAY,
  138.     DARKGRAY,
  139.     LIGHTBLUE,
  140.     LIGHTGREEN,
  141.     LIGHTCYAN,
  142.     LIGHTRED,
  143.     LIGHTMAGENTA,
  144.     YELLOW,
  145.     WHITE
  146.  
  147. };
  148. #endif
  149.  
  150. enum CGA_COLORS
  151. {
  152.  
  153.     CGA_GREEN          = 2,
  154.     CGA_CYAN           = 3,
  155.     CGA_RED            = 4,
  156.     CGA_MAGENTA        = 5,
  157.     CGA_BROWN          = 6,
  158.     CGA_LIGHTGRAY      = 7,
  159.     CGA_LIGHTGREEN     = 10,
  160.     CGA_LIGHTCYAN      = 11,
  161.     CGA_LIGHTRED       = 12,
  162.     CGA_LIGHTMAGENTA   = 13,
  163.     CGA_YELLOW         = 14,
  164.     CGA_WHITE          = 15
  165.  
  166. };
  167.  
  168.  
  169. enum EGA_COLORS
  170. {
  171.     EGA_BLACK        =  0,
  172.     EGA_BLUE         =  1,
  173.     EGA_GREEN        =  2,
  174.     EGA_CYAN         =  3,
  175.     EGA_RED          =  4,
  176.     EGA_MAGENTA      =  5,
  177.     EGA_BROWN        =  6,
  178.     EGA_LIGHTGRAY    =  7,
  179.     EGA_DARKGRAY     =  8,
  180.     EGA_LIGHTBLUE    =  9,
  181.     EGA_LIGHTGREEN   =  10,
  182.     EGA_LIGHTCYAN    =  11,
  183.     EGA_LIGHTRED     =  12,
  184.     EGA_LIGHTMAGENTA =  13,
  185.     EGA_YELLOW       =  14,
  186.     EGA_WHITE        =  15
  187.  
  188. };
  189.  
  190.  
  191.  
  192. /* Line styles for get/setlinestyle */
  193.  
  194. enum line_styles
  195. {
  196.     SOLID_LINE   = 0,
  197.     DOTTED_LINE  = 1,
  198.     CENTER_LINE  = 2,
  199.     DASHED_LINE  = 3,
  200.     USERBIT_LINE = 4    /* User defined line style */
  201. };
  202.  
  203.  
  204. /* Line widths for get/setlinestyle */
  205.  
  206. enum line_widths
  207. {
  208.     NORM_WIDTH  = 1,
  209.     THICK_WIDTH = 3
  210. };
  211.  
  212.  
  213. enum font_names {
  214.     DEFAULT_FONT    = 0,
  215.     TRIPLEX_FONT    = 1,
  216.     SMALL_FONT      = 2,
  217.     SANS_SERIF_FONT = 3,
  218.     GOTHIC_FONT     = 4
  219. };
  220.  
  221. #define HORIZ_DIR   0       /* left to right */
  222. #define VERT_DIR    1       /* bottom to top */
  223.  
  224. #define USER_CHAR_SIZE  0   /* user-defined char size */
  225.  
  226.  
  227. /* Fill patterns for get/setfillstyle */
  228.  
  229. enum fill_patterns 
  230. {
  231.     EMPTY_FILL,         /* fills area in background color */
  232.     SOLID_FILL,         /* fills area in solid fill color */
  233.     LINE_FILL,          /* --- fill */
  234.     LTSLASH_FILL,       /* /// fill */
  235.     SLASH_FILL,         /* /// fill with thick lines */
  236.     BKSLASH_FILL,       /* \\\ fill with thick lines */
  237.     LTBKSLASH_FILL,     /* \\\ fill */
  238.     HATCH_FILL,         /* light hatch fill */
  239.     XHATCH_FILL,        /* heavy cross hatch fill */
  240.     INTERLEAVE_FILL,    /* interleaving line fill */
  241.     WIDE_DOT_FILL,      /* Widely spaced dot fill */
  242.     CLOSE_DOT_FILL,     /* Closely spaced dot fill */
  243.     USER_FILL           /* user defined fill */
  244. };
  245.  
  246.  
  247. /* Bit operation modes */
  248.  
  249. enum putimage_ops 
  250. {
  251.     COPY_PUT,
  252.     XOR_PUT,
  253.     OR_PUT,
  254.     AND_PUT,
  255.     NOT_PUT
  256. };
  257.  
  258.  
  259. /* Horizontal and vertical justification for settextjustify */
  260.  
  261. enum text_just
  262. {
  263.     LEFT_TEXT   = 0,
  264.     CENTER_TEXT = 1,
  265.     RIGHT_TEXT  = 2,
  266.  
  267.     BOTTOM_TEXT = 0,
  268.  /* CENTER_TEXT = 1,  already defined above */
  269.     TOP_TEXT    = 2
  270. };
  271.  
  272.  
  273. #define MAXCOLORS 15
  274.  
  275. struct palettetype
  276. {
  277.     unsigned char size;
  278.     signed char colors[MAXCOLORS+1];
  279. };
  280.  
  281. struct linesettingstype
  282. {
  283.     int linestyle;
  284.     unsigned upattern;
  285.     int thickness;
  286. };
  287.  
  288. struct textsettingstype
  289. {
  290.     int font;
  291.     int direction;
  292.     int charsize;
  293.     int horiz;
  294.     int vert;
  295. };
  296.  
  297. struct fillsettingstype
  298. {
  299.     int pattern;
  300.     int color;
  301. };
  302.  
  303. struct pointtype
  304. {
  305.     int x, y;
  306. };
  307.  
  308. struct viewporttype
  309. {
  310.     int left, top, right, bottom;
  311.     int clip;
  312. };
  313.  
  314. struct arccoordstype
  315. {
  316.     int x, y;
  317.     int xstart, ystart, xend, yend;
  318. };
  319.  
  320. void  arc( int x, int y, int stangle, int endangle,
  321.            int radius );
  322. void  bar( int left, int top, int right, int bottom );
  323. void  bar3d( int left, int top, int right, int bottom,
  324.              int depth, int topflag );
  325. void  circle( int x, int y, int radius );
  326. void  cleardevice( void );
  327. void  clearviewport( void );
  328. void  closegraph( void );
  329. void  detectgraph( int *graphdriver,int *graphmode );
  330. void  drawpoly( int numpoints, int *polypoints );
  331. void  ellipse( int x, int y, int stangle, int endangle,
  332.                int xradius, int yradius );
  333. void  fillellipse(  int x, int y, int xradius, int yradius  );
  334. void  fillpoly( int numpoints, int *polypoints );
  335. void  floodfill( int x, int y, int border );
  336. void  getarccoords( struct arccoordstype *arccoords );
  337. void  getaspectratio( int *xasp, int *yasp );
  338. int   getbkcolor( void );
  339. int   getcolor( void );
  340. char  *getdrivername(  void  );
  341. void  *getdefaultpalette( void );
  342. void  getfillpattern( char *pattern );
  343. void  getfillsettings( struct fillsettingstype *fillinfo );
  344. int   getgraphmode( void );
  345. void  getimage( int left, int top, int right, int bottom,
  346.                 void *bitmap );
  347. void  getlinesettings( struct linesettingstype *lineinfo );
  348. int   getmaxcolor( void );
  349. int   getmaxmode( void );
  350. int   getmaxx( void );
  351. int   getmaxy( void );
  352. char  *getmodename(  int mode_number  );
  353. void  getmoderange( int graphdriver, int *lomode,
  354.                     int *himode );
  355. unsigned int  getpixel( int x, int y );
  356. void  getpalette( struct palettetype *palette );
  357. int   getpalettesize(  void  );
  358. void  gettextsettings( struct textsettingstype *texttypeinfo );
  359. void  getviewsettings( struct viewporttype *viewport );
  360. int   getx( void );
  361. int   gety( void );
  362. void  graphdefaults( void );
  363. char  *grapherrormsg( int errorcode );
  364. void  _graphfreemem( void *ptr, unsigned size );
  365. void  *_graphgetmem( unsigned size );
  366. int   graphresult( void );
  367. unsigned int  imagesize( int left, int top, int right, int bottom );
  368. void  initgraph( int  *graphdriver,
  369.                  int  *graphmode,
  370.                 char *pathtodriver );
  371. int    installuserdriver(  char *name, int ( *detect )( void )  );
  372. int    installuserfont(  char *name  );
  373. void   line( int x1, int y1, int x2, int y2 );
  374. void   linerel( int dx, int dy );
  375. void   lineto( int x, int y );
  376. void   moverel( int dx, int dy );
  377. void   moveto( int x, int y );
  378. void   outtext( char *textstring );
  379. void   outtextxy( int x, int y, char *textstring );
  380. void   pieslice( int x, int y, int stangle, int endangle,
  381.                  int radius );
  382. void   putimage( int left, int top, void *bitmap, int op );
  383. void   putpixel( int x, int y, int color );
  384. void   rectangle( int left, int top, int right, int bottom );
  385. void   restorecrtmode( void );
  386. void   sector(  int X, int Y, int StAngle, int EndAngle,
  387.                 int XRadius, int YRadius  );
  388. void   setactivepage( int page );
  389. void   setallpalette( struct palettetype *palette );
  390. void   setaspectratio(  int xasp, int yasp  );
  391. void   setbkcolor( int color );
  392. void   setcolor( int color );
  393. void   setfillpattern( char *upattern, int color );
  394. void   setfillstyle( int pattern, int color );
  395. unsigned int setgraphbufsize( unsigned bufsize );
  396. void   setgraphmode( int mode );
  397. void   setlinestyle( int linestyle, unsigned upattern,
  398.                      int thickness );
  399. void   setpalette( int index, int color );
  400. void   setrgbpalette( int colornum,
  401.                       int red, int green, int blue );
  402. void   settextjustify( int horiz, int vert );
  403. void   settextstyle( int font, int direction, int charsize );
  404. void   setusercharsize( int multx, int divx,
  405.                         int multy, int divy );
  406. void   setviewport( int left, int top, int right, int bottom,
  407.                     int clip );
  408. void   setvisualpage( int page );
  409. void   setwritemode(  int mode  );
  410. int    textheight( char *textstring );
  411. int    textwidth( char *textstring );
  412. int     registerbgidriver( void ( *driver )( void ) );
  413. int     registerbgifont( void ( *font )( void ) );
  414.  
  415.  
  416. /* graphics fonts */
  417.  
  418. /* !!   These "functions" are NOT user-callable,   !! */
  419. /* !! they are there just so you can link in fonts !! */
  420.  
  421. void   triplex_font( void );
  422. void     small_font( void );
  423. void sansserif_font( void );
  424. void    gothic_font( void );
  425.  
  426. #endif
  427.