neoGFX
C++ GPU-oriented GUI library and app/game creation framework.
hsv_colour.hpp
Go to the documentation of this file.
1 // hsv_colour.hpp
2 /*
3  neogfx C++ GUI Library
4  Copyright (c) 2015 Leigh Johnston. All Rights Reserved.
5 
6  This program is free software: you can redistribute it and / or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include <neogfx/neogfx.hpp>
23 
24 namespace neogfx
25 {
26  class colour;
27 
28  class hsv_colour
29  {
30  public:
31  hsv_colour();
32  hsv_colour(double aHue, double aSaturation, double aValue, double aAlpha = 1.0);
33  hsv_colour(const colour& aColour);
34  public:
35  double hue() const;
36  double saturation() const;
37  double value() const;
38  double brightness() const;
39  double alpha() const;
40  void set_hue(double aHue);
41  void set_saturation(double aSaturation);
42  void set_value(double aValue);
43  void set_brightness(double aBrightness);
44  void set_alpha(double aAlpha);
45  bool hue_undefined() const;
46  public:
47  hsv_colour with_brightness(double aNewLightness) const;
48  hsv_colour brighter(double aDelta) const;
49  hsv_colour brighter(double aCoeffecient, double aDelta) const;
50  colour to_rgb() const;
51  static hsv_colour from_rgb(const colour& aColour);
52  public:
53  static double undefined_hue();
54  public:
55  bool operator==(const hsv_colour& aOther) const;
56  bool operator!=(const hsv_colour& aOther) const;
57  bool operator<(const hsv_colour& aOther) const;
58  private:
59  double iHue;
60  double iSaturation;
61  double iValue;
62  double iAlpha;
63  };
64 }
bool hue_undefined() const
bool operator<(const hsv_colour &aOther) const
void set_saturation(double aSaturation)
double hue() const
bool operator!=(const hsv_colour &aOther) const
void set_alpha(double aAlpha)
static hsv_colour from_rgb(const colour &aColour)
void set_hue(double aHue)
bool operator==(const hsv_colour &aOther) const
void set_brightness(double aBrightness)
double brightness() const
static double undefined_hue()
double saturation() const
double value() const
colour to_rgb() const
hsv_colour brighter(double aDelta) const
void set_value(double aValue)
hsv_colour with_brightness(double aNewLightness) const
double alpha() const