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 SVGPathSegArc_h
0024 #define SVGPathSegArc_h
0025 
0026 #if ENABLE(SVG)
0027 
0028 #include "SVGPathSeg.h"
0029 
0030 #include <wtf/PassRefPtr.h>
0031 
0032 namespace WebCore
0033 {
0034 
0035 class SVGPathSegArcAbs : public SVGPathSeg
0036 {
0037 public:
0038     static PassRefPtr<SVGPathSegArcAbs> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
0039     {
0040         return adoptRef(new SVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag));
0041     }
0042 
0043     virtual ~SVGPathSegArcAbs();
0044 
0045     unsigned short pathSegType() const override
0046     {
0047         return PATHSEG_ARC_ABS;
0048     }
0049     String pathSegTypeAsLetter() const override
0050     {
0051         return "A";
0052     }
0053     String toString() const override
0054     {
0055         return String::format("A %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y);
0056     }
0057 
0058     void setX(float x);
0059     float x() const;
0060 
0061     void setY(float y);
0062     float y() const;
0063 
0064     void setR1(float r1);
0065     float r1() const;
0066 
0067     void setR2(float r2);
0068     float r2() const;
0069 
0070     void setAngle(float angle);
0071     float angle() const;
0072 
0073     void setLargeArcFlag(bool largeArcFlag);
0074     bool largeArcFlag() const;
0075 
0076     void setSweepFlag(bool sweepFlag);
0077     bool sweepFlag() const;
0078 
0079 private:
0080     SVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
0081 
0082     float m_x;
0083     float m_y;
0084     float m_r1;
0085     float m_r2;
0086     float m_angle;
0087 
0088     bool m_largeArcFlag    : 1;
0089     bool m_sweepFlag : 1;
0090 };
0091 
0092 class SVGPathSegArcRel : public SVGPathSeg
0093 {
0094 public:
0095     static PassRefPtr<SVGPathSegArcRel> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
0096     {
0097         return adoptRef(new SVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag));
0098     }
0099     virtual ~SVGPathSegArcRel();
0100 
0101     unsigned short pathSegType() const override
0102     {
0103         return PATHSEG_ARC_REL;
0104     }
0105     String pathSegTypeAsLetter() const override
0106     {
0107         return "a";
0108     }
0109     String toString() const override
0110     {
0111         return String::format("a %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y);
0112     }
0113 
0114     void setX(float x);
0115     float x() const;
0116 
0117     void setY(float y);
0118     float y() const;
0119 
0120     void setR1(float r1);
0121     float r1() const;
0122 
0123     void setR2(float r2);
0124     float r2() const;
0125 
0126     void setAngle(float angle);
0127     float angle() const;
0128 
0129     void setLargeArcFlag(bool largeArcFlag);
0130     bool largeArcFlag() const;
0131 
0132     void setSweepFlag(bool sweepFlag);
0133     bool sweepFlag() const;
0134 
0135 private:
0136     SVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
0137 
0138     float m_x;
0139     float m_y;
0140     float m_r1;
0141     float m_r2;
0142     float m_angle;
0143 
0144     bool m_largeArcFlag : 1;
0145     bool m_sweepFlag : 1;
0146 };
0147 
0148 } // namespace WebCore
0149 
0150 #endif // ENABLE(SVG)
0151 #endif
0152