X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fspline.cc;h=096122717469a500919fad58aa4ea0389ce4a6fe;hb=46cd627d647e910f814be6f746517f05ba6faca7;hp=37591be016a3f87f59cd7b2be6a87806a3ff7065;hpb=235732a3db9cfe3ac8228969ee1ad58410eab843;p=swftools.git diff --git a/pdf2swf/spline.cc b/pdf2swf/spline.cc index 37591be..0961227 100644 --- a/pdf2swf/spline.cc +++ b/pdf2swf/spline.cc @@ -3,9 +3,21 @@ Part of the swftools package. - Copyright (c) 2001 Matthias Kramm + Copyright (c) 2001,2002,2003 Matthias Kramm + + 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 file is distributed under the GPL, see file COPYING for details */ + 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 @@ -336,6 +348,9 @@ void qsplines_getdrawpoints(qspline*s, int num, float**p, int*pnum, double acc) *p = positions; } + +#define TANGENTS + int approximate2(struct cspline*s, struct qspline*q, double quality, double start, double end) { int num=0; @@ -349,6 +364,23 @@ int approximate2(struct cspline*s, struct qspline*q, double quality, double star test.control = cspline_getpoint(s, (start+end)/2); test.end = cspline_getpoint(s, end); fixcp(&test); + +#ifdef TANGENTS + if(start< 0.5) { + test.control = cspline_getderivative(s, start); + test.control.x *= (end-start)/2; + test.control.y *= (end-start)/2; + test.control.x += test.start.x; + test.control.y += test.start.y; + } else { + test.control = cspline_getderivative(s, end); + test.control.x *= -(end-start)/2; + test.control.y *= -(end-start)/2; + test.control.x += test.end.x; + test.control.y += test.end.y; + } +#endif + for(t=0;t