miwideline.h revision 6747b715
105b261ecSmrg/* 205b261ecSmrg 305b261ecSmrgCopyright 1988, 1998 The Open Group 405b261ecSmrg 505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its 605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that 705b261ecSmrgthe above copyright notice appear in all copies and that both that 805b261ecSmrgcopyright notice and this permission notice appear in supporting 905b261ecSmrgdocumentation. 1005b261ecSmrg 1105b261ecSmrgThe above copyright notice and this permission notice shall be included 1205b261ecSmrgin all copies or substantial portions of the Software. 1305b261ecSmrg 1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1505b261ecSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1605b261ecSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1705b261ecSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 1805b261ecSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1905b261ecSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2005b261ecSmrgOTHER DEALINGS IN THE SOFTWARE. 2105b261ecSmrg 2205b261ecSmrgExcept as contained in this notice, the name of The Open Group shall 2305b261ecSmrgnot be used in advertising or otherwise to promote the sale, use or 2405b261ecSmrgother dealings in this Software without prior written authorization 2505b261ecSmrgfrom The Open Group. 2605b261ecSmrg 2705b261ecSmrg*/ 2805b261ecSmrg 2905b261ecSmrg/* Author: Keith Packard, MIT X Consortium */ 3005b261ecSmrg 3105b261ecSmrg#include "mispans.h" 3205b261ecSmrg#include "mifpoly.h" /* for ICEIL */ 3305b261ecSmrg 3405b261ecSmrg/* 3505b261ecSmrg * Polygon edge description for integer wide-line routines 3605b261ecSmrg */ 3705b261ecSmrg 3805b261ecSmrgtypedef struct _PolyEdge { 3905b261ecSmrg int height; /* number of scanlines to process */ 4005b261ecSmrg int x; /* starting x coordinate */ 4105b261ecSmrg int stepx; /* fixed integral dx */ 4205b261ecSmrg int signdx; /* variable dx sign */ 4305b261ecSmrg int e; /* initial error term */ 4405b261ecSmrg int dy; 4505b261ecSmrg int dx; 4605b261ecSmrg} PolyEdgeRec, *PolyEdgePtr; 4705b261ecSmrg 4805b261ecSmrg#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */ 4905b261ecSmrg 5005b261ecSmrg/* 5105b261ecSmrg * types for general polygon routines 5205b261ecSmrg */ 5305b261ecSmrg 5405b261ecSmrgtypedef struct _PolyVertex { 5505b261ecSmrg double x, y; 5605b261ecSmrg} PolyVertexRec, *PolyVertexPtr; 5705b261ecSmrg 5805b261ecSmrgtypedef struct _PolySlope { 5905b261ecSmrg int dx, dy; 6005b261ecSmrg double k; /* x0 * dy - y0 * dx */ 6105b261ecSmrg} PolySlopeRec, *PolySlopePtr; 6205b261ecSmrg 6305b261ecSmrg/* 6405b261ecSmrg * Line face description for caps/joins 6505b261ecSmrg */ 6605b261ecSmrg 6705b261ecSmrgtypedef struct _LineFace { 6805b261ecSmrg double xa, ya; 6905b261ecSmrg int dx, dy; 7005b261ecSmrg int x, y; 7105b261ecSmrg double k; 7205b261ecSmrg} LineFaceRec, *LineFacePtr; 7305b261ecSmrg 7405b261ecSmrg/* 7505b261ecSmrg * macros for polygon fillers 7605b261ecSmrg */ 7705b261ecSmrg 7805b261ecSmrg#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ 7905b261ecSmrg oldPixel = pGC->fgPixel; \ 8005b261ecSmrg if (pixel != oldPixel) { \ 816747b715Smrg ChangeGCVal gcval; \ 826747b715Smrg gcval.val = pixel; \ 836747b715Smrg ChangeGC (NullClient, pGC, GCForeground, &gcval); \ 8405b261ecSmrg ValidateGC (pDrawable, pGC); \ 8505b261ecSmrg } \ 8605b261ecSmrg} 8705b261ecSmrg#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ 8805b261ecSmrg if (pixel != oldPixel) { \ 896747b715Smrg ChangeGCVal gcval; \ 906747b715Smrg gcval.val = oldPixel; \ 916747b715Smrg ChangeGC (NullClient, pGC, GCForeground, &gcval); \ 9205b261ecSmrg ValidateGC (pDrawable, pGC); \ 9305b261ecSmrg } \ 9405b261ecSmrg} 9505b261ecSmrg 966747b715Smrgextern _X_EXPORT void miRoundJoinClip( 9705b261ecSmrg LineFacePtr /*pLeft*/, 9805b261ecSmrg LineFacePtr /*pRight*/, 9905b261ecSmrg PolyEdgePtr /*edge1*/, 10005b261ecSmrg PolyEdgePtr /*edge2*/, 10105b261ecSmrg int * /*y1*/, 10205b261ecSmrg int * /*y2*/, 10305b261ecSmrg Bool * /*left1*/, 10405b261ecSmrg Bool * /*left2*/ 10505b261ecSmrg); 10605b261ecSmrg 1076747b715Smrgextern _X_EXPORT int miRoundCapClip( 10805b261ecSmrg LineFacePtr /*face*/, 10905b261ecSmrg Bool /*isInt*/, 11005b261ecSmrg PolyEdgePtr /*edge*/, 11105b261ecSmrg Bool * /*leftEdge*/ 11205b261ecSmrg); 11305b261ecSmrg 1146747b715Smrgextern _X_EXPORT int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy, 11505b261ecSmrg int xi, int yi, int left, PolyEdgePtr edge); 1166747b715Smrgextern _X_EXPORT int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes, 11705b261ecSmrg int count, int xi, int yi, PolyEdgePtr left, 11805b261ecSmrg PolyEdgePtr right, int *pnleft, int *pnright, 11905b261ecSmrg int *h); 12005b261ecSmrg 121