/* This file is part of patharea, a Filter plugin for Adobe Illustrator Copyright (C) 1995-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 #include "AIBlock.h" #include "AIFilter.h" #include "AIMatchingArt.h" #include "AIFixedMath.h" #include "AIArt.h" #include "AIPath.h" #include "AIMdMemory.h" #include "ADMBasic.h" //#include "ADMDialog.h" // ---- API-version dependent stuff #ifdef kAIRealMathSuite // AI 8.0 or later #include "AIRealMath.h" typedef AIRealPoint pt; typedef AIRealRect AIRECT; #define ONECONSTANT kAIRealOne #define FLT // convert component of pt to floating point (null op) #define LENGTH sRealMath->AIRealLength #define POINTCLOSE sRealMath->AIRealPointClose #define POINTEQUAL sRealMath->AIRealPointEqual #else typedef AIFixedPoint pt; typedef AIFixedRect AIRECT; #define ONECONSTANT kFixedOne #define FLT sMath->FixedToFloat // convert component of pt to floating point #define LENGTH sMath->FixedLength #define POINTCLOSE sMath->FixedPointClose #define POINTEQUAL sMath->FixedPointEqual #endif // CURVE_TOLERANCE is the square of the maximum allowable distance // from midpoint between curve endpoints (c0-c3), // and the actual halfway point on Bezier segment (z3). // Beziers will be subdivided (no more than MAX_STEPS times) until this tolerance is reached #define CURVE_TOLERANCE (ONECONSTANT/100) #define MAX_DEPTH 16 // recursion limit on curve subdivision // ----- prototypes AIErr acquire_suites( SPMessageData *m ); AIErr release_suites( SPMessageData *m ); AIErr plugin_startup ( SPInterfaceMessage *im ); AIErr plugin_shutdown( SPInterfaceMessage *im ); AIErr plugin_about( SPInterfaceMessage *im ); void mid(pt *a,pt *b,pt *c); void divide_curve(pt c[],pt z[]); void docurve(SPMessageData *m, pt c[],int corner,int depth); AIErr do_art( SPMessageData *m, AIArtHandle path ); AIErr filter_go( AIFilterMessage *fm );