summaryrefslogtreecommitdiff
path: root/libsowatch/watchpaintengine.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-17 03:03:23 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-17 03:03:23 +0200
commit3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1 (patch)
treef330f63caec08b6626c808b5ae70c64cab0246a6 /libsowatch/watchpaintengine.h
parent0dca79a8c15b76ca53617c0ed3396ab6435f0152 (diff)
downloadsowatch-3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1.tar.gz
sowatch-3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1.zip
preparing for library package
Diffstat (limited to 'libsowatch/watchpaintengine.h')
-rw-r--r--libsowatch/watchpaintengine.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/libsowatch/watchpaintengine.h b/libsowatch/watchpaintengine.h
new file mode 100644
index 0000000..14181fa
--- /dev/null
+++ b/libsowatch/watchpaintengine.h
@@ -0,0 +1,62 @@
+#ifndef WATCHPAINTENGINE_H
+#define WATCHPAINTENGINE_H
+
+#include <QtGui/QPaintEngine>
+
+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 damageMappedRect(const QRect& r);
+ 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;
+
+ QTransform _transform;
+};
+
+}
+
+#endif // WATCHPAINTENGINE_H