lib

svgpathparser.h
1/* This file is part of the KDE project
2 Copyright (C) 2002, 2003 The Karbon Developers
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __SVGPATHPARSER_H__
21#define __SVGPATHPARSER_H__
22
23class TQString;
24
25#include <koffice_export.h>
37class KOPAINTER_EXPORT SVGPathParser
38{
39public:
40 virtual ~SVGPathParser(){}
41 void parseSVG( const TQString &d, bool process = false );
42
43protected:
44 virtual void svgMoveTo( double x1, double y1, bool abs = true ) = 0;
45 virtual void svgLineTo( double x1, double y1, bool abs = true ) = 0;
46 virtual void svgLineToHorizontal( double x, bool abs = true );
47 virtual void svgLineToVertical( double y, bool abs = true );
48 virtual void svgCurveToCubic( double x1, double y1, double x2, double y2, double x, double y, bool abs = true ) = 0;
49 virtual void svgCurveToCubicSmooth( double x, double y, double x2, double y2, bool abs = true );
50 virtual void svgCurveToQuadratic( double x, double y, double x1, double y1, bool abs = true );
51 virtual void svgCurveToQuadraticSmooth( double x, double y, bool abs = true );
52 virtual void svgArcTo( double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, bool abs = true );
53 virtual void svgClosePath() = 0;
54
55private:
56 const char *getCoord( const char *, double & );
57 void calculateArc( bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag );
58};
59
60#endif
Parser for svg path data, contained in the d attribute.