VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtChartColors.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00020 00023 00024 #ifndef _vtkQtChartColors_h 00025 #define _vtkQtChartColors_h 00026 00027 #include "vtkQtChartExport.h" 00028 #include <QColor> // Needed for return type. 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