KHtml

SVGPathElement.h
1 /*
2  Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2006, 2007 Rob Buis <[email protected]>
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 SVGPathElement_h
24 #define SVGPathElement_h
25 
26 #if ENABLE(SVG)
27 #include "SVGAnimatedPathData.h"
28 #include "SVGExternalResourcesRequired.h"
29 #include "SVGLangSpace.h"
30 #include "SVGStyledTransformableElement.h"
31 #include "SVGTests.h"
32 
33 namespace WebCore
34 {
35 
36 class SVGPathSeg;
37 class SVGPathSegArcAbs;
38 class SVGPathSegArcRel;
39 class SVGPathSegClosePath;
40 class SVGPathSegLinetoAbs;
41 class SVGPathSegLinetoRel;
42 class SVGPathSegMovetoAbs;
43 class SVGPathSegMovetoRel;
44 class SVGPathSegCurvetoCubicAbs;
45 class SVGPathSegCurvetoCubicRel;
46 class SVGPathSegLinetoVerticalAbs;
47 class SVGPathSegLinetoVerticalRel;
48 class SVGPathSegLinetoHorizontalAbs;
49 class SVGPathSegLinetoHorizontalRel;
50 class SVGPathSegCurvetoQuadraticAbs;
51 class SVGPathSegCurvetoQuadraticRel;
52 class SVGPathSegCurvetoCubicSmoothAbs;
53 class SVGPathSegCurvetoCubicSmoothRel;
54 class SVGPathSegCurvetoQuadraticSmoothAbs;
55 class SVGPathSegCurvetoQuadraticSmoothRel;
56 class SVGPathElement : public SVGStyledTransformableElement,
57  public SVGTests,
58  public SVGLangSpace,
59  public SVGExternalResourcesRequired,
60  public SVGAnimatedPathData
61 {
62 public:
63  SVGPathElement(const QualifiedName &, Document *);
64  virtual ~SVGPathElement();
65 
66  bool isValid() const override
67  {
68  return SVGTests::isValid();
69  }
70  float getTotalLength();
71  FloatPoint getPointAtLength(float distance);
72  unsigned long getPathSegAtLength(float distance);
73 
74  static PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath();
75  static PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y);
76  static PassRefPtr<SVGPathSegMovetoRel> createSVGPathSegMovetoRel(float x, float y);
77  static PassRefPtr<SVGPathSegLinetoAbs> createSVGPathSegLinetoAbs(float x, float y);
78  static PassRefPtr<SVGPathSegLinetoRel> createSVGPathSegLinetoRel(float x, float y);
79  static PassRefPtr<SVGPathSegCurvetoCubicAbs> createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2);
80  static PassRefPtr<SVGPathSegCurvetoCubicRel> createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2);
81  static PassRefPtr<SVGPathSegCurvetoQuadraticAbs> createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1);
82  static PassRefPtr<SVGPathSegCurvetoQuadraticRel> createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1);
83  static PassRefPtr<SVGPathSegArcAbs> createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
84  static PassRefPtr<SVGPathSegArcRel> createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
85  static PassRefPtr<SVGPathSegLinetoHorizontalAbs> createSVGPathSegLinetoHorizontalAbs(float x);
86  static PassRefPtr<SVGPathSegLinetoHorizontalRel> createSVGPathSegLinetoHorizontalRel(float x);
87  static PassRefPtr<SVGPathSegLinetoVerticalAbs> createSVGPathSegLinetoVerticalAbs(float y);
88  static PassRefPtr<SVGPathSegLinetoVerticalRel> createSVGPathSegLinetoVerticalRel(float y);
89  static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2);
90  static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2);
91  static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothAbs> createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y);
92  static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y);
93 
94  // Derived from: 'SVGAnimatedPathData'
95  SVGPathSegList *pathSegList() const override;
96  SVGPathSegList *normalizedPathSegList() const override;
97  SVGPathSegList *animatedPathSegList() const override;
98  SVGPathSegList *animatedNormalizedPathSegList() const override;
99 
100  void parseMappedAttribute(MappedAttribute *) override;
101  void svgAttributeChanged(const QualifiedName &) override;
102 
103  Path toPathData() const override;
104 
105  bool supportsMarkers() const override
106  {
107  return true;
108  }
109 
110  // KHTML ElementImpl pure virtual method
111  quint32 id() const override;
112 protected:
113  const SVGElement *contextElement() const override
114  {
115  return this;
116  }
117 
118 private:
119  mutable RefPtr<SVGPathSegList> m_pathSegList;
120 
121  ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
122 
123  ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement, float, float, PathLength, pathLength)
124 };
125 
126 } // namespace WebCore
127 
128 #endif // ENABLE(SVG)
129 #endif
bool isValid(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.