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