2 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
25 #include "PlatformString.h"
28 #include <wtf/RefCounted.h>
32 class SVGStyledElement
;
34 class SVGPathSeg
: public RefCounted
<SVGPathSeg
> {
36 virtual ~SVGPathSeg() { }
40 PATHSEG_CLOSEPATH
= 1,
41 PATHSEG_MOVETO_ABS
= 2,
42 PATHSEG_MOVETO_REL
= 3,
43 PATHSEG_LINETO_ABS
= 4,
44 PATHSEG_LINETO_REL
= 5,
45 PATHSEG_CURVETO_CUBIC_ABS
= 6,
46 PATHSEG_CURVETO_CUBIC_REL
= 7,
47 PATHSEG_CURVETO_QUADRATIC_ABS
= 8,
48 PATHSEG_CURVETO_QUADRATIC_REL
= 9,
51 PATHSEG_LINETO_HORIZONTAL_ABS
= 12,
52 PATHSEG_LINETO_HORIZONTAL_REL
= 13,
53 PATHSEG_LINETO_VERTICAL_ABS
= 14,
54 PATHSEG_LINETO_VERTICAL_REL
= 15,
55 PATHSEG_CURVETO_CUBIC_SMOOTH_ABS
= 16,
56 PATHSEG_CURVETO_CUBIC_SMOOTH_REL
= 17,
57 PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
= 18,
58 PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
= 19
61 virtual unsigned short pathSegType() const { return PATHSEG_UNKNOWN
; }
62 virtual String
pathSegTypeAsLetter() const { return ""; }
63 virtual String
toString() const { return ""; }
65 const QualifiedName
& associatedAttributeName() const { return SVGNames::dAttr
; }
71 class SVGPathSegSingleCoord
: public SVGPathSeg
{
73 SVGPathSegSingleCoord(float x
, float y
)
74 : SVGPathSeg() , m_x(x
) , m_y(y
) {}
76 void setX(float x
) { m_x
= x
; }
77 float x() const { return m_x
; }
79 void setY(float y
) { m_y
= y
; }
80 float y() const { return m_y
; }
82 virtual String
toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg", m_x
, m_y
); }
90 } // namespace WebCore