Scribus
Open source desktop publishing at your fingertips
KarbonCurveFit.h
1 /* This file is part of the KDE project
2  Copyright (C) 2001-2003 Rob Buis <buis@kde.org>
3  Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
4  Modified for use within Scribus:
5  Copyright (C) 2007 Franz Schmid <Franz.Schmid@altmuehlnet.de>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef KARBONCURVEFIT_H
24 #define KARBONCURVEFIT_H
25 
26 #include <QList>
27 #include <QPointF>
28 #include <QPainterPath>
29 #include <QPolygonF>
30 
31 #include "scribusapi.h"
32 
33 /*
34  * Fits bezier curve to given list of points.
35  *
36  * An Algorithm for Automatically Fitting Digitized Curves
37  * by Philip J. Schneider
38  * from "Graphics Gems", Academic Press, 1990
39  *
40  * http://www.acm.org/pubs/tog/GraphicsGems/gems/FitCurves.c
41  * http://www.acm.org/pubs/tog/GraphicsGems/gems/README
42  *
43  * @param points the list of points to fit curve to
44  * @param error the max. fitting error
45  * @return a path shape representing the fitted curve
46  */
47 
48 QPainterPath SCRIBUS_API bezierFit( const QList<QPointF> &points, float error );
49 QPainterPath SCRIBUS_API bezierFit( const QPolygonF &points, float error );
50 
51 #endif
52