• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2     Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3                   2004, 2005, 2006, 2008 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 namespace WebCore {
31 
32     class SVGPathSegArc : public SVGPathSeg {
33     public:
SVGPathSegArc(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag)34         SVGPathSegArc(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
35         : m_x(x), m_y(y), m_r1(r1), m_r2(r2), m_angle(angle), m_largeArcFlag(largeArcFlag), m_sweepFlag(sweepFlag) {}
36 
toString()37         virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y); }
38 
setX(float x)39         void setX(float x) { m_x = x; }
x()40         float x() const { return m_x; }
41 
setY(float y)42         void setY(float y) { m_y = y; }
y()43         float y() const { return m_y; }
44 
setR1(float r1)45         void setR1(float r1) { m_r1 = r1; }
r1()46         float r1() const { return m_r1; }
47 
setR2(float r2)48         void setR2(float r2) { m_r2 = r2; }
r2()49         float r2() const { return m_r2; }
50 
setAngle(float angle)51         void setAngle(float angle) { m_angle = angle; }
angle()52         float angle() const { return m_angle; }
53 
setLargeArcFlag(bool largeArcFlag)54         void setLargeArcFlag(bool largeArcFlag) { m_largeArcFlag = largeArcFlag; }
largeArcFlag()55         bool largeArcFlag() const { return m_largeArcFlag; }
56 
setSweepFlag(bool sweepFlag)57         void setSweepFlag(bool sweepFlag) { m_sweepFlag = sweepFlag; }
sweepFlag()58         bool sweepFlag() const { return m_sweepFlag; }
59 
60     private:
61         float m_x;
62         float m_y;
63         float m_r1;
64         float m_r2;
65         float m_angle;
66 
67         bool m_largeArcFlag    : 1;
68         bool m_sweepFlag : 1;
69     };
70 
71     class SVGPathSegArcAbs : public SVGPathSegArc {
72     public:
create(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag)73         static PassRefPtr<SVGPathSegArcAbs> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
74         {
75             return adoptRef(new SVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag));
76         }
77 
pathSegType()78         virtual unsigned short pathSegType() const { return PATHSEG_ARC_ABS; }
pathSegTypeAsLetter()79         virtual String pathSegTypeAsLetter() const { return "A"; }
80 
81     private:
82         SVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
83     };
84 
85     class SVGPathSegArcRel : public SVGPathSegArc {
86     public:
create(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag)87         static PassRefPtr<SVGPathSegArcRel> create(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
88         {
89             return adoptRef(new SVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag));
90         }
91 
pathSegType()92         virtual unsigned short pathSegType() const { return PATHSEG_ARC_REL; }
pathSegTypeAsLetter()93         virtual String pathSegTypeAsLetter() const { return "a"; }
94 
95     private:
96         SVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
97     };
98 
99 } // namespace WebCore
100 
101 #endif // ENABLE(SVG)
102 #endif
103 
104 // vim:ts=4:noet
105