MyGUI  3.2.1
MyGUI_Colour.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef __MYGUI_COLOUR_H__
8 #define __MYGUI_COLOUR_H__
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Types.h"
12 
13 namespace MyGUI
14 {
15 
17  {
18  public:
19  Colour();
20  Colour(float _red, float _green, float _blue, float _alpha = 1);
21  explicit Colour(const std::string& _value);
22 
23  Colour& operator = (Colour const& _value);
24  bool operator == (Colour const& _value) const;
25  bool operator != (Colour const& _value) const;
26 
27  void set(float _red, float _green, float _blue, float _alpha = 1);
28 
29  void clear();
30 
31  std::string print() const;
32 
33  static Colour parse(const std::string& _value);
34 
35  friend std::ostream& operator << (std::ostream& _stream, const Colour& _value)
36  {
37  return operatorShiftLeft(_stream, _value);
38  }
39 
40  friend std::istream& operator >> (std::istream& _stream, Colour& _value)
41  {
42  return operatorShiftRight(_stream, _value);
43  }
44 
45  static std::ostream& operatorShiftLeft(std::ostream& _stream, const Colour& _value);
46  static std::istream& operatorShiftRight(std::istream& _stream, Colour& _value);
47 
48  public:
49  float red;
50  float green;
51  float blue;
52  float alpha;
53 
54  static const Colour Zero;
55  static const Colour Black;
56  static const Colour White;
57  static const Colour Red;
58  static const Colour Green;
59  static const Colour Blue;
60  };
61 
62 } // namespace MyGUI
63 
64 #endif // __MYGUI_COLOUR_H__