KHTML
SVGPathElement.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005, 2006, 2007 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 SVGPathElement_h 00024 #define SVGPathElement_h 00025 00026 #if ENABLE(SVG) 00027 #include "SVGAnimatedPathData.h" 00028 #include "SVGExternalResourcesRequired.h" 00029 #include "SVGLangSpace.h" 00030 #include "SVGStyledTransformableElement.h" 00031 #include "SVGTests.h" 00032 00033 namespace WebCore { 00034 00035 class SVGPathSeg; 00036 class SVGPathSegArcAbs; 00037 class SVGPathSegArcRel; 00038 class SVGPathSegClosePath; 00039 class SVGPathSegLinetoAbs; 00040 class SVGPathSegLinetoRel; 00041 class SVGPathSegMovetoAbs; 00042 class SVGPathSegMovetoRel; 00043 class SVGPathSegCurvetoCubicAbs; 00044 class SVGPathSegCurvetoCubicRel; 00045 class SVGPathSegLinetoVerticalAbs; 00046 class SVGPathSegLinetoVerticalRel; 00047 class SVGPathSegLinetoHorizontalAbs; 00048 class SVGPathSegLinetoHorizontalRel; 00049 class SVGPathSegCurvetoQuadraticAbs; 00050 class SVGPathSegCurvetoQuadraticRel; 00051 class SVGPathSegCurvetoCubicSmoothAbs; 00052 class SVGPathSegCurvetoCubicSmoothRel; 00053 class SVGPathSegCurvetoQuadraticSmoothAbs; 00054 class SVGPathSegCurvetoQuadraticSmoothRel; 00055 class SVGPathElement : public SVGStyledTransformableElement, 00056 public SVGTests, 00057 public SVGLangSpace, 00058 public SVGExternalResourcesRequired, 00059 public SVGAnimatedPathData 00060 { 00061 public: 00062 SVGPathElement(const QualifiedName&, Document*); 00063 virtual ~SVGPathElement(); 00064 00065 virtual bool isValid() const { return SVGTests::isValid(); } 00066 float getTotalLength(); 00067 FloatPoint getPointAtLength(float distance); 00068 unsigned long getPathSegAtLength(float distance); 00069 00070 static PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath(); 00071 static PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y); 00072 static PassRefPtr<SVGPathSegMovetoRel> createSVGPathSegMovetoRel(float x, float y); 00073 static PassRefPtr<SVGPathSegLinetoAbs> createSVGPathSegLinetoAbs(float x, float y); 00074 static PassRefPtr<SVGPathSegLinetoRel> createSVGPathSegLinetoRel(float x, float y); 00075 static PassRefPtr<SVGPathSegCurvetoCubicAbs> createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2); 00076 static PassRefPtr<SVGPathSegCurvetoCubicRel> createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2); 00077 static PassRefPtr<SVGPathSegCurvetoQuadraticAbs> createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1); 00078 static PassRefPtr<SVGPathSegCurvetoQuadraticRel> createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1); 00079 static PassRefPtr<SVGPathSegArcAbs> createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); 00080 static PassRefPtr<SVGPathSegArcRel> createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); 00081 static PassRefPtr<SVGPathSegLinetoHorizontalAbs> createSVGPathSegLinetoHorizontalAbs(float x); 00082 static PassRefPtr<SVGPathSegLinetoHorizontalRel> createSVGPathSegLinetoHorizontalRel(float x); 00083 static PassRefPtr<SVGPathSegLinetoVerticalAbs> createSVGPathSegLinetoVerticalAbs(float y); 00084 static PassRefPtr<SVGPathSegLinetoVerticalRel> createSVGPathSegLinetoVerticalRel(float y); 00085 static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2); 00086 static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2); 00087 static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothAbs> createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y); 00088 static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y); 00089 00090 // Derived from: 'SVGAnimatedPathData' 00091 virtual SVGPathSegList* pathSegList() const; 00092 virtual SVGPathSegList* normalizedPathSegList() const; 00093 virtual SVGPathSegList* animatedPathSegList() const; 00094 virtual SVGPathSegList* animatedNormalizedPathSegList() const; 00095 00096 virtual void parseMappedAttribute(MappedAttribute*); 00097 virtual void svgAttributeChanged(const QualifiedName&); 00098 00099 virtual Path toPathData() const; 00100 00101 virtual bool supportsMarkers() const { return true; } 00102 00103 // KHTML ElementImpl pure virtual method 00104 virtual quint32 id() const; 00105 protected: 00106 virtual const SVGElement* contextElement() const { return this; } 00107 00108 private: 00109 mutable RefPtr<SVGPathSegList> m_pathSegList; 00110 00111 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 00112 00113 ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement, float, float, PathLength, pathLength) 00114 }; 00115 00116 } // namespace WebCore 00117 00118 #endif // ENABLE(SVG) 00119 #endif
KDE 4.6 API Reference