]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Color.h
removed useless comments
[l2e.git] / src / graphics / Color.h
1 #ifndef GRAPHICS_COLOR_H_
2 #define GRAPHICS_COLOR_H_
3
4 #include <SDL.h>
5
6 namespace graphics {
7
8 class Color {
9
10 public:
11         Color() :r(0), g(0), b(0), a(255) { }
12         Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255) : r(r), g(g), b(b), a(a) { }
13
14 public:
15         Uint8 RedChannel() const { return r; }
16         Uint8 GreenChannel() const { return g; }
17         Uint8 BlueChannel() const { return b; }
18         Uint8 AlphaChannel() const { return a; }
19
20         Uint32 MapRGB(SDL_PixelFormat *f) const { return SDL_MapRGB(f, r, g, b); }
21         Uint32 MapRGBA(SDL_PixelFormat *f) const { return SDL_MapRGBA(f, r, g, b, a); }
22
23         void SetRedChannel(Uint8 i) { r = i; }
24         void SetGreenChannel(Uint8 i) { g = i; }
25         void SetBlueChannel(Uint8 i) { b = i; }
26         void SetAlphaChannel(Uint8 i) { a = i; }
27
28 private:
29         Uint8 r, g, b, a;
30
31 };
32
33 }
34
35 #endif