00001 #ifndef __COLOUR_H__ 00002 #define __COLOUR_H__ 00003 00004 #ifndef DOXYGEN_IGNORE_TAG 00005 00026 #endif 00027 00028 #include <iostream> 00029 00030 struct Colour 00031 { 00032 unsigned char r; 00033 unsigned char g; 00034 unsigned char b; 00035 unsigned char a; 00037 Colour():r(255),g(255),b(255),a(255) {} 00038 Colour(const unsigned char r, const unsigned char g, const unsigned char b, const unsigned char a=255):r(r),g(g),b(b),a(a) {} 00039 Colour(const unsigned int rgba) { setRGBA(rgba); } 00040 00041 void setRGBA(const unsigned int rgba) 00042 { 00043 this->r = (rgba >> 24) & 0x000000FF; 00044 this->g = (rgba >> 16) & 0x000000FF; 00045 this->b = (rgba >> 8) & 0x000000FF; 00046 this->a = rgba & 0x000000FF; 00047 } 00048 }; 00049 00050 std::ostream& operator<< (std::ostream& o, const Colour& c); 00051 bool operator< (const Colour& c1, const Colour& c2); 00052 00086 #endif