mifpoly.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
0N/A/* $Xorg: mifpoly.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */
2362N/A/***********************************************************
0N/A
0N/ACopyright 1987, 1998 The Open Group
0N/A
0N/APermission to use, copy, modify, distribute, and sell this software and its
2362N/Adocumentation for any purpose is hereby granted without fee, provided that
0N/Athe above copyright notice appear in all copies and that both that
2362N/Acopyright notice and this permission notice appear in supporting
0N/Adocumentation.
0N/A
0N/AThe above copyright notice and this permission notice shall be included in
0N/Aall copies or substantial portions of the Software.
0N/A
0N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0N/AOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0N/AAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0N/ACONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2362N/A
2362N/AExcept as contained in this notice, the name of The Open Group shall not be
2362N/Aused in advertising or otherwise to promote the sale, use or other dealings
0N/Ain this Software without prior written authorization from The Open Group.
0N/A
0N/A
0N/ACopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
0N/A
0N/A All Rights Reserved
0N/A
0N/APermission to use, copy, modify, and distribute this software and its
0N/Adocumentation for any purpose and without fee is hereby granted,
0N/Aprovided that the above copyright notice appear in all copies and that
0N/Aboth that copyright notice and this permission notice appear in
0N/Asupporting documentation, and that the name of Digital not be
0N/Aused in advertising or publicity pertaining to distribution of the
0N/Asoftware without specific, written prior permission.
0N/A
0N/ADIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
0N/AALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
0N/ADIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
0N/AANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
0N/AWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
0N/AARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
0N/ASOFTWARE.
0N/A
0N/A******************************************************************/
0N/A/* $XFree86: xc/programs/Xserver/mi/mifpoly.h,v 1.3 2001/10/25 12:03:47 alanh Exp $ */
0N/A
0N/A#ifndef __MIFPOLY_H__
0N/A#define __MIFPOLY_H__
0N/A
0N/A#define EPSILON 0.000001
0N/A#define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON)
0N/A#define UNEQUAL(a,b) (Fabs((a) - (b)) > EPSILON)
0N/A#define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \
0N/A (b) - (a) <= 0.5)
0N/A#define ROUNDTOINT(x) ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5)))
0N/A#define ISZERO(x) (Fabs((x)) <= EPSILON)
0N/A#define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
0N/A#define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y))
0N/A#define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y))
0N/A
0N/A#define NotEnd 0
0N/A#define FirstEnd 1
0N/A#define SecondEnd 2
0N/A
0N/A#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */
0N/A#define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */
0N/A
0N/A#ifdef NOINLINEICEIL
0N/A#define ICEIL(x) ((int)ceil(x))
0N/A#else
0N/A#ifdef __GNUC__
0N/Astatic __inline int ICEIL(double x)
0N/A{
0N/A int _cTmp = x;
0N/A return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
0N/A}
0N/A#else
0N/A#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1)
0N/A#define ICEILTEMPDECL static int _cTmp;
0N/A#endif
0N/A#endif
0N/A
0N/A/* Point with sub-pixel positioning. In this case we use doubles, but
0N/A * see mifpolycon.c for other suggestions
0N/A */
0N/Atypedef struct _SppPoint {
0N/A double x, y;
0N/A} SppPointRec, *SppPointPtr;
0N/A
0N/Atypedef struct _SppArc {
0N/A double x, y, width, height;
0N/A double angle1, angle2;
0N/A} SppArcRec, *SppArcPtr;
0N/A
0N/A/* mifpolycon.c */
0N/A
0N/Aextern void miFillSppPoly(
0N/A DrawablePtr /*dst*/,
0N/A GCPtr /*pgc*/,
0N/A int /*count*/,
0N/A SppPointPtr /*ptsIn*/,
0N/A int /*xTrans*/,
0N/A int /*yTrans*/,
0N/A double /*xFtrans*/,
0N/A double /*yFtrans*/
0N/A);
0N/A
0N/A#endif /* __MIFPOLY_H__ */
0N/A