home *** CD-ROM | disk | FTP | other *** search
/ Monster Disc 2: The Best of 1992 / MONSTER2.ISO / prog / djgpp / cbgrx102.a01 / CONTRIB / LIBGRX / INCLUDE / GRX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-12  |  22.3 KB  |  568 lines

  1. /**
  2.  ** GRX.H
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program 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.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #ifndef _GRX_H_
  25. #define _GRX_H_
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. #if defined(__GNUC__) && !defined(near)
  32. # define near
  33. # define far
  34. # define huge
  35. #endif
  36.  
  37.  
  38. /* ================================================================== */
  39. /*                 MODE SETTING                  */
  40. /* ================================================================== */
  41.  
  42. typedef enum {
  43.     GR_80_25_text,
  44.     GR_default_text,
  45.     GR_width_height_text,
  46.     GR_biggest_text,
  47.     GR_320_200_graphics,
  48.     GR_default_graphics,
  49.     GR_width_height_graphics,
  50.     GR_biggest_noninterlaced_graphics,
  51.     GR_biggest_graphics,
  52.     GR_width_height_color_graphics
  53. } GR_graphics_modes;
  54.  
  55. #ifdef __cplusplus
  56.   void  GrSetMode(int which,int width=0,int height=0,int colors=0);
  57. #elif !defined(_SETMODE_C_)
  58.   void  GrSetMode(int which,...);
  59. #else
  60.   void  GrSetMode(int which,int width,int height,int colors);
  61. #endif
  62. void    GrSetModeHook(void (*)(void));
  63. int    GrCurrentMode(void);
  64. int    GrAdapterType(void);
  65.  
  66. /*
  67.  * return values from 'GrAdapterType()'
  68.  */
  69. #define GR_VGA        0        /* VGA adapter */
  70. #define GR_EGA        1        /* EGA adapter */
  71. #define GR_HERC        2        /* Hercules mono adapter */
  72. #define GR_8514A    3        /* 8514A or compatible */
  73. #define GR_S3        4        /* S3 graphics accelerator */
  74.  
  75.  
  76. /* ================================================================== */
  77. /*            CONTEXT AND WINDOW STUFF              */
  78. /* ================================================================== */
  79.  
  80. typedef struct _GR_context_ {
  81.     char  far *gc_baseaddr;        /* base address of display memory */
  82.     long  gc_frameaddr;            /* upper left corner coordinate */
  83.     long  gc_planeoffset;        /* offset to next color plane */
  84.     int      gc_lineoffset;        /* offset to next scan line in bytes */
  85.     char  gc_onscreen;            /* is it in video memory ? */
  86.     char  gc_memflags;            /* memory allocation flags */
  87.     int      gc_xmax;            /* max X coord (width  - 1) */
  88.     int      gc_ymax;            /* max Y coord (height - 1) */
  89.     int      gc_xcliplo;            /* low X clipping limit */
  90.     int      gc_ycliplo;            /* low Y clipping limit */
  91.     int      gc_xcliphi;            /* high X clipping limit */
  92.     int      gc_ycliphi;            /* high Y clipping limit */
  93.     int      gc_usrxbase;            /* user window min X coordinate */
  94.     int      gc_usrybase;            /* user window min Y coordinate */
  95.     int      gc_usrwidth;            /* user window width */
  96.     int      gc_usrheight;            /* user window height */
  97.     int      gc_xoffset;            /* X offset from root's base */
  98.     int      gc_yoffset;            /* Y offset from root's base */
  99.     struct _GR_context_ *gc_root;    /* context which owns frame buf */
  100. } GrContext;
  101.  
  102. /*
  103.  * This MUST BE the same as the head of the 'GrContext' structure!!!!
  104.  * This structure contains all the slots describing the physical layout of
  105.  * the display memory, but no clipping limits, etc...
  106.  */
  107. typedef struct {
  108.     char  far *gc_baseaddr;        /* base address of display memory */
  109.     long  gc_frameaddr;            /* upper left corner coordinate */
  110.     long  gc_planeoffset;        /* offset to next color plane */
  111.     int      gc_lineoffset;        /* offset to next scan line in bytes */
  112.     char  gc_onscreen;            /* is it in video memory ? */
  113.     char  gc_memflags;            /* memory allocation flags */
  114. } GrVidRAM;
  115.  
  116.  
  117. int    GrNumPlanes(void);
  118. int    GrLineOffset(int width);
  119. long    GrPlaneSize(int w,int h);
  120. long    GrContextSize(int w,int h);
  121.  
  122. GrContext *GrCreateContext(int w,int h,char far *memory,GrContext *where);
  123. GrContext *GrCreateSubContext(int x1,int y1,int x2,int y2,GrContext *parent,GrContext *where);
  124. GrContext *GrSaveContext(GrContext *where);
  125.  
  126. void    GrResizeSubContext(GrContext *context,int x1,int y1,int x2,int y2);
  127. void    GrSetContext(GrContext *context);
  128. void    GrDestroyContext(GrContext *context);
  129. void    GrSetClipBox(int x1,int y1,int x2,int y2);
  130. void    GrGetClipBox(int *x1p,int *y1p,int *x2p,int *y2p);
  131. void    GrResetClipBox(void);
  132.  
  133. int    GrMaxX(void);
  134. int    GrMaxY(void);
  135. int    GrSizeX(void);
  136. int    GrSizeY(void);
  137. int    GrScreenX(void);
  138. int    GrScreenY(void);
  139.  
  140.  
  141. /* ================================================================== */
  142. /*                  COLOR STUFF                  */
  143. /* ================================================================== */
  144.  
  145. /*
  146.  * color table (for primitives using several colors):
  147.  *   it is an array of int's with the first element being the number of
  148.  *   colors in the table
  149.  */
  150. typedef int *GrColorTableP;
  151.  
  152. #define GR_CTABLE_SIZE(table)        ((table)[0])
  153. #define GR_CTABLE_COLOR(table,index)    (        \
  154.     ((unsigned)(index) < GR_CTABLE_SIZE(table)) ?    \
  155.     (table)[(index) + 1] :                \
  156.     (table)[GR_CTABLE_SIZE(table)]            \
  157. )
  158. #define GR_CTABLE_ALLOCSIZE(colors)    ((colors) + 1)
  159.  
  160. /*
  161.  * Flags to 'OR' to colors for various operations
  162.  */
  163. #ifdef __TURBOC__
  164. # define GrXOR        0x100        /* to "XOR" any color to the screen */
  165. # define GrOR        0x200        /* to "OR" to the screen */
  166. # define GrAND        0x300        /* to "AND" to the screen */
  167. #endif
  168. #ifdef __GNUC__                /* changed for 16 bit colors */
  169. # define GrXOR        0x10000        /* to "XOR" any color to the screen */
  170. # define GrOR        0x20000        /* to "OR" to the screen */
  171. # define GrAND        0x30000        /* to "AND" to the screen */
  172. #endif
  173. #define GrWRITE        0        /* write color */
  174. #define GrNOCOLOR    (GrXOR | 0)    /* GrNOCOLOR is used for "no" color */
  175.  
  176.  
  177. int    GrNumColors(void);
  178. int    GrNumFreeColors(void);
  179.  
  180. int    GrAllocColor(int r,int g,int b);    /* shared, read-only */
  181. int    GrAllocCell(void);            /* unshared, read-write */
  182. int    GrBlack(void);
  183. int    GrWhite(void);
  184.  
  185. void    GrQueryColor(int c,int *r,int *g,int *b);
  186. void    GrFreeColor(int c);
  187. void    GrSetColor(int c,int r,int g,int b);
  188. void    GrSetRGBcolorMode(void);
  189. void    GrResetColors(void);
  190. void    GrRefreshColors(void);
  191.  
  192.  
  193. /* ================================================================== */
  194. /*             GRAPHICS PRIMITIVES                  */
  195. /* ================================================================== */
  196.  
  197. /*
  198.  * framed box colors
  199.  */
  200. typedef struct {
  201.     int  fbx_intcolor;
  202.     int  fbx_topcolor;
  203.     int  fbx_rightcolor;
  204.     int  fbx_bottomcolor;
  205.     int  fbx_leftcolor;
  206. } GrFBoxColors;
  207.  
  208. #ifdef __TURBOC__
  209. #define GR_MAX_POLY_VERTICES    128
  210. #endif
  211. #ifdef __GNUC__
  212. #define GR_MAX_POLY_VERTICES    512
  213. #endif
  214.  
  215. void    GrClearScreen(int bg);
  216. void    GrClearContext(int bg);
  217. void    GrClearClipBox(int bg);
  218. void    GrPlot(int x,int y,int c);
  219. void    GrLine(int x1,int y1,int x2,int y2,int c);
  220. void    GrHLine(int x1,int x2,int y,int c);
  221. void    GrVLine(int x,int y1,int y2,int c);
  222. void    GrBox(int x1,int y1,int x2,int y2,int c);
  223. void    GrFilledBox(int x1,int y1,int x2,int y2,int c);
  224. void    GrFramedBox(int x1,int y1,int x2,int y2,int wdt,GrFBoxColors *c);
  225. void    GrCircle(int xc,int yc,int r,int c);
  226. void    GrEllipse(int xc,int yc,int xa,int ya,int c);
  227. void    GrCircleArc(int xc,int yc,int r,int start,int end,int c);
  228. void    GrEllipseArc(int xc,int yc,int xa,int ya,int start,int end,int c);
  229. void    GrFilledCircle(int xc,int yc,int r,int c);
  230. void    GrFilledEllipse(int xc,int yc,int xa,int ya,int c);
  231. void    GrFilledCircleArc(int xc,int yc,int r,int start,int end,int c);
  232. void    GrFilledEllipseArc(int xc,int yc,int xa,int ya,int start,int end,int c);
  233. void    GrPolyLine(int numpts,int points[][2],int c);
  234. void    GrPolygon(int numpts,int points[][2],int c);
  235. void    GrFilledConvexPolygon(int numpts,int points[][2],int c);
  236. void    GrFilledPolygon(int numpts,int points[][2],int c);
  237. void    GrBitBlt(GrContext *dst,int x,int y,GrContext *src,int x1,int y1,int x2,int y2,int oper);
  238. int    GrPixel(int x,int y);
  239.  
  240.  
  241. /* ================================================================== */
  242. /*           NON CLIPPING DRAWING PRIMITIVES              */
  243. /* ================================================================== */
  244.  
  245. void    GrPlotNC(int x,int y,int c);
  246. void    GrLineNC(int x1,int y1,int x2,int y2,int c);
  247. void    GrHLineNC(int x1,int x2,int y,int c);
  248. void    GrVLineNC(int x,int y1,int y2,int c);
  249. void    GrBoxNC(int x1,int y1,int x2,int y2,int c);
  250. void    GrFilledBoxNC(int x1,int y1,int x2,int y2,int c);
  251. void    GrFramedBoxNC(int x1,int y1,int x2,int y2,int wdt,GrFBoxColors *c);
  252. void    GrBitBltNC(GrContext *dst,int x,int y,GrContext *src,int x1,int y1,int x2,int y2,int oper);
  253. int    GrPixelNC(int x,int y);
  254.  
  255.  
  256. /* ================================================================== */
  257. /*          THICK AND DASHED LINE DRAWING PRIMITIVES              */
  258. /* ================================================================== */
  259.  
  260. /*
  261.  * custom line option structure
  262.  *   zero or one dash pattern length means the line is continuous
  263.  *   the dash pattern always begins with a drawn section
  264.  */
  265. typedef struct {
  266.     int  lno_color;            /* color used to draw line */
  267.     int  lno_width;            /* width of the line */
  268.     int  lno_pattlen;            /* length of the dash pattern */
  269.     unsigned char *lno_dashpat;        /* draw/nodraw pattern */
  270. } GrLineOption;
  271.  
  272. void    GrCustomLine(int x1,int y1,int x2,int y2,GrLineOption *o);
  273. void    GrCustomBox(int x1,int y1,int x2,int y2,GrLineOption *o);
  274. void    GrCustomCircle(int xc,int yc,int r,GrLineOption *o);
  275. void    GrCustomEllipse(int xc,int yc,int xa,int ya,GrLineOption *o);
  276. void    GrCustomCircleArc(int xc,int yc,int r,int start,int end,GrLineOption *o);
  277. void    GrCustomEllipseArc(int xc,int yc,int xa,int ya,int start,int end,GrLineOption *o);
  278. void    GrCustomPolyLine(int numpts,int points[][2],GrLineOption *o);
  279. void    GrCustomPolygon(int numpts,int points[][2],GrLineOption *o);
  280.  
  281.  
  282. /* ================================================================== */
  283. /*           PATTERNED DRAWING AND FILLING PRIMITIVES              */
  284. /* ================================================================== */
  285.  
  286. /*
  287.  * BITMAP: a mode independent way to specify a fill pattern of two
  288.  *   colors. It is always 8 pixels wide (1 byte per scan line), its
  289.  *   height is user-defined. SET THE TYPE FLAG TO ZERO!!!
  290.  */
  291. typedef struct {
  292.     int  bmp_ispixmap;            /* type flag for pattern union */
  293.     int  bmp_height;            /* bitmap height */
  294.     unsigned char *bmp_data;        /* pointer to the bit pattern */
  295.     int  bmp_fgcolor;            /* foreground color for fill */
  296.     int  bmp_bgcolor;            /* background color for fill */
  297.     int  bmp_memflags;            /* set if dynamically allocated */
  298. } GrBitmap;
  299.  
  300. /*
  301.  * PIXMAP: a fill pattern stored in a layout identical to the video RAM
  302.  *   for filling using 'bitblt'-s. It is mode dependent, typically one
  303.  *   of the library functions is used to build it. KEEP THE TYPE FLAG
  304.  *   NONZERO!!!
  305.  */
  306. typedef struct {
  307.     int  pxp_ispixmap;            /* type flag for pattern union */
  308.     int  pxp_width;            /* pixmap width (in pixels)  */
  309.     int  pxp_height;            /* pixmap height (in pixels) */
  310.     int  pxp_oper;            /* bitblt mode (SET, OR, XOR, AND) */
  311.     GrVidRAM pxp_source;        /* source context for fill */
  312. } GrPixmap;
  313.  
  314. /*
  315.  * Fill pattern union -- can either be a bitmap or a pixmap
  316.  */
  317. typedef union {
  318.     int         gp_ispixmap;        /* nonzero for pixmaps */
  319.     GrBitmap gp_bitmap;            /* fill bitmap */
  320.     GrPixmap gp_pixmap;            /* fill pixmap */
  321. } GrPattern;
  322.  
  323. #define gp_bmp_data            gp_bitmap.bmp_data
  324. #define gp_bmp_height            gp_bitmap.bmp_height
  325. #define gp_bmp_fgcolor            gp_bitmap.bmp_fgcolor
  326. #define gp_bmp_bgcolor            gp_bitmap.bmp_bgcolor
  327.  
  328. #define gp_pxp_width            gp_pixmap.pxp_width
  329. #define gp_pxp_height            gp_pixmap.pxp_height
  330. #define gp_pxp_oper            gp_pixmap.pxp_oper
  331. #define gp_pxp_source            gp_pixmap.pxp_source
  332.  
  333. /*
  334.  * Draw pattern for line drawings -- specifies both the:
  335.  *   (1) fill pattern, and the
  336.  *   (2) custom line drawing option
  337.  */
  338. typedef struct {
  339.     GrPattern      *lnp_pattern;        /* fill pattern */
  340.     GrLineOption  *lnp_option;        /* width + dash pattern */
  341. } GrLinePattern;
  342.  
  343.  
  344. GrPattern *GrBuildPixmap(char *pixels,int w,int h,GrColorTableP colors);
  345. GrPattern *GrBuildPixmapFromBits(char *bits,int w,int h,int fgc,int bgc);
  346. GrPattern *GrConvertToPixmap(GrContext *src);
  347. GrPattern *GrLoadBitmap(char *filename,int fg,int bg);
  348. GrPattern *GrLoadPixmap(char *filename,GrColorTableP colors);
  349. GrPattern *GrLoadIcon(char *filename);
  350.  
  351. void    GrDestroyPattern(GrPattern *p);
  352.  
  353. void    GrPatternedLine(int x1,int y1,int x2,int y2,GrLinePattern *lp);
  354. void    GrPatternedBox(int x1,int y1,int x2,int y2,GrLinePattern *lp);
  355. void    GrPatternedCircle(int xc,int yc,int r,GrLinePattern *lp);
  356. void    GrPatternedEllipse(int xc,int yc,int xa,int ya,GrLinePattern *lp);
  357. void    GrPatternedCircleArc(int xc,int yc,int r,int start,int end,GrLinePattern *lp);
  358. void    GrPatternedEllipseArc(int xc,int yc,int xa,int ya,int start,int end,GrLinePattern *lp);
  359. void    GrPatternedPolyLine(int numpts,int points[][2],GrLinePattern *lp);
  360. void    GrPatternedPolygon(int numpts,int points[][2],GrLinePattern *lp);
  361.  
  362. void    GrPatternFilledPlot(int x,int y,GrPattern *p);
  363. void    GrPatternFilledLine(int x1,int y1,int x2,int y2,GrPattern *p);
  364. void    GrPatternFilledBox(int x1,int y1,int x2,int y2,GrPattern *p);
  365. void    GrPatternFilledCircle(int xc,int yc,int r,GrPattern *p);
  366. void    GrPatternFilledEllipse(int xc,int yc,int xa,int ya,GrPattern *p);
  367. void    GrPatternFilledCircleArc(int xc,int yc,int r,int start,int end,GrPattern *p);
  368. void    GrPatternFilledEllipseArc(int xc,int yc,int xa,int ya,int start,int end,GrPattern *p);
  369. void    GrPatternFilledConvexPolygon(int numpts,int points[][2],GrPattern *p);
  370. void    GrPatternFilledPolygon(int numpts,int points[][2],GrPattern *p);
  371.  
  372.  
  373. /* ================================================================== */
  374. /*             FONTS AND TEXT PRIMITIVES                  */
  375. /* ================================================================== */
  376.  
  377. /*
  378.  * font structure - the part visible to the user.
  379.  * for the internal stuff see "grxfont.h" and "grxfile.h"
  380.  * BE CAREFUL when hacking it! TCC and GCC have to produce the
  381.  * same alignments!!!!
  382.  */
  383. #define GR_NAMEWIDTH        16
  384.  
  385. typedef struct {
  386.     short   fnt_width;            /* width (average for proportional) */
  387.     short   fnt_height;            /* font height */
  388.     unsigned short fnt_minchar;        /* lowest character code in font */
  389.     unsigned short fnt_maxchar;        /* highest character code in font */
  390.     short   fnt_isfixed;        /* nonzero if fixed font */
  391.     short   fnt_internal;        /* nonzero if BIOS font */
  392.     short   fnt_baseline;        /* baseline from top of font */
  393.     short   fnt_undwidth;        /* underline width (at bottom) */
  394.     char    fnt_name[GR_NAMEWIDTH];    /* font file name (w/o path) */
  395.     char    fnt_family[GR_NAMEWIDTH];    /* font family name */
  396. } GrFont;
  397.  
  398. /*
  399.  * text drawing directions
  400.  */
  401. #define GR_TEXT_RIGHT        0    /* normal */
  402. #define GR_TEXT_DOWN        1    /* downward */
  403. #define GR_TEXT_LEFT        2    /* upside down, right to left */
  404. #define GR_TEXT_UP        3    /* upward */
  405. #define GR_TEXT_DEFAULT        GR_TEXT_RIGHT
  406.  
  407. /*
  408.  * text alignment options
  409.  */
  410. #define GR_ALIGN_LEFT        0    /* X only */
  411. #define GR_ALIGN_TOP        0    /* Y only */
  412. #define GR_ALIGN_CENTER        1    /* X, Y */
  413. #define GR_ALIGN_RIGHT        2    /* X only */
  414. #define GR_ALIGN_BOTTOM        2    /* Y only */
  415. #define GR_ALIGN_BASELINE    3    /* Y only */
  416. #define GR_ALIGN_DEFAULT    GR_ALIGN_LEFT
  417.  
  418. /*
  419.  * character types in text strings
  420.  */
  421. #define GR_BYTE_TEXT        0    /* one byte per character */
  422. #define GR_WORD_TEXT        1    /* two bytes per character */
  423. #define GR_ATTR_TEXT        2    /* chr w/ PC style attribute byte */
  424.  
  425. /*
  426.  * OR this to the foreground color value for underlined text when
  427.  * using GR_BYTE_TEXT or GR_WORD_TEXT modes.
  428.  */
  429. #define GR_UNDERLINE_TEXT    (GrXOR << 6)
  430.  
  431. /*
  432.  * text attribute macros for the GR_ATTR_TEXT type
  433.  */
  434. #define GR_BUILD_ATTR(fgcolor,bgcolor,underline)  \
  435.     ((fgcolor) & 15) | (((bgcolor) & 7) << 4) | (((underline) & 1) << 7))
  436. #define GR_ATTR_FGCOLOR(attr)    ((attr) & 15)
  437. #define GR_ATTR_BGCOLOR(attr)    (((attr) >> 4) & 7)
  438. #define GR_ATTR_UNDERLINE(attr) (((attr) >> 7) & 1)
  439.  
  440. /*
  441.  * text option structure - contains a font and the options specifying
  442.  * how to draw it. The text drawing functions expect a pointer to this.
  443.  */
  444. typedef struct {
  445.     GrFont *txo_font;            /* font to be used */
  446.     int        txo_xmag;            /* X magnification */
  447.     int        txo_ymag;            /* Y magnification */
  448.     union {
  449.     int v;                /* color when no attributes */
  450.     GrColorTableP p;        /* ptr to color table otherwise */
  451.     } txo_fgcolor,txo_bgcolor;        /* foreground, background */
  452.     char    txo_direct;            /* direction (see above) */
  453.     char    txo_xalign;            /* X alignment (see above) */
  454.     char    txo_yalign;            /* Y alignment (see above) */
  455.     char    txo_chrtype;        /* character type (see above) */
  456. } GrTextOption;
  457.  
  458. /*
  459.  * structure to define a rectangular text window (use fixed fonts only!!)
  460.  */
  461. typedef struct {
  462.     GrFont *txr_font;            /* font to be used */
  463.     char   *txr_buffer;            /* pointer to text buffer */
  464.     char   *txr_backup;            /* optional backup buffer */
  465.     int        txr_xpos;            /* upper left corner X coordinate */
  466.     int        txr_ypos;            /* upper left corner Y coordinate */
  467.     int        txr_width;            /* width of area in chars */
  468.     int        txr_height;            /* height of area in chars */
  469.     int        txr_lineoffset;        /* offset in buffer(s) between lines */
  470.     union {
  471.     int v;                /* color when no attributes */
  472.     GrColorTableP p;        /* ptr to color table otherwise */
  473.     } txr_fgcolor,txr_bgcolor;        /* foreground, background */
  474.     char    txr_chrtype;        /* character type (see above) */
  475. } GrTextRegion;
  476.  
  477. GrTextOption *GrFindBestFont(int width,int height,int magnify,char *family,GrTextOption *where);
  478. GrFont *GrLoadFont(char *name);
  479. GrFont *GrLoadBIOSFont(char *name);
  480. void    GrUnloadFont(GrFont *font);
  481. void    GrSetFontPath(char *path);
  482.  
  483. void    GrDrawChar(int chr,int x,int y,GrTextOption *opt);
  484. void    GrDrawString(char *text,int length,int x,int y,GrTextOption *opt);
  485. void    GrTextXY(int x,int y,char *text,int fg,int bg);
  486. void    GrDumpChar(int chr,int col,int row,GrTextRegion *r);
  487. void    GrDumpText(int col,int row,int wdt,int hgt,GrTextRegion *r);
  488. void    GrDumpTextRegion(GrTextRegion *r);
  489.  
  490. int    GrFontHeight(GrTextOption *opt);
  491. int    GrFontWidth(GrTextOption *opt);
  492. int    GrCharWidth(int chr,GrTextOption *opt);
  493. int    GrCharHeight(int chr,GrTextOption *opt);
  494. int    GrStringWidth(char *text,int length,GrTextOption *opt);
  495. int    GrStringHeight(char *text,int length,GrTextOption *opt);
  496.  
  497.  
  498. /* ================================================================== */
  499. /*         DRAWING IN USER WINDOW COORDINATES              */
  500. /* ================================================================== */
  501.  
  502. void    GrSetUserWindow(int x1,int y1,int x2,int y2);
  503. void    GrGetUserWindow(int *x1,int *y1,int *x2,int *y2);
  504. void    GrGetScreenCoord(int *x,int *y);
  505. void    GrGetUserCoord(int *x,int *y);
  506.  
  507. void    GrUsrPlot(int x,int y,int c);
  508. void    GrUsrLine(int x1,int y1,int x2,int y2,int c);
  509. void    GrUsrHLine(int x1,int x2,int y,int c);
  510. void    GrUsrVLine(int x,int y1,int y2,int c);
  511. void    GrUsrBox(int x1,int y1,int x2,int y2,int c);
  512. void    GrUsrFilledBox(int x1,int y1,int x2,int y2,int c);
  513. void    GrUsrFramedBox(int x1,int y1,int x2,int y2,int wdt,GrFBoxColors *c);
  514. void    GrUsrCircle(int xc,int yc,int r,int c);
  515. void    GrUsrEllipse(int xc,int yc,int xa,int ya,int c);
  516. void    GrUsrCircleArc(int xc,int yc,int r,int start,int end,int c);
  517. void    GrUsrEllipseArc(int xc,int yc,int xa,int ya,int start,int end,int c);
  518. void    GrUsrFilledCircle(int xc,int yc,int r,int c);
  519. void    GrUsrFilledEllipse(int xc,int yc,int xa,int ya,int c);
  520. void    GrUsrFilledCircleArc(int xc,int yc,int r,int start,int end,int c);
  521. void    GrUsrFilledEllipseArc(int xc,int yc,int xa,int ya,int start,int end,int c);
  522. void    GrUsrPolyLine(int numpts,int points[][2],int c);
  523. void    GrUsrPolygon(int numpts,int points[][2],int c);
  524. void    GrUsrFilledConvexPolygon(int numpts,int points[][2],int c);
  525. void    GrUsrFilledPolygon(int numpts,int points[][2],int c);
  526. int    GrUsrPixel(int x,int y);
  527.  
  528. void    GrUsrCustomLine(int x1,int y1,int x2,int y2,GrLineOption *o);
  529. void    GrUsrCustomBox(int x1,int y1,int x2,int y2,GrLineOption *o);
  530. void    GrUsrCustomCircle(int xc,int yc,int r,GrLineOption *o);
  531. void    GrUsrCustomEllipse(int xc,int yc,int xa,int ya,GrLineOption *o);
  532. void    GrUsrCustomCircleArc(int xc,int yc,int r,int start,int end,GrLineOption *o);
  533. void    GrUsrCustomEllipseArc(int xc,int yc,int xa,int ya,int start,int end,GrLineOption *o);
  534. void    GrUsrCustomPolyLine(int numpts,int points[][2],GrLineOption *o);
  535. void    GrUsrCustomPolygon(int numpts,int points[][2],GrLineOption *o);
  536.  
  537. void    GrUsrPatternedLine(int x1,int y1,int x2,int y2,GrLinePattern *lp);
  538. void    GrUsrPatternedBox(int x1,int y1,int x2,int y2,GrLinePattern *lp);
  539. void    GrUsrPatternedCircle(int xc,int yc,int r,GrLinePattern *lp);
  540. void    GrUsrPatternedEllipse(int xc,int yc,int xa,int ya,GrLinePattern *lp);
  541. void    GrUsrPatternedCircleArc(int xc,int yc,int r,int start,int end,GrLinePattern *lp);
  542. void    GrUsrPatternedEllipseArc(int xc,int yc,int xa,int ya,int start,int end,GrLinePattern *lp);
  543. void    GrUsrPatternedPolyLine(int numpts,int points[][2],GrLinePattern *lp);
  544. void    GrUsrPatternedPolygon(int numpts,int points[][2],GrLinePattern *lp);
  545.  
  546. void    GrUsrPatternFilledPlot(int x,int y,GrPattern *p);
  547. void    GrUsrPatternFilledLine(int x1,int y1,int x2,int y2,GrPattern *p);
  548. void    GrUsrPatternFilledBox(int x1,int y1,int x2,int y2,GrPattern *p);
  549. void    GrUsrPatternFilledCircle(int xc,int yc,int r,GrPattern *p);
  550. void    GrUsrPatternFilledEllipse(int xc,int yc,int xa,int ya,GrPattern *p);
  551. void    GrUsrPatternFilledCircleArc(int xc,int yc,int r,int start,int end,GrPattern *p);
  552. void    GrUsrPatternFilledEllipseArc(int xc,int yc,int xa,int ya,int start,int end,GrPattern *p);
  553. void    GrUsrPatternFilledConvexPolygon(int numpts,int points[][2],GrPattern *p);
  554. void    GrUsrPatternFilledPolygon(int numpts,int points[][2],GrPattern *p);
  555.  
  556. GrTextOption *GrUsrFindBestFont(int width,int height,int magnify,char *family,GrTextOption *where);
  557. void    GrUsrDrawChar(int chr,int x,int y,GrTextOption *opt);
  558. void    GrUsrDrawString(char *text,int length,int x,int y,GrTextOption *opt);
  559. void    GrUsrTextXY(int x,int y,char *text,int fg,int bg);
  560.  
  561.  
  562. #ifdef __cplusplus
  563. }
  564. #endif
  565.  
  566. #endif  /* whole file */
  567.  
  568.