#ifndef SVGPaintServer_h
#define SVGPaintServer_h
#if ENABLE(SVG)
#include "SVGResource.h"
#if PLATFORM(CG)
#include <ApplicationServices/ApplicationServices.h>
#endif
#if PLATFORM(QT)
class QPen;
#endif
#if PLATFORM(CG)
typedef Vector<CGFloat> DashArray;
#else
typedef Vector<float> DashArray;
#endif
namespace WebCore {
enum SVGPaintServerType {
SolidPaintServer = 0,
PatternPaintServer = 1,
LinearGradientPaintServer = 2,
RadialGradientPaintServer = 3
};
enum SVGPaintTargetType {
ApplyToFillTargetType = 1,
ApplyToStrokeTargetType = 2
};
class GraphicsContext;
class RenderObject;
class RenderStyle;
class SVGPaintServerSolid;
class SVGPaintServer : public SVGResource {
public:
SVGPaintServer();
virtual ~SVGPaintServer();
virtual SVGResourceType resourceType() const { return PaintServerResourceType; }
virtual SVGPaintServerType type() const = 0;
virtual TextStream& externalRepresentation(TextStream&) const = 0;
virtual void draw(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const;
virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const;
virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*);
static SVGPaintServerSolid* sharedSolidPaintServer();
protected:
#if PLATFORM(CG)
void strokePath(CGContextRef, const RenderObject*) const;
void clipToStrokePath(CGContextRef, const RenderObject*) const;
void fillPath(CGContextRef, const RenderObject*) const;
void clipToFillPath(CGContextRef, const RenderObject*) const;
#endif
#if PLATFORM(QT)
void setPenProperties(const RenderObject*, const RenderStyle*, QPen&) const;
#endif
};
TextStream& operator<<(TextStream&, const SVGPaintServer&);
SVGPaintServer* getPaintServerById(Document*, const AtomicString&);
DashArray dashArrayFromRenderingStyle(const RenderStyle* style);
}
#endif
#endif // SVGPaintServer_h