VTK
vtkNamedColors.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkNamedColors.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
69 #ifndef vtkNamedColors_h
70 #define vtkNamedColors_h
71 
72 #include "vtkCommonColorModule.h" // For export macro
73 #include "vtkObject.h"
74 #include "vtkColor.h" // Needed for vtkColor[34]ub
75 #include "vtkStdString.h" // Needed for arguments
76 #include "vtkStringArray.h" // For returning color names
77 
78 class vtkNamedColorsDataStore;
79 class vtkColorStringParser;
80 
81 class VTKCOMMONCOLOR_EXPORT vtkNamedColors : public vtkObject
82 {
83 public:
84  vtkTypeMacro(vtkNamedColors, vtkObject);
85 
92  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
93 
97  static vtkNamedColors* New();
98 
102  int GetNumberOfColors();
103 
108  void ResetColors();
109 
113  bool ColorExists(const vtkStdString & name);
114 
121  vtkColor4ub GetColor4ub(const vtkStdString & name);
122 
130  void GetColor(const vtkStdString & name,
131  unsigned char & r, unsigned char & g,
132  unsigned char & b, unsigned char & a);
133 
141  void GetColor(const vtkStdString & name, unsigned char rgba[4]);
142 
149  void GetColor(const vtkStdString & name, vtkColor4ub & rgba);
150 
157  vtkColor4d GetColor4d(const vtkStdString & name);
158 
166  void GetColor(const vtkStdString & name,
167  double & r, double & g, double & b, double & a);
168 
176  void GetColor(const vtkStdString & name, double rgba[4]);
177 
184  void GetColor(const vtkStdString & name, vtkColor4d & rgba);
185 
192  vtkColor3ub GetColor3ub(const vtkStdString & name);
193 
200  vtkColor3d GetColor3d(const vtkStdString & name);
201 
209  void GetColor(const vtkStdString & name,
210  double & r, double & g, double & b);
211 
219  void GetColorRGB(const vtkStdString & name, double rgb[3]);
220 
227  void GetColor(const vtkStdString & name, vtkColor3ub & rgb);
228 
235  void GetColor(const vtkStdString & name, vtkColor3d & rgb);
236 
243  virtual void SetColor(const vtkStdString & name,
244  const unsigned char & r, const unsigned char & g,
245  const unsigned char & b, const unsigned char & a = 255);
246 
253  virtual void SetColor(const vtkStdString & name,
254  const double & r, const double & g,
255  const double & b, const double & a = 1);
256 
265  virtual void SetColor(const vtkStdString & name, const unsigned char rgba[4]);
266 
273  virtual void SetColor(const vtkStdString & name, const vtkColor4ub & rgba);
274 
281  virtual void SetColor(const vtkStdString & name, const vtkColor3ub & rgb);
282 
290  virtual void SetColor(const vtkStdString & name, const double rgba[4]);
291 
298  virtual void SetColor(const vtkStdString & name, const vtkColor4d & rgba);
299 
306  virtual void SetColor(const vtkStdString & name, const vtkColor3d & rgb);
307 
314  void RemoveColor(const vtkStdString & name);
315 
324  vtkStdString GetColorNames();
325 
329  void GetColorNames(vtkStringArray * colorNames);
330 
341  vtkStdString GetSynonyms();
342 
355  vtkColor4ub HTMLColorToRGBA(const vtkStdString& colorString);
356 
369  vtkColor3ub HTMLColorToRGB(const vtkStdString& colorString);
370 
375  vtkStdString RGBToHTMLColor(const vtkColor3ub & rgb);
376 
381  vtkStdString RGBAToHTMLColor(const vtkColor4ub & rgba);
382 
390  void SetColor(const vtkStdString & name, const vtkStdString & htmlString);
391 
392 protected:
393  vtkNamedColors();
394  ~vtkNamedColors() VTK_OVERRIDE;
395 
396 private:
398 
401  vtkNamedColorsDataStore *Colors;
402  vtkColorStringParser* Parser;
404 
405  vtkNamedColors(const vtkNamedColors&) VTK_DELETE_FUNCTION;
406  void operator=(const vtkNamedColors&) VTK_DELETE_FUNCTION;
407 };
408 
409 #endif /* vtkNamedColors_h */
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A class holding colors and their names.
a vtkAbstractArray subclass for strings
Some derived classes for the different colors commonly used.
Definition: vtkColor.h:194
a simple class to control print indentation
Definition: vtkIndent.h:33
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...