00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00104 virtual quint32 id() const;
00105 virtual DOMString tagName() const;
00106
00107 protected:
00108 virtual const SVGElement* contextElement() const { return this; }
00109
00110 private:
00111 mutable RefPtr<SVGPathSegList> m_pathSegList;
00112
00113 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
00114
00115 ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement, float, float, PathLength, pathLength)
00116 };
00117
00118 }
00119
00120 #endif // ENABLE(SVG)
00121 #endif