KHTML
SVGPaintServer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SVGPaintServer_h
00027 #define SVGPaintServer_h
00028
00029 #if ENABLE(SVG)
00030
00031 #include "SVGResource.h"
00032
00033 #include "RenderObject.h"
00034 #include "RenderStyle.h"
00035
00036 #if PLATFORM(CG)
00037 #include <ApplicationServices/ApplicationServices.h>
00038 #endif
00039
00040 #if PLATFORM(QT)
00041 #include <qglobal.h>
00042 QT_BEGIN_NAMESPACE
00043 class QPen;
00044 QT_END_NAMESPACE
00045 #endif
00046
00047 #if PLATFORM(CG)
00048 typedef Vector<CGFloat> DashArray;
00049 #else
00050 typedef Vector<float> DashArray;
00051 #endif
00052
00053 namespace WebCore {
00054
00055 enum SVGPaintServerType {
00056
00057 SolidPaintServer = 0,
00058 PatternPaintServer = 1,
00059 LinearGradientPaintServer = 2,
00060 RadialGradientPaintServer = 3
00061 };
00062
00063 enum SVGPaintTargetType {
00064
00065 ApplyToFillTargetType = 1,
00066 ApplyToStrokeTargetType = 2
00067 };
00068
00069
00070
00071
00072 class SVGPaintServerSolid;
00073
00074 class SVGPaintServer : public SVGResource {
00075 public:
00076 virtual ~SVGPaintServer();
00077
00078 virtual SVGResourceType resourceType() const { return PaintServerResourceType; }
00079
00080 virtual SVGPaintServerType type() const = 0;
00081
00082
00083
00084 virtual void draw(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType) const;
00085 virtual void teardown(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
00086 virtual void renderPath(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType) const;
00087
00088 virtual bool setup(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
00089
00090 static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
00091 static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*);
00092 static SVGPaintServerSolid* sharedSolidPaintServer();
00093
00094 protected:
00095 #if PLATFORM(CG)
00096 void strokePath(CGContextRef, const RenderObject*) const;
00097 void clipToStrokePath(CGContextRef, const RenderObject*) const;
00098 void fillPath(CGContextRef, const RenderObject*) const;
00099 void clipToFillPath(CGContextRef, const RenderObject*) const;
00100 #endif
00101
00102 #if PLATFORM(QT)
00103 void setPenProperties(const RenderObject*, const RenderStyle*, QPen&) const;
00104 #endif
00105 protected:
00106 SVGPaintServer();
00107 };
00108
00109
00110
00111 SVGPaintServer* getPaintServerById(Document*, const AtomicString&);
00112
00113 DashArray dashArrayFromRenderingStyle(const RenderStyle* style);
00114 }
00115
00116 #endif
00117
00118 #endif // SVGPaintServer_h