1 /************************************************************
3 Copyright 1989, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
25 ********************************************************/
27 #ifndef __MIFILLARC_H__
28 #define __MIFILLARC_H__
30 #define FULLCIRCLE (360 * 64)
32 typedef struct _miFillArc
{
40 /* could use 64-bit integers */
41 typedef struct _miFillArcD
{
46 double ym
, yk
, xm
, xk
;
49 #define miFillArcEmpty(arc) (!(arc)->angle2 || \
50 !(arc)->width || !(arc)->height || \
51 (((arc)->width == 1) && ((arc)->height & 1)))
53 #define miCanFillArc(arc) (((arc)->width == (arc)->height) || \
54 (((arc)->width <= 800) && ((arc)->height <= 800)))
56 #define MIFILLARCSETUP() \
69 #define MIFILLARCSTEP(slw) \
79 slw = (x << 1) + dx; \
80 if ((e == xk) && (slw > 1)) \
83 #define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw)
84 #define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw)
86 #define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk)))
88 typedef struct _miSliceEdge
{
95 } miSliceEdgeRec
, *miSliceEdgePtr
;
97 typedef struct _miArcSlice
{
98 miSliceEdgeRec edge1
, edge2
;
99 int min_top_y
, max_top_y
;
100 int min_bot_y
, max_bot_y
;
101 Bool edge1_top
, edge2_top
;
102 Bool flip_top
, flip_bot
;
105 #define MIARCSLICESTEP(edge) \
106 edge.x -= edge.stepx; \
110 edge.x -= edge.deltax; \
114 #define miFillSliceUpper(slice) \
115 ((y >= slice.min_top_y) && (y <= slice.max_top_y))
117 #define miFillSliceLower(slice) \
118 ((y >= slice.min_bot_y) && (y <= slice.max_bot_y))
120 #define MIARCSLICEUPPER(xl,xr,slice,slw) \
123 if (slice.edge1_top && (slice.edge1.x < xr)) \
124 xr = slice.edge1.x; \
125 if (slice.edge2_top && (slice.edge2.x > xl)) \
128 #define MIARCSLICELOWER(xl,xr,slice,slw) \
131 if (!slice.edge1_top && (slice.edge1.x > xl)) \
132 xl = slice.edge1.x; \
133 if (!slice.edge2_top && (slice.edge2.x < xr)) \
136 #define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \
161 #define MIFILLINARCSTEP(slw) \
171 slw = (inx << 1) + dx; \
172 if ((ine == inxk) && (slw > 1)) \
175 #define miFillInArcLower(slw) (((iny + dy) != 0) && \
176 ((slw > 1) || (ine != inxk)))
178 #endif /* __MIFILLARC_H__ */