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 SVGPathSegCurvetoCubic_h 22 #define SVGPathSegCurvetoCubic_h 23 24 #if ENABLE(SVG) 25 26 #include "SVGPathSeg.h" 27 28 namespace WebCore { 29 30 class SVGPathSegCurvetoCubic : public SVGPathSeg { 31 public: 32 SVGPathSegCurvetoCubic(float x, float y, float x1, float y1, float x2, float y2) : SVGPathSeg() , m_x(x) , m_y(y) , m_x1(x1) , m_y1(y1) , m_x2(x2) , m_y2(y2) {} 33 34 virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y); } 35 36 void setX(float x) { m_x = x; } 37 float x() const { return m_x; } 38 39 void setY(float y) { m_y = y; } 40 float y() const { return m_y; } 41 42 void setX1(float x1) { m_x1 = x1; } 43 float x1() const { return m_x1; } 44 45 void setY1(float y1) { m_y1 = y1; } 46 float y1() const { return m_y1; } 47 48 void setX2(float x2) { m_x2 = x2; } 49 float x2() const { return m_x2; } 50 51 void setY2(float y2) { m_y2 = y2; } 52 float y2() const { return m_y2; } 53 54 private: 55 float m_x; 56 float m_y; 57 float m_x1; 58 float m_y1; 59 float m_x2; 60 float m_y2; 61 }; 62 63 class SVGPathSegCurvetoCubicAbs : public SVGPathSegCurvetoCubic { 64 public: 65 static PassRefPtr<SVGPathSegCurvetoCubicAbs> create(float x, float y, float x1, float y1, float x2, float y2) 66 { 67 return adoptRef(new SVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2)); 68 } 69 70 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_ABS; } 71 virtual String pathSegTypeAsLetter() const { return "C"; } 72 73 private: 74 SVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2); 75 }; 76 77 class SVGPathSegCurvetoCubicRel : public SVGPathSegCurvetoCubic { 78 public: 79 static PassRefPtr<SVGPathSegCurvetoCubicRel> create(float x, float y, float x1, float y1, float x2, float y2) 80 { 81 return adoptRef(new SVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2)); 82 } 83 84 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_REL; } 85 virtual String pathSegTypeAsLetter() const { return "c"; } 86 87 private: 88 SVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2); 89 }; 90 91 } // namespace WebCore 92 93 #endif // ENABLE(SVG) 94 #endif 95 96 // vim:ts=4:noet 97