KHTML
SVGPathSegArc.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005, 2006 Rob Buis <buis@kde.org> 00004 00005 This file is part of the KDE project 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef SVGPathSegArc_h 00024 #define SVGPathSegArc_h 00025 00026 #if ENABLE(SVG) 00027 00028 #include "SVGPathSeg.h" 00029 00030 #include <wtf/PassRefPtr.h> 00031 00032 namespace WebCore { 00033 00034 class SVGPathSegArcAbs : public SVGPathSeg { 00035 public: 00036 static PassRefPtr<SVGPathSegArcAbs> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 00037 { 00038 return adoptRef(new SVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); 00039 } 00040 00041 virtual ~SVGPathSegArcAbs(); 00042 00043 virtual unsigned short pathSegType() const { return PATHSEG_ARC_ABS; } 00044 virtual String pathSegTypeAsLetter() const { return "A"; } 00045 virtual String toString() const { 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); } 00046 00047 void setX(float x); 00048 float x() const; 00049 00050 void setY(float y); 00051 float y() const; 00052 00053 void setR1(float r1); 00054 float r1() const; 00055 00056 void setR2(float r2); 00057 float r2() const; 00058 00059 void setAngle(float angle); 00060 float angle() const; 00061 00062 void setLargeArcFlag(bool largeArcFlag); 00063 bool largeArcFlag() const; 00064 00065 void setSweepFlag(bool sweepFlag); 00066 bool sweepFlag() const; 00067 00068 private: 00069 SVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); 00070 00071 float m_x; 00072 float m_y; 00073 float m_r1; 00074 float m_r2; 00075 float m_angle; 00076 00077 bool m_largeArcFlag : 1; 00078 bool m_sweepFlag : 1; 00079 }; 00080 00081 class SVGPathSegArcRel : public SVGPathSeg { 00082 public: 00083 static PassRefPtr<SVGPathSegArcRel> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 00084 { 00085 return adoptRef(new SVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); 00086 } 00087 virtual ~SVGPathSegArcRel(); 00088 00089 virtual unsigned short pathSegType() const { return PATHSEG_ARC_REL; } 00090 virtual String pathSegTypeAsLetter() const { return "a"; } 00091 virtual String toString() const { 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); } 00092 00093 void setX(float x); 00094 float x() const; 00095 00096 void setY(float y); 00097 float y() const; 00098 00099 void setR1(float r1); 00100 float r1() const; 00101 00102 void setR2(float r2); 00103 float r2() const; 00104 00105 void setAngle(float angle); 00106 float angle() const; 00107 00108 void setLargeArcFlag(bool largeArcFlag); 00109 bool largeArcFlag() const; 00110 00111 void setSweepFlag(bool sweepFlag); 00112 bool sweepFlag() const; 00113 00114 private: 00115 SVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); 00116 00117 float m_x; 00118 float m_y; 00119 float m_r1; 00120 float m_r2; 00121 float m_angle; 00122 00123 bool m_largeArcFlag : 1; 00124 bool m_sweepFlag : 1; 00125 }; 00126 00127 } // namespace WebCore 00128 00129 #endif // ENABLE(SVG) 00130 #endif 00131 00132 // vim:ts=4:noet
KDE 4.6 API Reference