Home | History | Annotate | Download | only in svg
      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 SVGPathSegCurvetoCubicSmooth_h
     22 #define SVGPathSegCurvetoCubicSmooth_h
     23 
     24 #if ENABLE(SVG)
     25 
     26 #include "SVGPathSeg.h"
     27 
     28 namespace WebCore {
     29 
     30     class SVGPathSegCurvetoCubicSmooth : public SVGPathSeg {
     31     public:
     32         SVGPathSegCurvetoCubicSmooth(float x, float y, float x2, float y2)
     33         : m_x(x), m_y(y), m_x2(x2), m_y2(y2) { }
     34 
     35         virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, 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 setX2(float x2) { m_x2 = x2; }
     44         float x2() const { return m_x2; }
     45 
     46         void setY2(float y2) { m_y2 = y2; }
     47         float y2() const { return m_y2; }
     48 
     49     private:
     50         float m_x;
     51         float m_y;
     52         float m_x2;
     53         float m_y2;
     54     };
     55 
     56     class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSegCurvetoCubicSmooth {
     57     public:
     58         static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> create(float x, float y, float x2, float y2) { return adoptRef(new SVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2)); }
     59 
     60         virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; }
     61         virtual String pathSegTypeAsLetter() const { return "S"; }
     62 
     63     private:
     64         SVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2);
     65     };
     66 
     67     class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSegCurvetoCubicSmooth {
     68     public:
     69         static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> create(float x, float y, float x2, float y2) { return adoptRef(new SVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2)); }
     70 
     71         virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_REL; }
     72         virtual String pathSegTypeAsLetter() const { return "s"; }
     73 
     74     private:
     75         SVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2);
     76     };
     77 
     78 } // namespace WebCore
     79 
     80 #endif // ENABLE(SVG)
     81 #endif
     82 
     83 // vim:ts=4:noet
     84