MEPP2 Project
Color.hpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <iostream>
14 
15 namespace FEVV {
16 
17 class Color
18 {
19 public:
23  ~Color() {}
24 
29  Color();
30 
43  Color(const unsigned char _redValue,
44  const unsigned char _greenValue,
45  const unsigned char _blueValue,
46  const unsigned char _alphaValue = 255);
47 
56  Color(const unsigned char _grayValue, const unsigned char _alphaValue = 255);
57 
63  Color(const Color &_color);
64 
66 
79  Color &setRGB(const unsigned char _redValue,
80  const unsigned char _greenValue,
81  const unsigned char _blueValue);
82 
95  Color &setRGBA(const unsigned char _redValue,
96  const unsigned char _greenValue,
97  const unsigned char _blueValue,
98  const unsigned char _alphaValue = 255);
99 
104  void red(const unsigned char _redValue);
105 
110  void green(const unsigned char _greenValue);
111 
116  void blue(const unsigned char _blueValue);
117 
122  void alpha(const unsigned char _alphaValue);
123 
128  unsigned char red() const;
129 
134  unsigned char green() const;
135 
140  unsigned char blue() const;
141 
146  unsigned char alpha() const;
147 
149 
150  bool operator==(const Color &_color) const;
151 
152  bool operator!=(const Color &_color) const;
153 
154  bool operator<(const Color &_color) const;
155 
156  Color &operator=(const Color &_color);
157 
158  Color operator+(const Color &_color);
159 
160  Color &operator+=(const Color &_color);
161 
162  Color operator-(const Color &_color);
163 
164  Color &operator-=(const Color &_color);
165 
166  Color operator*(const double _scale);
167 
168  Color &operator*=(const double _scale);
169 
171 
172  void selfDisplay(std::ostream &out) const;
173 
175 
176  // Please refer to
177  // https://www.google.com/design/spec/style/color.html#color-color-palette
178  static Color None(void);
179  static Color Black(void);
180  static Color White(void);
181  static Color Red(void);
182  static Color Pink(void);
183  static Color Purple(void);
184  static Color DeepPurple(void);
185  static Color Indigo(void);
186  static Color Blue(void);
187  static Color LightBlue(void);
188  static Color Cyan(void);
189  static Color Teal(void);
190  static Color Green(void);
191  static Color LightGreen(void);
192  static Color Lime(void);
193  static Color Yellow(void);
194  static Color Amber(void);
195  static Color Orange(void);
196  static Color DeepOrange(void);
197  static Color Brown(void);
198  static Color Grey(void);
199  static Color BlueGrey(void);
200 
202 
203  // Please refer to https://flatuicolors.com/
204  static Color Turquoise(void);
205  static Color GreenSea(void);
206  static Color Emerald(void);
207  static Color Nephritis(void);
208  static Color PeterRiver(void);
209  static Color BelizeHole(void);
210  static Color Amethyst(void);
211  static Color Wisteria(void);
212  static Color WetAsphalt(void);
213  static Color MidnightBlue(void);
214  static Color SunFlower(void);
215  static Color Carrot(void);
216  static Color Pumpkin(void);
217  static Color Alizarin(void);
218  static Color Pomegranate(void);
219  static Color Clouds(void);
220  static Color Silver(void);
221  static Color Concrete(void);
222  static Color Asbestos(void);
223 
224 private:
225  unsigned char redComponent;
226  unsigned char greenComponent;
227  unsigned char blueComponent;
228  unsigned char alphaComponent;
229 };
230 
231 } // namespace FEVV
232 
233 
234 #ifndef Q_MOC_RUN
235 // implementation
236 #include "Color.inl"
237 #endif // Q_MOC_RUN
FEVV::Color::red
unsigned char red() const
Definition: Color.inl:108
FEVV::Color::Indigo
static Color Indigo(void)
Definition: Color.inl:359
FEVV::Color::Brown
static Color Brown(void)
Definition: Color.inl:431
FEVV::Color::setRGB
Color & setRGB(const unsigned char _redValue, const unsigned char _greenValue, const unsigned char _blueValue)
Definition: Color.inl:51
FEVV::Color::Pomegranate
static Color Pomegranate(void)
Definition: Color.inl:536
FEVV::Color::Alizarin
static Color Alizarin(void)
Definition: Color.inl:530
FEVV::Color::Teal
static Color Teal(void)
Definition: Color.inl:383
FEVV::Color::MidnightBlue
static Color MidnightBlue(void)
Definition: Color.inl:506
FEVV::Color::blue
unsigned char blue() const
Definition: Color.inl:122
FEVV::Color::Silver
static Color Silver(void)
Definition: Color.inl:548
FEVV::Color::Yellow
static Color Yellow(void)
Definition: Color.inl:407
FEVV::Color::operator-=
Color & operator-=(const Color &_color)
Definition: Color.inl:257
FEVV::Color::Lime
static Color Lime(void)
Definition: Color.inl:401
FEVV::Color::~Color
~Color()
Definition: Color.hpp:23
FEVV::Color::Pink
static Color Pink(void)
Definition: Color.inl:341
FEVV::Color::green
unsigned char green() const
Definition: Color.inl:115
FEVV::Color::Wisteria
static Color Wisteria(void)
Definition: Color.inl:494
FEVV::Color::blueComponent
unsigned char blueComponent
Definition: Color.hpp:227
FEVV::Color::PeterRiver
static Color PeterRiver(void)
Definition: Color.inl:476
FEVV::Color::operator*
Color operator*(const double _scale)
Definition: Color.inl:274
FEVV::Color::Amber
static Color Amber(void)
Definition: Color.inl:413
FEVV::Color::operator=
Color & operator=(const Color &_color)
Definition: Color.inl:187
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::Color::Cyan
static Color Cyan(void)
Definition: Color.inl:377
FEVV::Color::BlueGrey
static Color BlueGrey(void)
Definition: Color.inl:443
FEVV::Color::WetAsphalt
static Color WetAsphalt(void)
Definition: Color.inl:500
FEVV::Color::operator-
Color operator-(const Color &_color)
Definition: Color.inl:237
FEVV::Color::Grey
static Color Grey(void)
Definition: Color.inl:437
FEVV::Color::Turquoise
static Color Turquoise(void)
Definition: Color.inl:452
FEVV::Color::LightBlue
static Color LightBlue(void)
Definition: Color.inl:371
FEVV::Color::Emerald
static Color Emerald(void)
Definition: Color.inl:464
FEVV::Color::setRGBA
Color & setRGBA(const unsigned char _redValue, const unsigned char _greenValue, const unsigned char _blueValue, const unsigned char _alphaValue=255)
Definition: Color.inl:65
FEVV::Color::None
static Color None(void)
Definition: Color.inl:317
FEVV::Color
Definition: Color.hpp:18
FEVV::Color::Purple
static Color Purple(void)
Definition: Color.inl:347
FEVV::Color::selfDisplay
void selfDisplay(std::ostream &out) const
Definition: Color.inl:307
FEVV::Color::Pumpkin
static Color Pumpkin(void)
Definition: Color.inl:524
FEVV::Color::GreenSea
static Color GreenSea(void)
Definition: Color.inl:458
FEVV::Color::DeepOrange
static Color DeepOrange(void)
Definition: Color.inl:425
FEVV::Color::BelizeHole
static Color BelizeHole(void)
Definition: Color.inl:482
FEVV::Color::Black
static Color Black(void)
Definition: Color.inl:323
FEVV::Color::LightGreen
static Color LightGreen(void)
Definition: Color.inl:395
FEVV::Color::SunFlower
static Color SunFlower(void)
Definition: Color.inl:512
FEVV::Color::redComponent
unsigned char redComponent
Definition: Color.hpp:225
FEVV::Color::Red
static Color Red(void)
Definition: Color.inl:335
FEVV::Color::alphaComponent
unsigned char alphaComponent
Definition: Color.hpp:228
FEVV::Color::White
static Color White(void)
Definition: Color.inl:329
FEVV::Color::operator+=
Color & operator+=(const Color &_color)
Definition: Color.inl:219
FEVV::Color::operator*=
Color & operator*=(const double _scale)
Definition: Color.inl:291
FEVV::Color::Amethyst
static Color Amethyst(void)
Definition: Color.inl:488
FEVV::Color::Carrot
static Color Carrot(void)
Definition: Color.inl:518
FEVV::Color::greenComponent
unsigned char greenComponent
Definition: Color.hpp:226
FEVV::Color::alpha
unsigned char alpha() const
Definition: Color.inl:129
FEVV::Color::Orange
static Color Orange(void)
Definition: Color.inl:419
Color.inl
FEVV::Color::Asbestos
static Color Asbestos(void)
Definition: Color.inl:560
FEVV::Color::Color
Color()
Definition: Color.inl:16
FEVV::Color::DeepPurple
static Color DeepPurple(void)
Definition: Color.inl:353
FEVV::Color::operator+
Color operator+(const Color &_color)
Definition: Color.inl:199
FEVV::Color::Nephritis
static Color Nephritis(void)
Definition: Color.inl:470
FEVV::Color::operator<
bool operator<(const Color &_color) const
Definition: Color.inl:158
FEVV::Color::operator==
bool operator==(const Color &_color) const
Definition: Color.inl:138
FEVV::Color::Green
static Color Green(void)
Definition: Color.inl:389
FEVV::Color::Clouds
static Color Clouds(void)
Definition: Color.inl:542
FEVV::Color::Concrete
static Color Concrete(void)
Definition: Color.inl:554
FEVV::Color::operator!=
bool operator!=(const Color &_color) const
Definition: Color.inl:148
FEVV::Color::Blue
static Color Blue(void)
Definition: Color.inl:365