00001 00023 #ifndef LCDPAINTENGINE_H 00024 #define LCDPAINTENGINE_H 00025 00026 #include <QPaintDevice> 00027 #include <QPaintEngine> 00028 00029 #include "module_interface.h" 00030 00032 00040 class LCDPaintEngine : public QPaintEngine 00041 { 00042 public: 00043 bool begin(QPaintDevice*); 00044 void drawEllipse(const QRectF&); 00045 void drawEllipse(const QRect&); 00046 void drawImage(const QRectF&, const QImage&, const QRectF &, Qt::ImageConversionFlags flags = Qt::AutoColor ); 00047 void drawLines(const QLineF*, int); 00048 void drawLines(const QLine*, int); 00049 void drawPath(const QPainterPath&); 00050 void drawPixmap(const QRectF&, const QPixmap&, const QRectF&); 00051 void drawPoints(const QPointF*, int); 00052 void drawPoints(const QPoint*, int); 00053 void drawPolygon(const QPointF*, int, QPaintEngine::PolygonDrawMode); 00054 void drawPolygon(const QPoint*, int, QPaintEngine::PolygonDrawMode); 00055 void drawRects(const QRectF*, int); 00056 void drawRects(const QRect*, int); 00057 void drawTextItem(const QPointF&, const QTextItem&); 00058 void drawTiledPixmap(const QRectF&, const QPixmap&, const QPointF); 00059 bool end(); 00060 bool hasFeature(PaintEngineFeatures) const; 00061 QPaintEngine::Type type() const; 00062 void updateState(const QPaintEngineState&); 00063 00064 private: 00065 ControllerInterface* m_controller; 00066 QMatrix m_matrix; 00067 QBrush m_brush; 00068 QPen m_pen; 00069 }; 00070 00072 00093 class LCDPaintDevice : public QPaintDevice 00094 { 00095 public: 00096 inline int width() const { return metric(PdmWidth); } 00097 inline int height() const { return metric(PdmHeight); } 00098 inline int widthMM() const { return metric(PdmWidthMM); } 00099 inline int heightMM() const { return metric(PdmHeightMM); } 00100 inline int logicalDpiX() const { return metric(PdmDpiX); } 00101 inline int logicalDpiY() const { return metric(PdmDpiY); } 00102 inline int physicalDpiX() const { return metric(PdmPhysicalDpiX); } 00103 inline int physicalDpiY() const { return metric(PdmPhysicalDpiY); } 00104 inline int numColors() const { return metric(PdmNumColors); } 00105 inline int depth() const { return metric(PdmDepth); } 00106 QPaintEngine* paintEngine() const; 00107 00108 void setSize(int, int); 00109 void setController(ControllerInterface*); 00110 static bool isControllerInit(); 00111 static ControllerInterface* controller(); 00112 00113 protected: 00114 int metric ( PaintDeviceMetric metric ) const; 00115 00116 private: 00117 static ControllerInterface* m_controller; 00118 static QSize m_size; 00119 }; 00120 #endif