VTK
9.0.1
Common
Color
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
=========================================================================*/
67
#ifndef vtkNamedColors_h
68
#define vtkNamedColors_h
69
70
#include "
vtkColor.h
"
// Needed for vtkColor[34]ub
71
#include "vtkCommonColorModule.h"
// For export macro
72
#include "
vtkObject.h
"
73
#include "
vtkStdString.h
"
// Needed for arguments
74
#include "
vtkStringArray.h
"
// For returning color names
75
76
class
vtkNamedColorsDataStore;
77
class
vtkColorStringParser;
78
79
class
VTKCOMMONCOLOR_EXPORT
vtkNamedColors
:
public
vtkObject
80
{
81
public
:
82
vtkTypeMacro(
vtkNamedColors
,
vtkObject
);
83
90
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
91
95
static
vtkNamedColors
*
New
();
96
100
int
GetNumberOfColors();
101
106
void
ResetColors();
107
111
bool
ColorExists(
const
vtkStdString
&
name
);
112
119
vtkColor4ub
GetColor4ub(
const
vtkStdString
&
name
);
120
128
void
GetColor(
const
vtkStdString
&
name
,
unsigned
char
& r,
unsigned
char
& g,
unsigned
char
& b,
129
unsigned
char
& a);
130
138
void
GetColor(
const
vtkStdString
&
name
,
unsigned
char
rgba[4]);
139
146
void
GetColor(
const
vtkStdString
&
name
,
vtkColor4ub
& rgba);
147
154
vtkColor4d
GetColor4d(
const
vtkStdString
&
name
);
155
163
void
GetColor(
const
vtkStdString
&
name
,
double
& r,
double
& g,
double
& b,
double
& a);
164
172
void
GetColor(
const
vtkStdString
&
name
,
double
rgba[4]);
173
180
void
GetColor(
const
vtkStdString
&
name
,
vtkColor4d
& rgba);
181
188
vtkColor3ub
GetColor3ub(
const
vtkStdString
&
name
);
189
196
vtkColor3d
GetColor3d(
const
vtkStdString
&
name
);
197
205
void
GetColor(
const
vtkStdString
&
name
,
double
& r,
double
& g,
double
& b);
206
214
void
GetColorRGB(
const
vtkStdString
&
name
,
double
rgb[3]);
215
222
void
GetColor(
const
vtkStdString
&
name
,
vtkColor3ub
& rgb);
223
230
void
GetColor(
const
vtkStdString
&
name
,
vtkColor3d
& rgb);
231
238
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
unsigned
char
& r,
const
unsigned
char
& g,
239
const
unsigned
char
& b,
const
unsigned
char
& a = 255);
240
247
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
double
& r,
const
double
& g,
const
double
& b,
248
const
double
& a = 1);
249
258
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
unsigned
char
rgba[4]);
259
266
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
vtkColor4ub
& rgba);
267
274
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
vtkColor3ub
& rgb);
275
283
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
double
rgba[4]);
284
291
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
vtkColor4d
& rgba);
292
299
virtual
void
SetColor(
const
vtkStdString
&
name
,
const
vtkColor3d
& rgb);
300
307
void
RemoveColor(
const
vtkStdString
&
name
);
308
317
vtkStdString
GetColorNames();
318
322
void
GetColorNames(
vtkStringArray
* colorNames);
323
334
vtkStdString
GetSynonyms();
335
348
vtkColor4ub
HTMLColorToRGBA(
const
vtkStdString
& colorString);
349
362
vtkColor3ub
HTMLColorToRGB(
const
vtkStdString
& colorString);
363
368
vtkStdString
RGBToHTMLColor(
const
vtkColor3ub
& rgb);
369
374
vtkStdString
RGBAToHTMLColor(
const
vtkColor4ub
& rgba);
375
383
void
SetColor(
const
vtkStdString
&
name
,
const
vtkStdString
& htmlString);
384
385
protected
:
386
vtkNamedColors
();
387
~
vtkNamedColors
()
override
;
388
389
private
:
391
394
vtkNamedColorsDataStore* Colors;
395
vtkColorStringParser* Parser;
397
398
vtkNamedColors
(
const
vtkNamedColors
&) =
delete
;
399
void
operator=(
const
vtkNamedColors
&) =
delete
;
400
};
401
402
#endif
/* vtkNamedColors_h */
vtkStdString.h
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:62
vtkColor4d
Definition:
vtkColor.h:323
vtkStringArray.h
vtkColor.h
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:33
vtkNamedColors
A class holding colors and their names.
Definition:
vtkNamedColors.h:79
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::name
@ name
Definition:
vtkX3D.h:225
vtkObject.h
vtkColor3d
Definition:
vtkColor.h:246
vtkColor3ub
Some derived classes for the different colors commonly used.
Definition:
vtkColor.h:194
vtkColor4ub
Definition:
vtkColor.h:264
vtkStringArray
a vtkAbstractArray subclass for strings
Definition:
vtkStringArray.h:36
vtkStdString
Wrapper around std::string to keep symbols short.
Definition:
vtkStdString.h:34
Generated on Thu Jun 24 2021 15:17:26 for VTK by
1.8.17