#ifndef CrossfadeGeneratedImage_h
#define CrossfadeGeneratedImage_h
#include "platform/geometry/IntSize.h"
#include "platform/graphics/GeneratedImage.h"
#include "platform/graphics/Image.h"
#include "platform/graphics/ImageObserver.h"
#include "wtf/RefPtr.h"
namespace WebCore {
class CSSCrossfadeValue;
class PLATFORM_EXPORT 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&) OVERRIDE { }
virtual bool usesContainerSize() const OVERRIDE { return false; }
virtual bool hasRelativeWidth() const OVERRIDE { return false; }
virtual bool hasRelativeHeight() const OVERRIDE { return false; }
virtual IntSize size() const OVERRIDE { return m_crossfadeSize; }
protected:
virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&,
CompositeOperator, blink::WebBlendMode) OVERRIDE;
virtual void drawPattern(GraphicsContext*, const FloatRect&,
const FloatSize&, const FloatPoint&, CompositeOperator,
const FloatRect&, blink::WebBlendMode, const IntSize& repeatSpacing) OVERRIDE;
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