Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef COLORPALETTEDATA_H
00029 #define COLORPALETTEDATA_H
00030
00031 #include <QtGui>
00032 #include <QGpCoreTools.h>
00033 #include "QGpGuiToolsDLLExport.h"
00034
00035 namespace QGpGuiTools {
00036
00037 class QGPGUITOOLS_EXPORT ColorPaletteData : public QSharedData
00038 {
00039 public:
00040 ColorPaletteData();
00041 ColorPaletteData(const ColorPaletteData& o);
00042 ~ColorPaletteData();
00043
00044 bool operator==(const ColorPaletteData& o) const;
00045 bool operator!=(const ColorPaletteData& o) const {return ! operator==(o);}
00046
00047 void allocate(int n);
00048 void defaultRGBColors(int n, int transparency);
00049 void defaultHSVColors(int sat, int value, int n, int transparency);
00050 void defaultBW(int n, int transparency);
00051 void colorRGBInterpole(int imin, int imax);
00052 void colorHSVInterpole(int imin, int imax);
00053 void setVLinear(double min, double max) {setVLinear(0, _n-2, min, max);}
00054 void setVLog(double min, double max) {setVLog(0, _n-2, min, max);}
00055 void setVLinear(int imin, int imax, double min, double max);
00056 void setVLog(int imin, int imax, double min, double max);
00057
00058 int count() const {return _n;}
00059
00060 void setUpperValue(int i, double v) {_upperValues[i]=v;}
00061 double upperValue(int i) const {return i<_n-1 ? _upperValues[i] : 1e99;}
00062 double lowerValue(int i) const {return i>0 ? _upperValues[i-1] : -1e99;}
00063
00064 QColor& color(int i) const {return _colors[i];}
00065 QColor& color(double val) const {return _colors[index(val)];}
00066 void setColor(int i, const QColor& c) const {_colors[i]=c;}
00067
00068 int index(double val) const;
00069 private:
00070 QColor * _colors;
00071 double * _upperValues;
00072 int _n;
00073 int _n2;
00074 };
00075
00076 }
00077
00078 #endif // COLORPALETTEDATA_H