CrossfadeGeneratedImage.h [plain text]
#ifndef CrossfadeGeneratedImage_h
#define CrossfadeGeneratedImage_h
#include "GeneratedImage.h"
#include "Image.h"
#include "ImageObserver.h"
#include "IntSize.h"
#include <wtf/RefPtr.h>
namespace WebCore {
class CSSCrossfadeValue;
class CrossfadeGeneratedImage : public GeneratedImage {
public:
static PassRefPtr<CrossfadeGeneratedImage> create(Image* fromImage, Image* toImage, float percentage, IntSize crossfadeSize, const IntSize& size)
{
return adoptRef(new CrossfadeGeneratedImage(fromImage, toImage, percentage, crossfadeSize, size));
}
virtual void setContainerSize(const IntSize&) { }
virtual bool usesContainerSize() const { return false; }
virtual bool hasRelativeWidth() const { return false; }
virtual bool hasRelativeHeight() const { return false; }
virtual IntSize size() const { return m_crossfadeSize; }
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode);
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode);
CrossfadeGeneratedImage(Image* fromImage, Image* toImage, float percentage, IntSize crossfadeSize, const IntSize&);
private:
void drawCrossfade(GraphicsContext*);
Image* m_fromImage;
Image* m_toImage;
float m_percentage;
IntSize m_crossfadeSize;
};
}
#endif