00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _COLOUR_
00019 #define _COLOUR_
00020
00021 #include <iostream>
00022
00023 struct Colour
00024 {
00025 Colour()
00026 :_nRed(0), _nGreen(0), _nBlue(0), _nAlpha(255)
00027 {
00028 }
00029
00030 Colour(const Colour& c)
00031 :_nRed(c._nRed), _nGreen(c._nGreen), _nBlue(c._nBlue), _nAlpha(c._nAlpha)
00032 {
00033 }
00034
00035 Colour(unsigned char nRed, unsigned char nGreen, unsigned char nBlue, unsigned char nAlpha = 255)
00036 :_nRed(nRed), _nGreen(nGreen), _nBlue(nBlue), _nAlpha(nAlpha)
00037 {
00038 }
00039
00040 unsigned char _nBlue;
00041 unsigned char _nGreen;
00042 unsigned char _nRed;
00043 unsigned char _nAlpha;
00044 };
00045
00046 static inline std::ostream & operator<<(std::ostream& os, const Colour& c)
00047 {
00048 os << c._nRed << " " << c._nGreen << " " << c._nBlue << " " << c._nAlpha;
00049 return os;
00050 }
00051
00052 static inline std::istream & operator>>(std::istream& is, Colour& c)
00053 {
00054 is >> c._nRed >> c._nGreen >> c._nBlue >> c._nAlpha;
00055 return is;
00056 }
00057
00058 #define COLOUR_RED Colour(255, 0, 0)
00059 #define COLOUR_GREEN Colour(0, 255, 0)
00060 #define COLOUR_BLUE Colour(0, 0, 255)
00061 #define COLOUR_WHITE Colour(255, 255, 255)
00062 #define COLOUR_BLACK Colour()
00063 #define COLOUR_GREY Colour(128, 128, 128)
00064 #define COLOUR_YELLOW Colour(255, 255, 0)
00065 #define COLOUR_PINK Colour(255, 0, 255)
00066 #define COLOUR_AQUA Colour(0, 255, 255)
00067 #define COLOUR_PURPLE Colour(128, 0, 128)
00068 #define COLOUR_BROWN Colour(128, 64, 0)
00069 #define COLOUR_TURQOISE Colour(0, 128, 128)
00070 #define COLOUR_TRANSLUCENT Colour(0, 0, 0, 128)
00071
00072 #endif