SVGPaintServerGradient.h [plain text]
#ifndef SVGPaintServerGradient_h
#define SVGPaintServerGradient_h
#if ENABLE(SVG)
#include "TransformationMatrix.h"
#include "Color.h"
#include "Gradient.h"
#include "GraphicsContext.h"
#include "SVGPaintServer.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class ImageBuffer;
class SVGGradientElement;
typedef std::pair<float, Color> SVGGradientStop;
class SVGPaintServerGradient : public SVGPaintServer {
public:
virtual ~SVGPaintServerGradient();
void setGradient(PassRefPtr<Gradient>);
Gradient* gradient() const;
bool boundingBoxMode() const;
void setBoundingBoxMode(bool mode = true);
TransformationMatrix gradientTransform() const;
void setGradientTransform(const TransformationMatrix&);
void setGradientStops(const Vector<SVGGradientStop>& stops) { m_stops = stops; }
const Vector<SVGGradientStop>& gradientStops() const { return m_stops; }
virtual TextStream& externalRepresentation(TextStream&) const;
virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
protected:
SVGPaintServerGradient(const SVGGradientElement* owner);
private:
Vector<SVGGradientStop> m_stops;
RefPtr<Gradient> m_gradient;
bool m_boundingBoxMode;
TransformationMatrix m_gradientTransform;
const SVGGradientElement* m_ownerElement;
#if PLATFORM(CG)
public:
mutable GraphicsContext* m_savedContext;
mutable OwnPtr<ImageBuffer> m_imageBuffer;
#endif
};
inline SVGGradientStop makeGradientStop(float offset, const Color& color)
{
return std::make_pair(offset, color);
}
}
#endif
#endif // SVGPaintServerGradient_h