+/*
+ * Color.h
+ *
+ * Created on: Sep 1, 2012
+ * Author: holy
+ */
+
+#ifndef GRAPHICS_COLOR_H_
+#define GRAPHICS_COLOR_H_
+
+#include <SDL.h>
+
+namespace graphics {
+
+class Color {
+
+public:
+ Color() :r(0), g(0), b(0), a(255) { }
+ Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255) : r(r), g(g), b(b), a(a) { }
+
+public:
+ Uint8 RedChannel() const { return r; }
+ Uint8 GreenChannel() const { return g; }
+ Uint8 BlueChannel() const { return b; }
+ Uint8 AlphaChannel() const { return a; }
+
+ Uint32 MapRGB(SDL_PixelFormat *f) const { return SDL_MapRGB(f, r, g, b); }
+ Uint32 MapRGBA(SDL_PixelFormat *f) const { return SDL_MapRGBA(f, r, g, b, a); }
+
+ void SetRedChannel(Uint8 i) { r = i; }
+ void SetGreenChannel(Uint8 i) { g = i; }
+ void SetBlueChannel(Uint8 i) { b = i; }
+ void SetAlphaChannel(Uint8 i) { a = i; }
+
+private:
+ Uint8 r, g, b, a;
+
+};
+
+}
+
+#endif /* GRAPHICS_COLOR_H_ */