VTK
dox/Common/Color/vtkNamedColors.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkNamedColors.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 =========================================================================*/
00062 #ifndef __vtkNamedColors_h
00063 #define __vtkNamedColors_h
00064 
00065 #include "vtkCommonColorModule.h" // For export macro
00066 #include "vtkObject.h"
00067 #include "vtkColor.h" // Needed for vtkColor[34]ub
00068 #include "vtkStdString.h" // Needed for arguments
00069 #include "vtkStringArray.h" // For returning color names
00070 
00071 class vtkNamedColorsDataStore;
00072 
00073 class VTKCOMMONCOLOR_EXPORT vtkNamedColors : public vtkObject
00074 {
00075 public:
00076   vtkTypeMacro(vtkNamedColors, vtkObject);
00077 
00082   virtual void PrintSelf(ostream &os, vtkIndent indent);
00083 
00085   static vtkNamedColors* New();
00086 
00088   int GetNumberOfColors();
00089 
00092   void ResetColors();
00093 
00095   bool ColorExists(const vtkStdString & name);
00096 
00100   vtkColor4ub GetColor4ub(const vtkStdString & name);
00101 
00103 
00107   void GetColor(const vtkStdString & name,
00108                 unsigned char & r, unsigned char & g,
00109                 unsigned char & b, unsigned char & a);
00111 
00116   void GetColor(const vtkStdString & name, unsigned char rgba[4]);
00117 
00121   void GetColor(const vtkStdString & name, vtkColor4ub & rgba);
00122 
00126   vtkColor4d GetColor4d(const vtkStdString & name);
00127 
00129 
00133   void GetColor(const vtkStdString & name,
00134                 double & r, double & g, double & b, double & a);
00136 
00141   void GetColor(const vtkStdString & name, double rgba[4]);
00142 
00146   void GetColor(const vtkStdString & name, vtkColor4d & rgba);
00147 
00151   vtkColor3ub GetColor3ub(const vtkStdString & name);
00152 
00156   vtkColor3d GetColor3d(const vtkStdString & name);
00157 
00159 
00163   void GetColor(const vtkStdString & name,
00164                    double & r, double & g, double & b);
00166 
00171   void GetColorRGB(const vtkStdString & name, double rgb[3]);
00172 
00176   void GetColor(const vtkStdString & name, vtkColor3ub & rgb);
00177 
00181   void GetColor(const vtkStdString & name, vtkColor3d & rgb);
00182 
00184 
00187   void SetColor(const vtkStdString & name,
00188                 const unsigned char & r, const unsigned char & g,
00189                 const unsigned char & b, const unsigned char & a = 255);
00191 
00193 
00196   void SetColor(const vtkStdString & name,
00197                 const double & r, const double & g,
00198                 const double & b, const double & a = 1);
00200 
00205   void SetColor(const vtkStdString & name, const unsigned char rgba[4]);
00206 
00210   void SetColor(const vtkStdString & name, const vtkColor4ub & rgba);
00211 
00215   void SetColor(const vtkStdString & name, const vtkColor3ub & rgb);
00216 
00220   void SetColor(const vtkStdString & name, const double rgba[4]);
00221 
00225   void SetColor(const vtkStdString & name, const vtkColor4d & rgba);
00226 
00230   void SetColor(const vtkStdString & name, const vtkColor3d & rgb);
00231 
00235   void RemoveColor(const vtkStdString & name);
00236 
00241   vtkStdString GetColorNames();
00242 
00244   void GetColorNames(vtkStringArray * colorNames);
00245 
00252   vtkStdString GetSynonyms();
00253 
00254 protected:
00255   vtkNamedColors();
00256   virtual ~vtkNamedColors();
00257 
00258 private:
00260   vtkNamedColorsDataStore *Colors;
00261 
00262   vtkNamedColors(const vtkNamedColors&);  // Not implemented.
00263   void operator=(const vtkNamedColors&);  // Not implemented.
00264 };
00265 
00266 #endif /* __vtkNamedColors_h */