/* This file is part of radialdistort, a filter plugin for Adobe Illustrator Copyright (C) 1996-2005 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sprintf_tiny.h" #define SPRINTF sprintf_tiny // ---- platform dependent stuff // the Mac 68K runtime model doesn't allow plug-ins to have global data // (unless we use a different base register than A5), so on that platform // we put global variables on the heap instead #ifdef GENERATING68K #define FAKE_GLOBALS 1 #else // when building for Carbon, GENERATING68K is not even defined! #define FAKE_GLOBALS 0 #endif #include "AIBlock.h" #include "AIFilter.h" #include "AIMatchingArt.h" #include "AIFixedMath.h" #include "AIArt.h" #include "AIPath.h" #include "AIMdMemory.h" #include "ADMBasic.h" // ---- API-version dependent stuff #ifdef kAIRealMathSuite // AI 8.0 or later #include "AIRealMath.h" #define PICONSTANT kAIRealPi #define ONECONSTANT kAIRealOne typedef AIRealPoint pt,POINT; typedef AIRealRect RECT; typedef AIReal NUMBER; typedef AIRealMatrix MATRIX; #define FLOAT // convert component of pt to floating point (null op) #define PRODUCT(a,b) ( (a)*(b) ) #define QUOTIENT(a,b) ( (NUMBER)(a)/(b) ) #define MATRIXSETROTATE G(sRealMath)->AIRealMatrixSetRotate #define MATRIXXFORMPOINT G(sRealMath)->AIRealMatrixXformPoint #define RECTUNION G(sRealMath)->AIRealRectUnion #define POINTLENGTHANGLE G(sRealMath)->AIRealPointLengthAngle #define POINTCLOSE G(sRealMath)->AIRealPointClose #define LENGTH G(sRealMath)->AIRealLength #else #define PICONSTANT kFixedPi #define ONECONSTANT kFixedOne typedef AIFixedPoint pt,POINT; typedef AIFixedRect RECT; typedef AIFixed NUMBER; typedef AIFixedMatrix MATRIX; #define FLOAT G(sMath)->FixedToFloat // convert component of pt to floating point #define PRODUCT G(sMath)->FixedMul #define QUOTIENT G(sMath)->FixedDiv #define MATRIXSETROTATE G(sMath)->FixedMatrixSetRotate #define MATRIXXFORMPOINT G(sMath)->FixedMatrixXformPoint #define RECTUNION G(sMath)->FixedRectUnion #define POINTLENGTHANGLE G(sMath)->FixedPointLengthAngle #define POINTCLOSE G(sMath)->FixedPointClose #define LENGTH G(sMath)->FixedLength #endif #define MAX_DEPTH 16 // maximum recursion depth, when dividing curves #define TOLERANCE (ONECONSTANT/100) // allow this much deviation from true distortion (pt) #if FAKE_GLOBALS #define G(F) ( ( (struct globals*) (m)->globals )->F ) #else #define G #endif #define ISFILTER