1 /* 2 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 2004, 2005, 2006 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 SVGPathSegArc_h 24 #define SVGPathSegArc_h 25 26 #if ENABLE(SVG) 27 28 #include "SVGPathSeg.h" 29 30 #include <wtf/PassRefPtr.h> 31 32 namespace WebCore 33 { 34 35 class SVGPathSegArcAbs : public SVGPathSeg 36 { 37 public: create(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag)38 static PassRefPtr<SVGPathSegArcAbs> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 39 { 40 return adoptRef(new SVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); 41 } 42 43 virtual ~SVGPathSegArcAbs(); 44 pathSegType()45 unsigned short pathSegType() const override 46 { 47 return PATHSEG_ARC_ABS; 48 } pathSegTypeAsLetter()49 String pathSegTypeAsLetter() const override 50 { 51 return "A"; 52 } toString()53 String toString() const override 54 { 55 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); 56 } 57 58 void setX(float x); 59 float x() const; 60 61 void setY(float y); 62 float y() const; 63 64 void setR1(float r1); 65 float r1() const; 66 67 void setR2(float r2); 68 float r2() const; 69 70 void setAngle(float angle); 71 float angle() const; 72 73 void setLargeArcFlag(bool largeArcFlag); 74 bool largeArcFlag() const; 75 76 void setSweepFlag(bool sweepFlag); 77 bool sweepFlag() const; 78 79 private: 80 SVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); 81 82 float m_x; 83 float m_y; 84 float m_r1; 85 float m_r2; 86 float m_angle; 87 88 bool m_largeArcFlag : 1; 89 bool m_sweepFlag : 1; 90 }; 91 92 class SVGPathSegArcRel : public SVGPathSeg 93 { 94 public: create(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag)95 static PassRefPtr<SVGPathSegArcRel> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 96 { 97 return adoptRef(new SVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); 98 } 99 virtual ~SVGPathSegArcRel(); 100 pathSegType()101 unsigned short pathSegType() const override 102 { 103 return PATHSEG_ARC_REL; 104 } pathSegTypeAsLetter()105 String pathSegTypeAsLetter() const override 106 { 107 return "a"; 108 } toString()109 String toString() const override 110 { 111 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); 112 } 113 114 void setX(float x); 115 float x() const; 116 117 void setY(float y); 118 float y() const; 119 120 void setR1(float r1); 121 float r1() const; 122 123 void setR2(float r2); 124 float r2() const; 125 126 void setAngle(float angle); 127 float angle() const; 128 129 void setLargeArcFlag(bool largeArcFlag); 130 bool largeArcFlag() const; 131 132 void setSweepFlag(bool sweepFlag); 133 bool sweepFlag() const; 134 135 private: 136 SVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); 137 138 float m_x; 139 float m_y; 140 float m_r1; 141 float m_r2; 142 float m_angle; 143 144 bool m_largeArcFlag : 1; 145 bool m_sweepFlag : 1; 146 }; 147 148 } // namespace WebCore 149 150 #endif // ENABLE(SVG) 151 #endif 152 153