MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #ifndef __MYGUI_COLOUR_H__ 00008 #define __MYGUI_COLOUR_H__ 00009 00010 #include "MyGUI_Prerequest.h" 00011 #include "MyGUI_Types.h" 00012 00013 namespace MyGUI 00014 { 00015 00016 struct MYGUI_EXPORT Colour 00017 { 00018 public: 00019 Colour(); 00020 Colour(float _red, float _green, float _blue, float _alpha = 1); 00021 explicit Colour(const std::string& _value); 00022 00023 Colour& operator = (Colour const& _value); 00024 bool operator == (Colour const& _value) const; 00025 bool operator != (Colour const& _value) const; 00026 00027 void set(float _red, float _green, float _blue, float _alpha = 1); 00028 00029 void clear(); 00030 00031 std::string print() const; 00032 00033 static Colour parse(const std::string& _value); 00034 00035 friend std::ostream& operator << (std::ostream& _stream, const Colour& _value) 00036 { 00037 return operatorShiftLeft(_stream, _value); 00038 } 00039 00040 friend std::istream& operator >> (std::istream& _stream, Colour& _value) 00041 { 00042 return operatorShiftRight(_stream, _value); 00043 } 00044 00045 static std::ostream& operatorShiftLeft(std::ostream& _stream, const Colour& _value); 00046 static std::istream& operatorShiftRight(std::istream& _stream, Colour& _value); 00047 00048 public: 00049 float red; 00050 float green; 00051 float blue; 00052 float alpha; 00053 00054 static const Colour Zero; 00055 static const Colour Black; 00056 static const Colour White; 00057 static const Colour Red; 00058 static const Colour Green; 00059 static const Colour Blue; 00060 }; 00061 00062 } // namespace MyGUI 00063 00064 #endif // __MYGUI_COLOUR_H__