1 /* 2 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann (at) kde.org> 3 2004, 2005, 2006, 2008 Rob Buis <buis (at) kde.org> 4 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. 9 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. 14 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. 19 */ 20 21 #ifndef SVGPathSegCurvetoQuadratic_h 22 #define SVGPathSegCurvetoQuadratic_h 23 24 #if ENABLE(SVG) 25 26 #include "SVGPathSeg.h" 27 28 namespace WebCore { 29 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) {} 34 35 virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); } 36 37 void setX(float x) { m_x = x; } 38 float x() const { return m_x; } 39 40 void setY(float y) { m_y = y; } 41 float y() const { return m_y; } 42 43 void setX1(float x1) { m_x1 = x1; } 44 float x1() const { return m_x1; } 45 46 void setY1(float y1) { m_y1 = y1; } 47 float y1() const { return m_y1; } 48 49 private: 50 float m_x; 51 float m_y; 52 float m_x1; 53 float m_y1; 54 }; 55 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)); } 59 60 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_ABS; } 61 virtual String pathSegTypeAsLetter() const { return "Q"; } 62 63 private: 64 SVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1); 65 }; 66 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)); } 70 71 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_REL; } 72 virtual String pathSegTypeAsLetter() const { return "q"; } 73 74 private: 75 SVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1); 76 }; 77 78 } // namespace WebCore 79 80 #endif // ENABLE(SVG) 81 #endif 82 83 // vim:ts=4:noet 84