#ifndef CanvasPattern_h
#define CanvasPattern_h
#include "CachedResourceClient.h"
#include <wtf/RefCounted.h>
#if PLATFORM(CG)
#include <wtf/RetainPtr.h>
#include <ApplicationServices/ApplicationServices.h>
#elif PLATFORM(CAIRO)
#include <cairo.h>
#endif
namespace WebCore {
class CachedImage;
class String;
typedef int ExceptionCode;
class CanvasPattern : public RefCounted<CanvasPattern>, CachedResourceClient {
public:
static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&);
#if PLATFORM(CG)
CanvasPattern(CGImageRef, bool repeatX, bool repeatY);
#elif PLATFORM(CAIRO)
CanvasPattern(cairo_surface_t*, bool repeatX, bool repeatY);
#endif
CanvasPattern(CachedImage*, bool repeatX, bool repeatY);
~CanvasPattern();
#if PLATFORM(CG)
CGImageRef platformImage() const { return m_platformImage.get(); }
#elif PLATFORM(CAIRO)
cairo_surface_t* platformImage() const { return m_platformImage; }
#endif
CachedImage* cachedImage() const { return m_cachedImage; }
#if PLATFORM(CG)
CGPatternRef createPattern(const CGAffineTransform&);
#elif PLATFORM(CAIRO)
cairo_pattern_t* createPattern(const cairo_matrix_t&);
#endif
private:
#if PLATFORM(CG)
const RetainPtr<CGImageRef> m_platformImage;
#elif PLATFORM(CAIRO)
cairo_surface_t* const m_platformImage;
#endif
CachedImage* const m_cachedImage;
const bool m_repeatX;
const bool m_repeatY;
};
}
#endif