00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QSIMAGE_H
00020 #define QSIMAGE_H
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025 #include"qsaxes.h"
00026 #include"qsplot.h"
00027 #include"qsdrv.h"
00028
00029
00030
00037 class QSImage : public QSPlot2D
00038 {
00039 Q_OBJECT
00040 Q_PROPERTY( bool rawMode READ rawMode WRITE setRawMode )
00041 Q_PROPERTY( bool useGradient READ useGradient WRITE setUseGradient )
00042
00043 public:
00051 enum Channels {
00052 XVector = 0,
00053 YVector = 1,
00054 DataRed = 2,
00055 DataIndex = 2,
00056 DataGray = 2,
00057 DataGreen = 3,
00058 DataBlue = 4,
00059 Palette = 5
00060 };
00064 QSImage(QSAxes* parent, const char * name=0);
00068 ~QSImage();
00074 void setRawMode( bool enabled );
00078 bool rawMode() const { return m_rawmode; }
00082 void setUseGradient( bool enable );
00086 bool useGradient() const { return m_use_gradient; }
00087
00088 virtual QString posInfo( QSPt2f& pos );
00089 virtual bool isClicked( const QSPt2f& pos );
00090 virtual QSPt2f legendItemSize( QSDrv *drv );
00091 virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv );
00092 virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory );
00093 virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory );
00094 virtual ColumnType columnType( int channel, int column ) const;
00095 virtual QString channelVariable( int channel ) const;
00096
00097 protected:
00098
00099 virtual void dataChanged( int channel = -1 );
00100 virtual void allocRuntimeData();
00101 virtual void freeRuntimeData();
00102 virtual bool getAxisRange( QSAxis *axis, double& min, double& max );
00103 virtual bool start();
00104 virtual bool step();
00105 virtual void end();
00106
00107 private:
00108
00109 bool m_evalid;
00110 bool m_rawmode;
00111 bool m_use_gradient;
00112 double m_dmin;
00113 double m_dmax;
00114 unsigned char m_r;
00115 unsigned char m_g;
00116 unsigned char m_b;
00117 unsigned char *m_ptr;
00118 struct image_runtime_data;
00119 struct image_runtime_data *d;
00120
00121 bool init_buffers();
00122 bool clip_rect( QSPt2& p1, QSPt2& p2 );
00123 void set_rgb( unsigned char* ptr, int x_index, int y_index );
00124 };
00125
00126 #endif
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169