3 Copyright 1988, 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
12 in all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
29 /* Author: Keith Packard, MIT X Consortium */
32 #include "mifpoly.h" /* for ICEIL */
35 * Polygon edge description for integer wide-line routines
38 typedef struct _PolyEdge
{
39 int height
; /* number of scanlines to process */
40 int x
; /* starting x coordinate */
41 int stepx
; /* fixed integral dx */
42 int signdx
; /* variable dx sign */
43 int e
; /* initial error term */
46 } PolyEdgeRec
, *PolyEdgePtr
;
48 #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
51 * types for general polygon routines
54 typedef struct _PolyVertex
{
56 } PolyVertexRec
, *PolyVertexPtr
;
58 typedef struct _PolySlope
{
60 double k
; /* x0 * dy - y0 * dx */
61 } PolySlopeRec
, *PolySlopePtr
;
64 * Line face description for caps/joins
67 typedef struct _LineFace
{
72 } LineFaceRec
, *LineFacePtr
;
75 * macros for polygon fillers
78 #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
79 oldPixel = pGC->fgPixel; \
80 if (pixel != oldPixel) { \
83 ChangeGC (NullClient, pGC, GCForeground, &gcval); \
84 ValidateGC (pDrawable, pGC); \
87 #define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
88 if (pixel != oldPixel) { \
90 gcval.val = oldPixel; \
91 ChangeGC (NullClient, pGC, GCForeground, &gcval); \
92 ValidateGC (pDrawable, pGC); \
96 extern _X_EXPORT
void miRoundJoinClip(LineFacePtr
/*pLeft */ ,
97 LineFacePtr
/*pRight */ ,
98 PolyEdgePtr
/*edge1 */ ,
99 PolyEdgePtr
/*edge2 */ ,
106 extern _X_EXPORT
int miRoundCapClip(LineFacePtr
/*face */ ,
108 PolyEdgePtr
/*edge */ ,
112 extern _X_EXPORT
int miPolyBuildEdge(double x0
, double y0
, double k
, int dx
,
113 int dy
, int xi
, int yi
, int left
,
115 extern _X_EXPORT
int miPolyBuildPoly(PolyVertexPtr vertices
,
116 PolySlopePtr slopes
, int count
, int xi
,
117 int yi
, PolyEdgePtr left
,
118 PolyEdgePtr right
, int *pnleft
,
119 int *pnright
, int *h
);