1 /**
2  ** pfellia.c
3  **
4  ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
5  ** [e-mail: csaba@vuse.vanderbilt.edu]
6  **
7  **  Copyright (C) 1992, Csaba Biegl
8  **    820 Stirrup Dr, Nashville, TN, 37221
9  **    csaba@vuse.vanderbilt.edu
10  **
11  ** This file is part of the GRX graphics library.
12  **
13  ** The GRX graphics library is free software; you can redistribute it
14  ** and/or modify it under some conditions; see the "copying.grx" file
15  ** for details.
16  **
17  ** This library is distributed in the hope that it will be useful,
18  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  **
21  **/
22 
23 #include "libgrx.h"
24 #include "allocate.h"
25 #include "shapes.h"
26 
GrPatternFilledEllipseArc(int xc,int yc,int xa,int ya,int start,int end,int style,GrPattern * p)27 void GrPatternFilledEllipseArc(int xc,int yc,int xa,int ya,int start,int end,int style,GrPattern *p)
28 {
29    int (*points)[2];
30    setup_ALLOC();
31    points = ALLOC(sizeof(int) * 2 * (GR_MAX_ELLIPSE_POINTS + 1));
32    if (points != NULL)
33    {
34       int numpts = GrGenerateEllipseArc(xc,yc,xa,ya,start,end,points);
35       GrFillArg fa;
36 
37       if (style == GR_ARC_STYLE_CLOSE2) {
38 	      points[numpts][0] = xc;
39 	      points[numpts][1] = yc;
40 	      numpts++;
41       }
42       fa.p = p;
43       if(numpts < 0) _GrScanConvexPoly((-numpts),points,&_GrPatternFiller,fa);
44       else           _GrScanPolygon(     numpts, points,&_GrPatternFiller,fa);
45       FREE(points);
46    }
47    reset_ALLOC();
48 }
49