Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PLOT_RASTERITEM_H
00011 #define QWT_PLOT_RASTERITEM_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_plot_item.h"
00015 #include "qwt_interval.h"
00016 #include <qglobal.h>
00017 #include <qstring.h>
00018 #include <qimage.h>
00019
00037 class QWT_EXPORT QwtPlotRasterItem: public QwtPlotItem
00038 {
00039 public:
00044 enum CachePolicy
00045 {
00049 NoCache,
00050
00059 PaintCache
00060 };
00061
00066 enum PaintAttribute
00067 {
00080 PaintInDeviceResolution = 1
00081 };
00082
00084 typedef QFlags<PaintAttribute> PaintAttributes;
00085
00086 explicit QwtPlotRasterItem( const QString& title = QString::null );
00087 explicit QwtPlotRasterItem( const QwtText& title );
00088 virtual ~QwtPlotRasterItem();
00089
00090 void setPaintAttribute( PaintAttribute, bool on = true );
00091 bool testPaintAttribute( PaintAttribute ) const;
00092
00093 void setAlpha( int alpha );
00094 int alpha() const;
00095
00096 void setCachePolicy( CachePolicy );
00097 CachePolicy cachePolicy() const;
00098
00099 void invalidateCache();
00100
00101 virtual void draw( QPainter *p,
00102 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00103 const QRectF &rect ) const;
00104
00105 virtual QRectF pixelHint( const QRectF & ) const;
00106
00107 virtual QwtInterval interval(Qt::Axis) const;
00108 virtual QRectF boundingRect() const;
00109
00110 protected:
00127 virtual QImage renderImage( const QwtScaleMap &xMap,
00128 const QwtScaleMap &yMap, const QRectF &area,
00129 const QSize &imageSize ) const = 0;
00130
00131 virtual QwtScaleMap imageMap( Qt::Orientation,
00132 const QwtScaleMap &map, const QRectF &area,
00133 const QSize &imageSize, double pixelSize) const;
00134
00135 private:
00136 explicit QwtPlotRasterItem( const QwtPlotRasterItem & );
00137 QwtPlotRasterItem &operator=( const QwtPlotRasterItem & );
00138
00139 void init();
00140
00141 QImage compose( const QwtScaleMap &, const QwtScaleMap &,
00142 const QRectF &imageArea, const QRectF &paintRect,
00143 const QSize &imageSize, bool doCache) const;
00144
00145
00146 class PrivateData;
00147 PrivateData *d_data;
00148 };
00149
00150 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRasterItem::PaintAttributes )
00151
00152 #endif