00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00026
00028 #include <SFML/Graphics/Color.hpp>
00029
00030
00031 namespace sf
00032 {
00034
00036 const Color Color::Black(0, 0, 0);
00037 const Color Color::White(255, 255, 255);
00038 const Color Color::Red(255, 0, 0);
00039 const Color Color::Green(0, 255, 0);
00040 const Color Color::Blue(0, 0, 255);
00041 const Color Color::Yellow(255, 255, 0);
00042 const Color Color::Magenta(255, 0, 255);
00043 const Color Color::Cyan(0, 255, 255);
00044
00045
00049 Color::Color() :
00050 r(0),
00051 g(0),
00052 b(0),
00053 a(255)
00054 {
00055
00056 }
00057
00058
00062 Color::Color(Uint32 ColorRGBA) :
00063 r(static_cast<Uint8>((ColorRGBA & 0x000000FF))),
00064 g(static_cast<Uint8>((ColorRGBA & 0x0000FF00) >> 8)),
00065 b(static_cast<Uint8>((ColorRGBA & 0x00FF0000) >> 16)),
00066 a(static_cast<Uint8>((ColorRGBA & 0xFF000000) >> 24))
00067 {
00068
00069 }
00070
00071
00075 Color::Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A) :
00076 r(R),
00077 g(G),
00078 b(B),
00079 a(A)
00080 {
00081
00082 }
00083
00084
00088 Uint32 Color::ToRGBA() const
00089 {
00090 return (a << 24) | (b << 16) | (g << 8) | r;
00091 }
00092
00093
00097 bool Color::operator ==(const Color& Other) const
00098 {
00099 return (r == Other.r) && (g == Other.g) && (b == Other.b) && (a == Other.a);
00100 }
00101
00102
00106 bool Color::operator !=(const Color& Other) const
00107 {
00108 return (r != Other.r) || (g != Other.g) || (b != Other.b) || (a != Other.a);
00109 }
00110
00111 }