1 /** 2 ** BCC2GRX - Interfacing Borland based graphics programs to LIBGRX 3 ** Copyright (C) 1993-97 by Hartmut Schirmer 4 ** 5 ** Contact : Hartmut Schirmer 6 ** Feldstrasse 118 7 ** D-24105 Kiel 8 ** Germany 9 ** 10 ** e-mail : hsc@techfak.uni-kiel.de 11 ** 12 ** This file is part of the GRX graphics library. 13 ** 14 ** The GRX graphics library is free software; you can redistribute it 15 ** and/or modify it under some conditions; see the "copying.grx" file 16 ** for details. 17 ** 18 ** This library is distributed in the hope that it will be useful, 19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 21 ** 22 **/ 23 24 #ifndef __LIBBCC_H 25 #define __LIBBCC_H 26 27 /* Version number, read as 28 0x20a v2.0 alpha 29 0x21b v2.1 beta 30 0x230 v2.3 offical release */ 31 #define __BCC2GRX__ 0x22b 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #ifndef TRUE 38 # define TRUE (1==1) 39 #endif 40 #ifndef FALSE 41 # define FALSE (1==0) 42 #endif 43 44 #ifndef near /* get rid of these stupid keywords */ 45 #define near 46 #endif 47 #ifndef far 48 #define far 49 #endif 50 #ifndef huge 51 #define huge 52 #endif 53 54 #define grOk 0 55 #define grNoInitGraph -1 56 #define grNotDetected -2 57 #define grFileNotFound -3 58 #define grInvalidDriver -4 59 #define grNoLoadMem -5 60 #define grNoScanMem -6 61 #define grNoFloodMem -7 62 #define grFontNotFound -8 63 #define grNoFontMem -9 64 #define grInvalidMode -10 65 #define grError -11 66 #define grIOerror -12 67 #define grInvalidFont -13 68 #define grInvalidFontNum -14 69 #define grInvalidVersion -18 70 71 #define DETECT (-2) 72 #define DETECT_PAS (0) 73 #define NATIVE_GRX (-3) 74 #define CURRENT_DRIVER (-1) 75 #define VGA ( 9) 76 #define EGA ( 3) 77 #define IBM8514 ( 6) 78 #define HERCMONO ( 7) 79 #define EGA64 ( 4) 80 #define EGAMONO ( 5) 81 #define CGA ( 1) 82 #define MCGA ( 2) 83 #define ATT400 ( 8) 84 #define PC3270 (10) 85 /* driver definitions from BC++ 4.5 : */ 86 #define DETECTX (DETECT) 87 #define VGA256 (11) 88 #define ATTDEB (12) 89 #define TOSHIBA (13) 90 #define SVGA16 (14) 91 #define SVGA256 (15) 92 #define SVGA32K (16) 93 #define SVGA64K (17) 94 #define VESA16 (18) 95 #define VESA256 (19) 96 #define VESA32K (20) 97 #define VESA64K (21) 98 #define VESA16M (22) 99 #define ATI16 (23) 100 #define ATI256 (24) 101 #define ATI32K (25) 102 #define COMPAQ (26) 103 #define TSENG316 (27) 104 #define TSENG3256 (28) 105 #define TSENG416 (29) 106 #define TSENG4256 (30) 107 #define TSENG432K (31) 108 #define GENOA5 (32) 109 #define GENOA6 (33) 110 #define OAK (34) 111 #define PARADIS16 (35) 112 #define PARADIS256 (36) 113 #define TECMAR (37) 114 #define TRIDENT16 (38) 115 #define TRIDENT256 (39) 116 #define VIDEO7 (40) 117 #define VIDEO7II (41) 118 #define S3 (42) 119 #define ATIGUP (43) 120 121 #define VGALO 0 122 #define VGAMED 1 123 #define VGAHI 2 124 #define IBM8514LO 0 125 #define IBM8514HI 1 126 #define HERCMONOHI 0 127 #define CGAC0 0 128 #define CGAC1 1 129 #define CGAC2 2 130 #define CGAC3 3 131 #define CGAHI 4 132 #define MCGAC0 CGAC0 133 #define MCGAC1 CGAC1 134 #define MCGAC2 CGAC2 135 #define MCGAC3 CGAC3 136 #define MCGAMED CGAHI 137 #define MCGAHI 5 138 #define ATT400C0 MCGAC0 139 #define ATT400C1 MCGAC1 140 #define ATT400C2 MCGAC2 141 #define ATT400C3 MCGAC3 142 #define ATT400MED MCGAMED 143 #define ATT400HI MCGAHI 144 #define EGA64LO 0 145 #define EGA64HI 1 146 #define EGALO 0 147 #define EGAHI 1 148 #define EGAMONOHI 0 149 #define EGAMONOHI_PAS 3 150 #define PC3270HI 0 151 /* mode definitions from BC++ 4.5 : */ 152 #define RES640x350 0 153 #define RES640x480 1 154 #define RES800x600 2 155 #define RES1024x768 3 156 #define RES1280x1024 4 157 158 /* NATIVE_GRX modes : */ 159 #define GRX_DEFAULT_GRAPHICS 0 160 #define GRX_BIGGEST_NONINTERLACED_GRAPHICS 1 161 #define GRX_BIGGEST_GRAPHICS 2 162 #define GRX_BGI_EMULATION 3 163 #define __FIRST_DRIVER_SPECIFIC_MODE 4 164 165 166 #ifndef BLACK 167 # define BLACK 0 168 #endif 169 #ifndef BLUE 170 # define BLUE 1 171 #endif 172 #ifndef GREEN 173 # define GREEN 2 174 #endif 175 #ifndef CYAN 176 # define CYAN 3 177 #endif 178 #ifndef RED 179 # define RED 4 180 #endif 181 #ifndef MAGENTA 182 # define MAGENTA 5 183 #endif 184 #ifndef BROWN 185 # define BROWN 6 186 #endif 187 #ifndef LIGHTGRAY 188 # define LIGHTGRAY 7 189 #endif 190 #ifndef DARKGRAY 191 # define DARKGRAY 8 192 #endif 193 #ifndef LIGHTBLUE 194 # define LIGHTBLUE 9 195 #endif 196 #ifndef LIGHTGREEN 197 # define LIGHTGREEN 10 198 #endif 199 #ifndef LIGHTCYAN 200 # define LIGHTCYAN 11 201 #endif 202 #ifndef LIGHTRED 203 # define LIGHTRED 12 204 #endif 205 #ifndef LIGHTMAGENTA 206 # define LIGHTMAGENTA 13 207 #endif 208 #ifndef YELLOW 209 # define YELLOW 14 210 #endif 211 #ifndef WHITE 212 # define WHITE (__gr_White()) 213 #endif 214 215 #define EGA_BLACK 0 216 #define EGA_BLUE 1 217 #define EGA_GREEN 2 218 #define EGA_RED 4 219 #define EGA_LIGHTBLUE 57 220 #define EGA_LIGHTGREEN 58 221 #define EGA_LIGHTRED 60 222 #define EGA_CYAN 3 223 #define EGA_LIGHTCYAN 59 224 #define EGA_MAGENTA 5 225 #define EGA_LIGHTMAGENTA 61 226 #define EGA_BROWN 20 227 #define EGA_LIGHTGRAY 7 228 #define EGA_DARKGRAY 56 229 #define EGA_YELLOW 62 230 #define EGA_WHITE 63 231 232 #define SOLID_LINE 0 233 #define DOTTED_LINE 1 234 #define CENTER_LINE 2 235 #define DASHED_LINE 3 236 #define USERBIT_LINE 4 237 238 #define NORM_WIDTH 1 239 #define THICK_WIDTH 3 240 241 #define DEFAULT_FONT 0 /* 8x8 bit mapped font */ 242 #define TRIPLEX_FONT 1 243 #define SMALL_FONT 2 244 #define SANS_SERIF_FONT 3 245 #define GOTHIC_FONT 4 246 #define SCRIPT_FONT 5 247 #define SIMPLEX_FONT 6 248 #define TRIPLEX_SCR_FONT 7 249 #define COMPLEX_FONT 8 250 #define EUROPEAN_FONT 9 251 #define BOLD_FONT 10 252 253 #define HORIZ_DIR 0 /* left to right */ 254 #define VERT_DIR 1 /* bottom to top */ 255 256 #define USER_CHAR_SIZE 0 /* user-defined char size */ 257 258 enum fill_patterns { /* Fill patterns for get/setfillstyle */ 259 EMPTY_FILL, /* fills area in background color */ 260 SOLID_FILL, /* fills area in solid fill color */ 261 LINE_FILL, /* --- fill */ 262 LTSLASH_FILL, /* /// fill */ 263 SLASH_FILL, /* /// fill with thick lines */ 264 BKSLASH_FILL, /* \\\ fill with thick lines */ 265 LTBKSLASH_FILL, /* \\\ fill */ 266 HATCH_FILL, /* light hatch fill */ 267 XHATCH_FILL, /* heavy cross hatch fill */ 268 INTERLEAVE_FILL, /* interleaving line fill */ 269 WIDE_DOT_FILL, /* Widely spaced dot fill */ 270 CLOSE_DOT_FILL, /* Closely spaced dot fill */ 271 USER_FILL /* user defined fill */ 272 }; 273 274 #define COPY_PUT 0 275 #define XOR_PUT 1 276 #define OR_PUT 2 277 #define AND_PUT 3 278 #define NOT_PUT 4 279 280 #define LEFT_TEXT 0 281 #define CENTER_TEXT 1 282 #define RIGHT_TEXT 2 283 #define BOTTOM_TEXT 0 284 #define TOP_TEXT 2 285 286 #define MAXCOLORS 15 287 288 struct palettetype { 289 unsigned char size; 290 signed char colors[MAXCOLORS+1]; 291 }; 292 293 struct linesettingstype { 294 int linestyle; 295 unsigned short upattern; /* Note : BCC defines unsigned ! */ 296 int thickness; 297 }; 298 299 struct textsettingstype { 300 int font; 301 int direction; 302 int charsize; 303 int horiz; 304 int vert; 305 }; 306 307 struct fillsettingstype { 308 int pattern; 309 int color; 310 }; 311 312 /* This definition is compatible with the grx 313 definition 'int pts[][2]' used to define polygons */ 314 struct pointtype { 315 int x, y; 316 }; 317 318 struct viewporttype { 319 int left, top, right, bottom; 320 int clip; 321 }; 322 323 struct arccoordstype { 324 int x, y; 325 int xstart, ystart, xend, yend; 326 }; 327 328 /* ------------------------------------------------------------------ */ 329 /* --- Internal definitions --- */ 330 /* --- Don't access one of these variable and functions directly! --- */ 331 332 extern int __gr_Mode; 333 extern int __gr_INIT; 334 extern int __gr_MaxMode; 335 extern int __gr_Result; 336 extern int __gr_X, __gr_Y; /* graphics cursor pos */ 337 extern int __gr_vpl, __gr_vpt, /* actual viewport */ 338 __gr_vpr, __gr_vpb; 339 extern int __gr_color; /* drawing color */ 340 extern int __gr_colorbg; /* background color */ 341 extern int __gr_colorfill; /* fill color */ 342 #if defined(__TURBOC__) && defined(__MSDOS__) 343 extern unsigned long __gr_WR; /* Write mode, type */ 344 #else 345 extern unsigned int __gr_WR; /* must match GrColor */ 346 #endif 347 extern int __gr_Xasp; /* Aspect ratio */ 348 extern int __gr_Yasp; 349 extern int __gr_fpatno; 350 extern int __gr_lstyle; 351 extern int __gr_clip; /* actual clipping state */ 352 extern int __gr_ADAPTER; /* Adapter used */ 353 extern unsigned char __gr_fpatterns[][8]; 354 extern struct palettetype __gr_EGAdef; 355 extern int __gr_BGI_w; /* Width, height and color */ 356 extern int __gr_BGI_h; /* used in */ 357 extern int __gr_BGI_c; /* GRX_BGI_EMULATION mode */ 358 extern int __gr_TextLineStyle; /* use setlinestyle() while 359 plotting .chr fonts */ 360 361 void __gr_set_up_modes(void); 362 int __gr_White(void); 363 364 /* ------------------------------------------------------------------ */ 365 /* --- BGI - API definitions --- */ 366 367 void detectgraph(int *graphdriver,int *graphmode); 368 void initgraph(int *graphdriver, int *graphmode, char *pathtodriver); 369 void closegraph(void); 370 void setgraphmode(int mode); 371 char *getmodename( int mode_number ); 372 void graphdefaults(void); 373 char *getdrivername( void ); 374 char *grapherrormsg(int errorcode); 375 int getmaxx(void); 376 int getmaxy(void); 377 int getmaxcolor(void); 378 void getviewsettings(struct viewporttype *viewport); 379 void setviewport(int left, int top, int right, int bottom, int clip); 380 void getlinesettings(struct linesettingstype *lineinfo); 381 void setlinestyle(int linestyle, unsigned upattern, int thickness); 382 void clearviewport(void); 383 unsigned getpixel(int x, int y); 384 void putpixel(int x, int y, int color); 385 void bar3d(int left,int top,int right,int bottom,int depth, int topflag); 386 void rectangle(int left, int top, int right, int bottom); 387 void fillpoly(int numpoints, void *polypoints); 388 void fillellipse( int x, int y, int xradius, int yradius ); 389 void getarccoords(struct arccoordstype *arccoords); 390 void floodfill(int x, int y, int border); 391 void setfillpattern( char *upattern, int color); 392 void setfillstyle(int pattern, int color); 393 void getimage(int left, int top, int right, int bottom, void *bitmap); 394 void putimage(int left, int top, void *bitmap, int op); 395 unsigned imagesize(int left, int top, int right, int bottom); 396 void gettextsettings(struct textsettingstype *texttypeinfo); 397 void settextjustify(int horiz, int vert); 398 void settextstyle(int font, int direction, int charsize); 399 void setrgbpalette(int color, int red, int green, int blue); 400 void setusercharsize(int multx, int divx, int multy, int divy); 401 void setwritemode( int mode ); 402 void outtext(const char *textstring); 403 void outtextxy(int x, int y, const char *textstring); 404 int textheight(const char *textstring); 405 int textwidth(const char *textstring); 406 407 int registerbgifont(void *font); 408 int installuserfont(const char *name); 409 410 int getpalettesize(void); 411 void getpalette(struct palettetype *palette); 412 void setallpalette( const struct palettetype *palette); 413 414 415 416 /* ------------------------------------------------------------------ */ 417 /* --- BGI - API extensions --- */ 418 419 extern int _bold_font, _euro_font, /* Linkable font files */ 420 _goth_font, _lcom_font, 421 _litt_font, _sans_font, 422 _scri_font, _simp_font, 423 _trip_font, _tscr_font; 424 void set_BGI_mode(int *graphdriver, int *graphmode); 425 /*void set_BGI_mode_whc() declared inline */ 426 void __getrgbpalette(int color, int *red, int *green, int *blue); 427 428 429 void __gr_set_libbcc_init_hooks ( 430 int (*init) (void) , 431 int (*close) (void) ); 432 433 434 int set_BGI_print_mode ( int mode , char * dest ); 435 436 extern unsigned char _dac_g256[][3]; /* 256 shading dac values */ 437 extern unsigned char _dac_normal[][3]; /* 256 standard colors */ 438 439 extern void setrgbdefaults(void); 440 extern void setrgbgray256(void); 441 int _ega_color(int egacol); 442 443 444 /* ------------------------------------------------------------------ */ 445 /* --- direct linkable API functions --- */ 446 /* --- ( mainly for GNU Pascal Graph unit usage ) --- */ 447 448 void __gr_restorecrtmode(void); 449 void __gr_closegraph(void); 450 int __gr_getgraphmode(void); 451 int __gr_getmaxmode(void); 452 void __gr_getmoderange(int gd, int *lomode, int *himode); 453 int __gr_graphresult(void); 454 int __gr_getx(void); 455 int __gr_gety(void); 456 void __gr_moveto(int x, int y); 457 void __gr_moverel(int dx, int dy); 458 int __gr_getbkcolor(void); 459 int __gr_getcolor(void); 460 void __gr_cleardevice(void); 461 void __gr_setbkcolor(int color); 462 void __gr_setcolor(int color); 463 void __gr_line(int x1, int y1, int x2, int y2); 464 void __gr_linerel(int dx, int dy); 465 void __gr_lineto(int x, int y); 466 void __gr_drawpol(int numpoints, void *polypoints, int close); 467 void __gr_drawpoly(int numpoints, void *polypoints); 468 void __gr_bar(int left, int top, int right, int bottom); 469 void __gr_circle(int x, int y, int radius); 470 void __gr_ellipse(int x,int y,int stangle,int endangle,int xradius,int yradius); 471 void __gr_arc(int x, int y, int stangle, int endangle, int radius); 472 void __gr_getaspectratio(int *xasp, int *yasp); 473 void __gr_setaspectratio( int xasp, int yasp ); 474 void __gr_getfillsettings(struct fillsettingstype *fillinfo); 475 void __gr_getfillpattern(char *pattern); 476 void __gr_sector(int x,int y,int stangle,int endangle,int xradius,int yradius); 477 void __gr_pieslice(int x, int y, int stangle, int endangle, int radius); 478 unsigned __gr_setgraphbufsize(unsigned bufsize); 479 struct palettetype *__gr_getdefaultpalette(void); 480 int __gr_installbgidriver(char *name, void *detect); 481 int __gr_registerfarbgidriver(void *driver); 482 int __gr_registerfarbgifont(void *font); 483 void __gr_textlinestyle(int on); 484 void __gr_setpalette(int colornum, int color); 485 int __gr_getvisualpage(void); 486 void __gr_setvisualpage(int p); 487 int __gr_getactivepage(void); 488 void __gr_setactivepage(int p); 489 int __gr_setrgbcolor(int r, int g, int b); 490 int __gr_getmodemaxy(int mode); 491 int __gr_getmodemaxx(int mode); 492 int __gr_getmodemaxcolor(int mode); 493 void __gr_set_BGI_mode_whc(int *gd, int *gm, int width, int height, int colors); 494 int __gr_get_BGI_mode_pages(void); 495 void __gr_set_BGI_mode_pages(int p); 496 497 #ifdef __cplusplus 498 } 499 #endif 500 501 /* ----------------------------------------------------------------- */ 502 /* --- API functions with macro equivalents --- */ 503 /* --- (for inlining) --- */ 504 /* ----------------------------------------------------------------- */ 505 void restorecrtmode(void); 506 int getgraphmode(void); 507 int getmaxmode(void); 508 void getmoderange(int gd, int *lomode, int *himode); 509 int graphresult(void); 510 int getx(void); 511 int gety(void); 512 void moveto(int x, int y); 513 void moverel(int dx, int dy); 514 int getbkcolor(void); 515 int getcolor(void); 516 void cleardevice(void); 517 void setbkcolor(int color); 518 void setcolor(int color); 519 void line(int x1, int y1, int x2, int y2); 520 void linerel(int dx, int dy); 521 void lineto(int x, int y); 522 void drawpoly(int numpoints, void *polypoints); 523 void bar(int left, int top, int right, int bottom); 524 void circle(int x, int y, int radius); 525 void ellipse( int x, int y, int stangle, int endangle, 526 int xradius, int yradius ); 527 void arc(int x, int y, int stangle, int endangle, int radius); 528 void getaspectratio(int *xasp, int *yasp); 529 void setaspectratio( int xasp, int yasp ); 530 void getfillsettings(struct fillsettingstype *fillinfo); 531 void getfillpattern(char *pattern); 532 void sector( int x, int y, int stangle, int endangle, 533 int xradius, int yradius ); 534 void pieslice(int x, int y, int stangle, int endangle, int radius); 535 unsigned setgraphbufsize(unsigned bufsize); 536 struct palettetype *getdefaultpalette(void); 537 int installbgidriver(char *name, void *detect); 538 int registerfarbgidriver(void *driver); 539 int registerfarbgifont(void *font); 540 void textlinestyle(int on); 541 void setpalette(int colornum, int color); 542 void set_BGI_mode_pages(int p); 543 int get_BGI_mode_pages(void); 544 void set_BGI_mode_whc(int *gd, int *gm, int width, int height, int colors); 545 int getmodemaxcolor(int mode); 546 int getmodemaxx(int mode); 547 int getmodemaxy(int mode); 548 int setrgbcolor(int r, int g, int b); 549 void setactivepage(int p); 550 int getactivepage(void); 551 void setvisualpage(int p); 552 int getvisualpage(void); 553 554 /* ----------------------------------------------------------------- */ 555 #define restorecrtmode() __gr_restorecrtmode() 556 #define getgraphmode() (__gr_INIT ? __gr_Mode : (__gr_Result=grNoInitGraph)) 557 #define getmaxmode() (__gr_set_up_modes(), __gr_MaxMode) 558 #define getmoderange(gd, lomode, himode) \ 559 __gr_getmoderange((gd),(lomode),(himode)) 560 #define graphresult() __gr_graphresult() 561 #define getx() (__gr_X+0) 562 #define gety() (__gr_Y+0) 563 #define moveto(x, y) do { __gr_X = (x); __gr_Y = (y); } while(0) 564 #define moverel(dx, dy) moveto(getx()+(dx),gety()+(dy)) 565 #define getbkcolor() (__gr_colorbg+0) 566 #define getcolor() (__gr_color+0) 567 #define cleardevice() __gr_cleardevice() 568 #define setbkcolor(color) do __gr_colorbg = (color); while(0) 569 #define setcolor(color) do __gr_color = (color); while(0) 570 #define line(x1, y1, x2, y2) __gr_line((x1),(y1),(x2),(y2)) 571 #define linerel(dx, dy) __gr_line(getx(),gety(),getx()+(dx),gety()+(dy)) 572 #define lineto(x, y) __gr_line(getx(),gety(),(x),(y)) 573 #define drawpoly(numpoints, polypoints) \ 574 __gr_drawpol((numpoints), (polypoints), FALSE) 575 #define bar(left, top, right, bottom) __gr_bar((left),(top),(right),(bottom)) 576 #define circle(x, y, radius) __gr_circle((x),(y),(radius)) 577 #define ellipse(x, y, stangle, endangle, xradius, yradius) \ 578 __gr_ellipse((x),(y),(stangle),(endangle),(xradius),(yradius)) 579 /* arc() uses radius twice */ 580 #define getaspectratio(xasp, yasp) \ 581 do { *(xasp) = __gr_Xasp; *(yasp) = __gr_Yasp; } while(0) 582 #define setaspectratio(xasp, yasp ) \ 583 do { __gr_Xasp = (xasp); __gr_Yasp = (yasp); } while(0) 584 /* getfillsettings() uses fillinfo twice */ 585 #define getfillpattern(pattern) __gr_getfillpattern(pattern) 586 #define sector(x, y, stangle, endangle, xradius, yradius) \ 587 __gr_sector((x),(y),(stangle),(endangle),(xradius), (yradius)); 588 /* pieslice() uses radius twice */ 589 #define setgraphbufsize(bufsize) __gr_setgraphbufsize(bufsize) 590 #define getdefaultpalette() (&__gr_EGAdef) 591 #define installbgidriver(name, detect) __gr_installbgidriver((name), (detect)) 592 #define registerfarbgidriver(driver) __gr_registerfarbgidriver(driver) 593 #define registerfarbgifont(font) registerbgifont(font) 594 #define textlinestyle(on) do __gr_TextLineStyle = on; while(0); 595 #define setpalette(colornum, color) __gr_setpalette((colornum),(color)) 596 #define set_BGI_mode_pages(p) __gr_set_BGI_mode_pages(p) 597 #define get_BGI_mode_pages() __gr_get_BGI_mode_pages() 598 #define set_BGI_mode_whc(gd, gm, width, height, colors) \ 599 do { \ 600 __gr_set_BGI_mode_pages(1); \ 601 __gr_BGI_w = (width); \ 602 __gr_BGI_h = (height); \ 603 __gr_BGI_c = (colors); \ 604 *(gd) = NATIVE_GRX; \ 605 *(gm) = GRX_BGI_EMULATION; \ 606 } while(0) 607 #define getmodemaxcolor(mode) __gr_getmodemaxcolor(mode) 608 #define getmodemaxx(mode) __gr_getmodemaxx(mode) 609 #define getmodemaxy(mode) __gr_getmodemaxx(mode) 610 #define setrgbcolor(r, g, b) __gr_setrgbcolor((r),(g),(b)) 611 #define setactivepage(p) __gr_setactivepage(p) 612 #define getactivepage() __gr_getactivepage() 613 #define setvisualpage(p) __gr_setvisualpage(p) 614 #define getvisualpage() __gr_getvisualpage() 615 616 #ifdef __BCCGRX_C 617 618 /* ----------------------------------------------------------------- */ 619 void (restorecrtmode)(void) { 620 __gr_restorecrtmode(); 621 } 622 623 /* ----------------------------------------------------------------- */ 624 int (getgraphmode)(void) { 625 return (__gr_INIT ? __gr_Mode : (__gr_Result=grNoInitGraph)); 626 } 627 628 /* ----------------------------------------------------------------- */ 629 int (getmaxmode)(void) { 630 __gr_set_up_modes(); 631 return __gr_MaxMode; 632 } 633 634 /* ----------------------------------------------------------------- */ 635 void (getmoderange)(int gd, int *lomode, int *himode) { 636 __gr_getmoderange(gd, lomode, himode); 637 } 638 639 /* ----------------------------------------------------------------- */ 640 int (graphresult)(void) { 641 return __gr_graphresult(); 642 } 643 644 /* ----------------------------------------------------------------- */ 645 int (getx)(void) { 646 return __gr_X; 647 } 648 649 /* ----------------------------------------------------------------- */ 650 int (gety)(void) { 651 return __gr_Y; 652 } 653 654 /* ----------------------------------------------------------------- */ 655 void (moveto)(int x, int y) { 656 __gr_X = x; __gr_Y = y; 657 } 658 659 /* ----------------------------------------------------------------- */ 660 void (moverel)(int dx, int dy) { 661 moveto( getx()+dx, gety()+dy); 662 } 663 664 /* ----------------------------------------------------------------- */ 665 int (getbkcolor)(void) { 666 return __gr_colorbg; 667 } 668 669 /* ----------------------------------------------------------------- */ 670 int (getcolor)(void) { 671 return __gr_color; 672 } 673 674 /* ----------------------------------------------------------------- */ 675 void (cleardevice)(void) { 676 __gr_cleardevice(); 677 } 678 679 /* ----------------------------------------------------------------- */ 680 void (setbkcolor)(int color) { 681 __gr_colorbg= color; 682 } 683 684 /* ----------------------------------------------------------------- */ 685 void (setcolor)(int color) { 686 __gr_color= color; 687 } 688 689 /* ----------------------------------------------------------------- */ 690 void (line)(int x1, int y1, int x2, int y2) { 691 __gr_line(x1,y1,x2,y2); 692 } 693 694 /* ----------------------------------------------------------------- */ 695 void (linerel)(int dx, int dy) { 696 register int x = getx(); 697 register int y = gety(); 698 __gr_line(x,y,x+dx,y+dy); 699 } 700 701 /* ----------------------------------------------------------------- */ 702 void (lineto)(int x, int y) { 703 __gr_line( getx(), gety(), x, y); 704 } 705 706 /* ----------------------------------------------------------------- */ 707 void (drawpoly)(int numpoints, void *polypoints) { 708 __gr_drawpol(numpoints, polypoints, FALSE); 709 } 710 711 /* ----------------------------------------------------------------- */ 712 void (bar)(int left, int top, int right, int bottom) { 713 __gr_bar(left,top,right, bottom); 714 } 715 716 /* ----------------------------------------------------------------- */ 717 void (circle)(int x, int y, int radius) { 718 __gr_circle(x,y,radius); 719 } 720 721 /* ----------------------------------------------------------------- */ 722 void (ellipse)( int x, int y, int stangle, int endangle, 723 int xradius, int yradius ) { 724 __gr_ellipse( x, y, stangle, endangle, xradius, yradius); 725 } 726 727 /* ----------------------------------------------------------------- */ 728 void (arc)(int x, int y, int stangle, int endangle, int radius) { 729 __gr_ellipse(x,y,stangle,endangle,radius,radius); 730 } 731 732 /* ----------------------------------------------------------------- */ 733 void (getaspectratio)(int *xasp, int *yasp) { 734 *xasp = __gr_Xasp; *yasp = __gr_Yasp; 735 } 736 737 /* ----------------------------------------------------------------- */ 738 void (setaspectratio)( int xasp, int yasp ) { 739 __gr_Xasp = xasp; __gr_Yasp = yasp; 740 } 741 742 /* ----------------------------------------------------------------- */ 743 void (getfillsettings)(struct fillsettingstype *fillinfo) { 744 fillinfo->pattern = __gr_fpatno; 745 fillinfo->color = __gr_colorfill; 746 } 747 748 /* ----------------------------------------------------------------- */ 749 void (getfillpattern)(char *pattern) { 750 __gr_getfillpattern(pattern); 751 } 752 753 /* ----------------------------------------------------------------- */ 754 void (sector)( int x, int y, int stangle, int endangle, 755 int xradius, int yradius ) { 756 __gr_sector(x,y,stangle,endangle,xradius, yradius); 757 } 758 759 /* ----------------------------------------------------------------- */ 760 void (pieslice)(int x, int y, int stangle, int endangle, int radius) { 761 __gr_sector(x,y,stangle,endangle,radius,radius); 762 } 763 764 /* ----------------------------------------------------------------- */ 765 unsigned (setgraphbufsize)(unsigned bufsize) { 766 return __gr_setgraphbufsize(bufsize); 767 } 768 769 /* ----------------------------------------------------------------- */ 770 struct palettetype *(getdefaultpalette)(void) { 771 return &__gr_EGAdef; 772 } 773 774 /* ----------------------------------------------------------------- */ 775 int (installbgidriver)(char *name, void *detect) { 776 return __gr_installbgidriver(name, detect); 777 } 778 779 /* ----------------------------------------------------------------- */ 780 int (registerfarbgidriver)(void *driver) { 781 return __gr_registerfarbgidriver(driver); 782 } 783 784 /* ----------------------------------------------------------------- */ 785 int (registerfarbgifont)(void *font) { 786 return registerbgifont(font); 787 } 788 789 /* ----------------------------------------------------------------- */ 790 void (textlinestyle)(int on) { 791 __gr_TextLineStyle = on; 792 } 793 794 /* ----------------------------------------------------------------- */ 795 void (setpalette)(int colornum, int color) { 796 __gr_setpalette(colornum,color); 797 } 798 799 /* ----------------------------------------------------------------- */ 800 void (set_BGI_mode_pages)(int p) { 801 __gr_set_BGI_mode_pages(p); 802 } 803 804 /* ----------------------------------------------------------------- */ 805 int (get_BGI_mode_pages)(void) { 806 return __gr_get_BGI_mode_pages(); 807 } 808 809 /* ----------------------------------------------------------------- */ 810 void (set_BGI_mode_whc)(int *gd, int *gm, int width, int height, int colors) { 811 __gr_set_BGI_mode_pages(1); 812 __gr_BGI_w = width; 813 __gr_BGI_h = height; 814 __gr_BGI_c = colors; 815 *gd = NATIVE_GRX; 816 *gm = GRX_BGI_EMULATION; 817 } 818 819 /* ----------------------------------------------------------------- */ 820 int (getmodemaxcolor)(int mode) { 821 /* works like getmaxcolor() for mode */ 822 return __gr_getmodemaxcolor(mode); 823 } 824 825 /* ----------------------------------------------------------------- */ 826 int (getmodemaxx)(int mode) { 827 /* works like getmaxx() for mode */ 828 return __gr_getmodemaxx(mode); 829 } 830 831 /* ----------------------------------------------------------------- */ 832 int (getmodemaxy)(int mode) { 833 /* works like getmaxy() for mode */ 834 return __gr_getmodemaxx(mode); 835 } 836 837 /* ----------------------------------------------------------------- */ 838 int (setrgbcolor)(int r, int g, int b) { 839 return __gr_setrgbcolor(r,g,b); 840 } 841 842 /* ----------------------------------------------------------------- */ 843 void (setactivepage)(int p) { 844 __gr_setactivepage(p); 845 } 846 847 /* ----------------------------------------------------------------- */ 848 int (getactivepage)(void) { 849 return __gr_getactivepage(); 850 } 851 852 /* ----------------------------------------------------------------- */ 853 void (setvisualpage)(int p) { 854 __gr_setvisualpage(p); 855 } 856 857 /* ----------------------------------------------------------------- */ 858 int (getvisualpage)(void) { 859 return __gr_getvisualpage(); 860 } 861 862 #endif /* __BCCGRX_C */ 863 /* ----------------------------------------------------------------- */ 864 865 #endif 866