File indexing completed on 2024-04-28 15:24:39

0001 /*
0002     Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
0003                   2004, 2005, 2006 Rob Buis <buis@kde.org>
0004 
0005     This file is part of the KDE project
0006 
0007     This library is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU Library General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Library General Public License for more details.
0016 
0017     You should have received a copy of the GNU Library General Public License
0018     along with this library; see the file COPYING.LIB.  If not, write to
0019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020     Boston, MA 02110-1301, USA.
0021 */
0022 
0023 #ifndef SVGPathSegCurvetoCubic_h
0024 #define SVGPathSegCurvetoCubic_h
0025 
0026 #if ENABLE(SVG)
0027 
0028 #include "SVGPathSeg.h"
0029 
0030 namespace WebCore
0031 {
0032 class SVGPathSegCurvetoCubicAbs : public SVGPathSeg
0033 {
0034 public:
0035     static PassRefPtr<SVGPathSegCurvetoCubicAbs> create(float x, float y, float x1, float y1, float x2, float y2)
0036     {
0037         return adoptRef(new SVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2));
0038     }
0039 
0040     virtual ~SVGPathSegCurvetoCubicAbs();
0041 
0042     unsigned short pathSegType() const override
0043     {
0044         return PATHSEG_CURVETO_CUBIC_ABS;
0045     }
0046     String pathSegTypeAsLetter() const override
0047     {
0048         return "C";
0049     }
0050     String toString() const override
0051     {
0052         return String::format("C %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y);
0053     }
0054 
0055     void setX(float);
0056     float x() const;
0057 
0058     void setY(float);
0059     float y() const;
0060 
0061     void setX1(float);
0062     float x1() const;
0063 
0064     void setY1(float);
0065     float y1() const;
0066 
0067     void setX2(float);
0068     float x2() const;
0069 
0070     void setY2(float);
0071     float y2() const;
0072 
0073 private:
0074     SVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2);
0075 
0076     float m_x;
0077     float m_y;
0078     float m_x1;
0079     float m_y1;
0080     float m_x2;
0081     float m_y2;
0082 };
0083 
0084 class SVGPathSegCurvetoCubicRel : public SVGPathSeg
0085 {
0086 public:
0087     static PassRefPtr<SVGPathSegCurvetoCubicRel> create(float x, float y, float x1, float y1, float x2, float y2)
0088     {
0089         return adoptRef(new SVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2));
0090     }
0091     virtual ~SVGPathSegCurvetoCubicRel();
0092 
0093     unsigned short pathSegType() const override
0094     {
0095         return PATHSEG_CURVETO_CUBIC_REL;
0096     }
0097     String pathSegTypeAsLetter() const override
0098     {
0099         return "c";
0100     }
0101     String toString() const override
0102     {
0103         return String::format("c %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y);
0104     }
0105 
0106     void setX(float);
0107     float x() const;
0108 
0109     void setY(float);
0110     float y() const;
0111 
0112     void setX1(float);
0113     float x1() const;
0114 
0115     void setY1(float);
0116     float y1() const;
0117 
0118     void setX2(float);
0119     float x2() const;
0120 
0121     void setY2(float);
0122     float y2() const;
0123 
0124 private:
0125     SVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2);
0126 
0127     float m_x;
0128     float m_y;
0129     float m_x1;
0130     float m_y1;
0131     float m_x2;
0132     float m_y2;
0133 };
0134 
0135 } // namespace WebCore
0136 
0137 #endif // ENABLE(SVG)
0138 #endif
0139