00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _WG_COLOR_H_
00026 #define _WG_COLOR_H_
00027
00028 #include "SDL.h"
00029 #include <cmath>
00030 #include <string>
00031
00032
00033 namespace wGui
00034 {
00035
00037
00038 class CRGBColor
00039 {
00040 public:
00041 unsigned char red;
00042 unsigned char green;
00043 unsigned char blue;
00044 unsigned char alpha;
00045
00051 CRGBColor(const unsigned char r, const unsigned char g, const unsigned char b, const unsigned char a = 0xFF) :
00052 red(r), green(g), blue(b), alpha(a) { }
00053
00057 CRGBColor(const Uint32* pColorValue, const SDL_PixelFormat* pFormat);
00058
00064 CRGBColor(std::wstring sColor);
00065
00068 unsigned long int SDLColor(SDL_PixelFormat* pFormat) const
00069 { return SDL_MapRGBA(pFormat, red, green, blue, alpha); }
00070
00073 bool operator==(const CRGBColor& c) const
00074 {
00075 return (red == c.red && green == c.green && blue == c.blue);
00076 }
00077
00080 bool operator!=(const CRGBColor& c) const
00081 {
00082 return (red != c.red || green != c.green || blue != c.blue);
00083 }
00084
00086 CRGBColor& operator=(const CRGBColor& c);
00087
00089 CRGBColor operator+(const CRGBColor& c) const;
00090
00092 CRGBColor operator|(const CRGBColor& c) const;
00093
00095 CRGBColor operator&(const CRGBColor& c) const;
00096
00098 CRGBColor operator^(const CRGBColor& c) const;
00099
00102 CRGBColor MixNormal(const CRGBColor& c) const;
00103
00104 };
00105
00106
00107
00108 extern CRGBColor DEFAULT_BACKGROUND_COLOR;
00109 extern CRGBColor DEFAULT_FOREGROUND_COLOR;
00110 extern CRGBColor DEFAULT_LINE_COLOR;
00111 extern CRGBColor DEFAULT_DISABLED_LINE_COLOR;
00112 extern CRGBColor COLOR_TRANSPARENT;
00113 extern CRGBColor COLOR_WHITE;
00114 extern CRGBColor COLOR_LIGHTGRAY;
00115 extern CRGBColor COLOR_GRAY;
00116 extern CRGBColor COLOR_DARKGRAY;
00117 extern CRGBColor COLOR_BLACK;
00118 extern CRGBColor COLOR_BLUE;
00119 extern CRGBColor COLOR_RED;
00120 extern CRGBColor COLOR_GREEN;
00121 extern CRGBColor COLOR_YELLOW;
00122 extern CRGBColor COLOR_CYAN;
00123 extern CRGBColor COLOR_MAGENTA;
00124
00125 }
00126
00127
00128 #include "unit_tests/wg_color_unittests.h"
00129
00130 #endif // _WG_COLOR_H_
00131