Chemical Data Processing Library C++ API - Version 1.1.1
Color.hpp
Go to the documentation of this file.
1 /*
2  * Color.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_COLOR_HPP
30 #define CDPL_VIS_COLOR_HPP
31 
32 #include "CDPL/Vis/APIPrefix.hpp"
33 
34 
35 namespace CDPL
36 {
37 
38  namespace Vis
39  {
40 
52  {
53 
54  public:
58  static const Color BLACK;
59 
63  static const Color WHITE;
64 
68  static const Color RED;
69 
73  static const Color DARK_RED;
74 
78  static const Color GREEN;
79 
83  static const Color DARK_GREEN;
84 
88  static const Color BLUE;
89 
93  static const Color DARK_BLUE;
94 
98  static const Color CYAN;
99 
103  static const Color DARK_CYAN;
104 
108  static const Color MAGENTA;
109 
113  static const Color DARK_MAGENTA;
114 
118  static const Color YELLOW;
119 
123  static const Color DARK_YELLOW;
124 
128  static const Color GRAY;
129 
133  static const Color LIGHT_GRAY;
134 
138  static const Color DARK_GRAY;
139 
143  static const Color TRANSPARENT;
144 
148  Color();
149 
162  Color(double red, double green, double blue, double alpha = 1.0);
163 
172  void setRed(double red);
173 
178  double getRed() const;
179 
188  void setGreen(double green);
189 
194  double getGreen() const;
195 
204  void setBlue(double blue);
205 
210  double getBlue() const;
211 
220  void setAlpha(double alpha);
221 
226  double getAlpha() const;
227 
239  void setRGBA(double red, double green, double blue, double alpha = 1.0);
240 
246  bool operator==(const Color& color) const;
247 
256  bool operator!=(const Color& color) const;
257 
258  private:
259  double red;
260  double green;
261  double blue;
262  double alpha;
263  };
264  } // namespace Vis
265 } // namespace CDPL
266 
267 #endif // CDPL_VIS_COLOR_HPP
CDPL::Vis::Color::GREEN
static const Color GREEN
A preinitialized Color instance for the color green.
Definition: Color.hpp:78
CDPL::Vis::Color::setRGBA
void setRGBA(double red, double green, double blue, double alpha=1.0)
Sets the values of the RGBA components to specified values.
CDPL::Vis::Color::getRed
double getRed() const
Returns the value of the red color component.
CDPL::Vis::Color::operator==
bool operator==(const Color &color) const
Equality comparison operator.
CDPL::Vis::Color::BLUE
static const Color BLUE
A preinitialized Color instance for the color blue.
Definition: Color.hpp:88
CDPL::Vis::Color::DARK_YELLOW
static const Color DARK_YELLOW
A preinitialized Color instance for the color dark yellow.
Definition: Color.hpp:123
CDPL::Vis::Color::DARK_GRAY
static const Color DARK_GRAY
A preinitialized Color instance for the color dark gray.
Definition: Color.hpp:138
CDPL::Vis::Color::TRANSPARENT
static const Color TRANSPARENT
A preinitialized Color instance for a totally transparent (alpha = 0) black.
Definition: Color.hpp:143
CDPL::Vis::Color::LIGHT_GRAY
static const Color LIGHT_GRAY
A preinitialized Color instance for the color light gray.
Definition: Color.hpp:133
CDPL::Vis::Color::setRed
void setRed(double red)
Sets the value of the red color component to red.
CDPL::Vis::Color::BLACK
static const Color BLACK
A preinitialized Color instance for the color black.
Definition: Color.hpp:58
CDPL::Vis::Color::CYAN
static const Color CYAN
A preinitialized Color instance for the color cyan.
Definition: Color.hpp:98
CDPL::Vis::Color::setGreen
void setGreen(double green)
Sets the the value of green color component to green.
CDPL::Vis::Color::getGreen
double getGreen() const
Returns the value of the green color component.
CDPL::Vis::Color::WHITE
static const Color WHITE
A preinitialized Color instance for the color white.
Definition: Color.hpp:63
CDPL::Vis::Color::Color
Color()
Constructs and initializes a Color object with all RGBA components set to zero.
CDPL::Vis::Color::DARK_MAGENTA
static const Color DARK_MAGENTA
A preinitialized Color instance for the color dark magenta.
Definition: Color.hpp:113
CDPL::Vis::Color::getAlpha
double getAlpha() const
Returns the value of the alpha component.
CDPL::Vis::Color::DARK_CYAN
static const Color DARK_CYAN
A preinitialized Color instance for the color dark cyan.
Definition: Color.hpp:103
CDPL_VIS_API
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Vis::Color::DARK_GREEN
static const Color DARK_GREEN
A preinitialized Color instance for the color dark green.
Definition: Color.hpp:83
CDPL::Vis::Color::getBlue
double getBlue() const
Returns the value of the blue color component.
CDPL::Vis::Color::YELLOW
static const Color YELLOW
A preinitialized Color instance for the color yellow.
Definition: Color.hpp:118
CDPL::Vis::Color::MAGENTA
static const Color MAGENTA
A preinitialized Color instance for the color magenta.
Definition: Color.hpp:108
CDPL::Vis::Color::GRAY
static const Color GRAY
A preinitialized Color instance for the color gray.
Definition: Color.hpp:128
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Vis::Color::Color
Color(double red, double green, double blue, double alpha=1.0)
Constructs and initializes a Color object with the RGBA components set to the specified values.
CDPL::Vis::Color::RED
static const Color RED
A preinitialized Color instance for the color red.
Definition: Color.hpp:68
CDPL::Vis::Color::DARK_RED
static const Color DARK_RED
A preinitialized Color instance for the color dark red.
Definition: Color.hpp:73
CDPL::Vis::Color::DARK_BLUE
static const Color DARK_BLUE
A preinitialized Color instance for the color dark blue.
Definition: Color.hpp:93
CDPL::Vis::Color::setBlue
void setBlue(double blue)
Sets the value of the blue color component to blue.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_VIS_API.
CDPL::Vis::Color::setAlpha
void setAlpha(double alpha)
Sets the value of the alpha component to alpha.
CDPL::Vis::Color::operator!=
bool operator!=(const Color &color) const
Inequality comparison operator.
CDPL::Vis::Color
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparenc...
Definition: Color.hpp:52