00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef PG_COLOR_H
00014 #define PG_COLOR_H
00015
00016 #include "SDL.h"
00017
00033 class DECLSPEC PG_Color : public SDL_Color {
00034 public:
00035 PG_Color();
00036 PG_Color(const SDL_Color& c);
00037 PG_Color(Uint32 c);
00038 PG_Color(Uint8 r, Uint8 g, Uint8 b);
00039
00040 PG_Color& operator=(const SDL_Color& c);
00041
00042 PG_Color& operator=(Uint32 c);
00043
00044 operator Uint32() const;
00045
00046 inline Uint32 MapRGB(SDL_PixelFormat* format) const {
00047 return SDL_MapRGB(format, r, g, b);
00048 }
00049
00050 inline Uint32 MapRGBA(SDL_PixelFormat* format, Uint8 a) const {
00051 return SDL_MapRGBA(format, r, g, b, a);
00052 }
00053
00054 inline bool operator!=(const PG_Color& c) const {
00055 return ((r != c.r) || (g != c.g) || (b != c.b));
00056 }
00057 };
00058
00060 struct PG_Gradient {
00061 PG_Color colors[4];
00062 PG_Gradient() {}
00063 ;
00064 PG_Gradient( PG_Color ul, PG_Color ur, PG_Color ll, PG_Color lr ) {
00065 colors[0] = ul;
00066 colors[1] = ur;
00067 colors[2] = ll;
00068 colors[3] = lr;
00069 };
00070 };
00071
00072 #endif // PG_COLOR_H