Rubber-stamped by Brady Eidson.
[webbrowser.git] / WebCore / svg / SVGPathSegCurvetoQuadratic.h
blobeb8b0d5659789f2598a9cc6ae8eaf56835d9d73e
1 /*
2 Copyright (C) 2004, 2005, 2006 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.
21 #ifndef SVGPathSegCurvetoQuadratic_h
22 #define SVGPathSegCurvetoQuadratic_h
24 #if ENABLE(SVG)
26 #include "SVGPathSeg.h"
28 namespace WebCore {
30 class SVGPathSegCurvetoQuadratic : public SVGPathSeg {
31 public:
32 SVGPathSegCurvetoQuadratic(float x, float y, float x1, float y1)
33 : SVGPathSeg(), m_x(x), m_y(y), m_x1(x1), m_y1(y1) {}
35 virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); }
37 void setX(float x) { m_x = x; }
38 float x() const { return m_x; }
40 void setY(float y) { m_y = y; }
41 float y() const { return m_y; }
43 void setX1(float x1) { m_x1 = x1; }
44 float x1() const { return m_x1; }
46 void setY1(float y1) { m_y1 = y1; }
47 float y1() const { return m_y1; }
49 private:
50 float m_x;
51 float m_y;
52 float m_x1;
53 float m_y1;
56 class SVGPathSegCurvetoQuadraticAbs : public SVGPathSegCurvetoQuadratic {
57 public:
58 static PassRefPtr<SVGPathSegCurvetoQuadraticAbs> create(float x, float y, float x1, float y1) { return adoptRef(new SVGPathSegCurvetoQuadraticAbs(x, y, x1, y1)); }
60 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_ABS; }
61 virtual String pathSegTypeAsLetter() const { return "Q"; }
63 private:
64 SVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1);
67 class SVGPathSegCurvetoQuadraticRel : public SVGPathSegCurvetoQuadratic {
68 public:
69 static PassRefPtr<SVGPathSegCurvetoQuadraticRel> create(float x, float y, float x1, float y1) { return adoptRef(new SVGPathSegCurvetoQuadraticRel(x, y, x1, y1)); }
71 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_REL; }
72 virtual String pathSegTypeAsLetter() const { return "q"; }
74 private:
75 SVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1);
78 } // namespace WebCore
80 #endif // ENABLE(SVG)
81 #endif
83 // vim:ts=4:noet