00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00023 
00024 #ifndef _vtkQtChartColors_h
00025 #define _vtkQtChartColors_h
00026 
00027 #include "vtkQtChartExport.h"
00028 #include <QColor> 
00029 
00030 class vtkQtChartColorsInternal;
00031 
00032 
00036 class VTKQTCHART_EXPORT vtkQtChartColors
00037 {
00038 public:
00039   enum ColorScheme
00040     {
00041     Spectrum = 0, 
00042     Warm,         
00043     Cool,         
00044     Blues,        
00045     WildFlower,   
00046     Citrus,       
00047     Custom        
00048     };
00049   
00050 public:
00054   vtkQtChartColors(ColorScheme scheme=Spectrum);
00055 
00059   vtkQtChartColors(const vtkQtChartColors &other);
00060   ~vtkQtChartColors();
00061 
00067   vtkQtChartColors &operator=(const vtkQtChartColors &other);
00068 
00073   ColorScheme getColorScheme() const {return this->Scheme;}
00074 
00082   void setColorScheme(ColorScheme scheme);
00083 
00088   int getNumberOfColors() const;
00089 
00094   QColor getColor(int index) const;
00095 
00103   void setColor(int index, const QColor &color);
00104 
00106   void clearColors();
00107 
00111   void addColor(const QColor &color);
00112 
00117   void insertColor(int index, const QColor &color);
00118 
00122   void removeColor(int index);
00123 
00124 public:
00140   static QColor lighter(const QColor &color, float factor=0.7);
00141 
00153   static QColor interpolateHsv(const QColor &color1, const QColor &color2,
00154       float fraction);
00155 
00164   static QColor interpolateRgb(const QColor &color1, const QColor &color2,
00165       float fraction);
00166 
00167 private:
00176   static float getDistance(float x1, float y1, float z1, float x2, float y2,
00177       float z2);
00178 
00189   static float getComponent(float x1, float x2, float f, float s);
00190 
00191 private:
00192   vtkQtChartColorsInternal *Internal; 
00193   ColorScheme Scheme;                 
00194 };
00195 
00196 #endif