From aa1c0fd3146b4ed055d181c99d52463afa6bedbb Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Fri, 16 Sep 2011 17:47:24 +0200 Subject: Initial import --- watchpaintengine.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 watchpaintengine.h (limited to 'watchpaintengine.h') diff --git a/watchpaintengine.h b/watchpaintengine.h new file mode 100644 index 0000000..59010c0 --- /dev/null +++ b/watchpaintengine.h @@ -0,0 +1,59 @@ +#ifndef WATCHPAINTENGINE_H +#define WATCHPAINTENGINE_H + +#include + +namespace sowatch +{ + +class Watch; + +class WatchPaintEngine : public QPaintEngine +{ +public: + WatchPaintEngine(Watch* watch, QImage* image); + + bool begin(QPaintDevice *pdev); + bool end(); + + void drawEllipse(const QRectF &r); + void drawEllipse(const QRect &r); + void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags); + void drawLines(const QLineF *lines, int lineCount); + void drawLines(const QLine *lines, int lineCount); + void drawPath(const QPainterPath &path); + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); + void drawPoints(const QPointF *points, int pointCount); + void drawPoints(const QPoint *points, int pointCount); + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); + void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); + void drawRects(const QRectF *rects, int rectCount); + void drawRects(const QRect *rects, int rectCount); + void drawTextItem(const QPointF &p, const QTextItem &textItem); + void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + + Type type() const; + void updateState(const QPaintEngineState &state); + +protected: + void damageRect(const QRect& r); + void damageRect(const QRectF& r); + void damagePenStroke(const QLineF& line); + void updateClipRegion(const QRegion& region, Qt::ClipOperation op); + + Watch* _watch; + QPainter _painter; + QRegion _damaged; + + bool _hasPen; + qreal _penWidth; + + bool _hasBrush; + + bool _clipEnabled; + QRegion _clipRegion; +}; + +} + +#endif // WATCHPAINTENGINE_H -- cgit v1.2.3