1 /**
2  ** shapes.h ---- declarations and global data for generating complex shapes
3  **
4  ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
5  ** [e-mail: csaba@vuse.vanderbilt.edu]
6  **
7  ** This file is part of the GRX graphics library.
8  **
9  ** The GRX graphics library is free software; you can redistribute it
10  ** and/or modify it under some conditions; see the "copying.grx" file
11  ** for details.
12  **
13  ** This library is distributed in the hope that it will be useful,
14  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  **
17  **/
18 
19 #ifndef __SHAPES_H_INCLUDED__
20 #define __SHAPES_H_INCLUDED__
21 
22 #define USE_FDR_DRAWPATTERN 1
23 
24 typedef union _GR_fillArg {
25     GrColor color;
26     struct _GR_bitmap *bmp;
27     struct _GR_pixmap *pxp;
28     GrPattern *p;
29 } GrFillArg;
30 
31 typedef void (*PixelFillFunc)(int x,int y,GrFillArg fval);
32 typedef void (*LineFillFunc)(int x,int y,int dx,int dy,GrFillArg fval);
33 typedef void (*ScanFillFunc)(int x,int y,int w,GrFillArg fval);
34 
35 typedef struct _GR_filler {
36     PixelFillFunc pixel;
37     LineFillFunc  line;
38     ScanFillFunc  scan;
39 } GrFiller;
40 
41 extern GrFiller _GrSolidFiller;
42 extern GrFiller _GrPatternFiller;
43 /*
44 extern GrFiller _GrBitmapFiller;
45 extern GrFiller _GrPixmapFiller;
46 */
47 
48 void _GrDrawPolygon(int n,int pt[][2],GrFiller *f,GrFillArg c,int doClose);
49 void _GrDrawCustomPolygon(int n,int pt[][2],const GrLineOption *lp,GrFiller *f,GrFillArg c,int doClose,int circle);
50 void _GrScanConvexPoly(int n,int pt[][2],GrFiller *f,GrFillArg c);
51 void _GrScanPolygon(int n,int pt[][2],GrFiller *f,GrFillArg c);
52 void _GrScanEllipse(int xc,int yc,int xa,int ya,GrFiller *f,GrFillArg c,int filled);
53 
54 /* --- */
55 #define _GrDrawPatternedPixel ((PixelFillFunc)_GrPatternFilledPlot)
56 #define _GrDrawPatternedLine ((LineFillFunc)_GrPatternFilledLine)
57 void _GrFillPatternedScanLine(int x,int y,int w,GrFillArg arg);
58 
59 /* --- */
60 void _GrFloodFill(int x,int y,GrColor border,GrFiller *f,GrFillArg fa);
61 
62 /* -- */
63 void _GrFillPattern(int x,int y,int width,GrPattern *p);
64 void _GrFillPatternExt(int x,int y,int sx, int sy,int width,GrPattern *p);
65 void _GrPatternFilledLine(int x1,int y1,int dx,int dy,GrPattern *p);
66 void _GrPatternFilledPlot(int x,int y,GrPattern *p);
67 
68 void _GrFillBitmapPattern(int x,int y,int w,int h,
69 			  char far *bmp,int pitch,int start,
70 			  GrPattern* p,GrColor bg);
71 void _GrFillBitmapPatternExt(int x,int y,int w,int h, int sx, int sy,
72 			     char far *bmp,int pitch,int start,
73 			     GrPattern* p,GrColor bg);
74 
75 #endif
76