a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/***********************************************************
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCopyright 1987, 1998 The Open Group
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncthe above copyright notice appear in all copies and that both that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynccopyright notice and this permission notice appear in supporting
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncdocumentation.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncThe above copyright notice and this permission notice shall be included in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncall copies or substantial portions of the Software.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncin this Software without prior written authorization from The Open Group.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync All Rights Reserved
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncPermission to use, copy, modify, and distribute this software and its
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncdocumentation for any purpose and without fee is hereby granted,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncprovided that the above copyright notice appear in all copies and that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncboth that copyright notice and this permission notice appear in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncsupporting documentation, and that the name of Digital not be
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncused in advertising or publicity pertaining to distribution of the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncsoftware without specific, written prior permission.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncSOFTWARE.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync******************************************************************/
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#ifndef __MIFPOLY_H__
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define __MIFPOLY_H__
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#include <X11/Xfuncproto.h>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define EPSILON 0.000001
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync (b) - (a) <= 0.5)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define ROUNDTOINT(x) ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5)))
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define ISZERO(x) (fabs((x)) <= EPSILON)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y))
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y))
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define NotEnd 0
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define FirstEnd 1
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define SecondEnd 2
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncstatic _X_INLINE int
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncICEIL(double x)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync{
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int _cTmp = x;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync}
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Point with sub-pixel positioning. In this case we use doubles, but
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * see mifpolycon.c for other suggestions
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef struct _SppPoint {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync double x, y;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync} SppPointRec, *SppPointPtr;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef struct _SppArc {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync double x, y, width, height;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync double angle1, angle2;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync} SppArcRec, *SppArcPtr;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* mifpolycon.c */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT void miFillSppPoly(DrawablePtr /*dst */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GCPtr /*pgc */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*count */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync SppPointPtr /*ptsIn */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*xTrans */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*yTrans */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync double /*xFtrans */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync double /*yFtrans */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#endif /* __MIFPOLY_H__ */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync