Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_plot_rasteritem.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_PLOT_RASTERITEM_H
11 #define QWT_PLOT_RASTERITEM_H
12
13 #include "qwt_global.h"
14 #include "qwt_plot_item.h"
15 #include "qwt_interval.h"
16 #include <qglobal.h>
17 #include <qstring.h>
18 #include <qimage.h>
19
37 class QWT_EXPORT QwtPlotRasterItem: public QwtPlotItem
38 {
39 public:
52 enum CachePolicy
53 {
54 NoCache,
55 PaintCache
56 };
57
62 enum PaintAttribute
63 {
76 PaintInDeviceResolution = 1
77 };
78
80 typedef QFlags<PaintAttribute> PaintAttributes;
81
82 explicit QwtPlotRasterItem( const QString& title = QString::null );
83 explicit QwtPlotRasterItem( const QwtText& title );
84 virtual ~QwtPlotRasterItem();
85
86 void setPaintAttribute( PaintAttribute, bool on = true );
87 bool testPaintAttribute( PaintAttribute ) const;
88
89 void setAlpha( int alpha );
90 int alpha() const;
91
92 void setCachePolicy( CachePolicy );
93 CachePolicy cachePolicy() const;
94
95 void invalidateCache();
96
97 virtual void draw( QPainter *p,
98 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
99 const QRectF &rect ) const;
100
101 virtual QRectF pixelHint( const QRectF & ) const;
102
103 virtual QwtInterval interval(Qt::Axis) const;
104 virtual QRectF boundingRect() const;
105
106 protected:
121 virtual QImage renderImage( const QwtScaleMap &xMap,
122 const QwtScaleMap &yMap, const QRectF &area,
123 const QSize &imageSize ) const = 0;
124
125 virtual QwtScaleMap imageMap( Qt::Orientation,
126 const QwtScaleMap &map, const QRectF &area,
127 const QSize &imageSize, double pixelSize) const;
128
129 private:
130 QwtPlotRasterItem( const QwtPlotRasterItem & );
131 QwtPlotRasterItem &operator=( const QwtPlotRasterItem & );
132
133 void init();
134
135 QImage compose( const QwtScaleMap &, const QwtScaleMap &,
136 const QRectF &imageArea, const QRectF &paintRect,
137 const QSize &imageSize, bool doCache) const;
138
139
140 class PrivateData;
141 PrivateData *d_data;
142 };
143
144 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRasterItem::PaintAttributes )
145
146 #endif