1 /* 2 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 5 This file is part of the KDE project 6 7 This library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Library General Public 9 License as published by the Free Software Foundation; either 10 version 2 of the License, or (at your option) any later version. 11 12 This library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Library General Public License for more details. 16 17 You should have received a copy of the GNU Library General Public License 18 along with this library; see the file COPYING.LIB. If not, write to 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef SVGPathSegCurvetoCubicSmooth_h 24 #define SVGPathSegCurvetoCubicSmooth_h 25 26 #if ENABLE(SVG) 27 28 #include "SVGPathSeg.h" 29 30 namespace WebCore { 31 32 class SVGPathSegCurvetoCubicSmooth : public SVGPathSeg { 33 public: SVGPathSegCurvetoCubicSmooth(float x,float y,float x2,float y2)34 SVGPathSegCurvetoCubicSmooth(float x, float y, float x2, float y2) 35 : m_x(x), m_y(y), m_x2(x2), m_y2(y2) { } 36 toString()37 virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, m_x, m_y); } 38 setX(float x)39 void setX(float x) { m_x = x; } x()40 float x() const { return m_x; } 41 setY(float y)42 void setY(float y) { m_y = y; } y()43 float y() const { return m_y; } 44 setX2(float x2)45 void setX2(float x2) { m_x2 = x2; } x2()46 float x2() const { return m_x2; } 47 setY2(float y2)48 void setY2(float y2) { m_y2 = y2; } y2()49 float y2() const { return m_y2; } 50 51 private: 52 float m_x; 53 float m_y; 54 float m_x2; 55 float m_y2; 56 }; 57 58 class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSegCurvetoCubicSmooth { 59 public: create(float x,float y,float x2,float y2)60 static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> create(float x, float y, float x2, float y2) { return adoptRef(new SVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2)); } 61 pathSegType()62 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; } pathSegTypeAsLetter()63 virtual String pathSegTypeAsLetter() const { return "S"; } 64 65 private: 66 SVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2); 67 }; 68 69 class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSegCurvetoCubicSmooth { 70 public: create(float x,float y,float x2,float y2)71 static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> create(float x, float y, float x2, float y2) { return adoptRef(new SVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2)); } 72 pathSegType()73 virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_REL; } pathSegTypeAsLetter()74 virtual String pathSegTypeAsLetter() const { return "s"; } 75 76 private: 77 SVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2); 78 }; 79 80 } // namespace WebCore 81 82 #endif // ENABLE(SVG) 83 #endif 84 85 // vim:ts=4:noet 86