]> git.localhorst.tv Git - space.git/blob - src/graphics/Color.h
grid view
[space.git] / src / graphics / Color.h
1 #ifndef SPACE_COLOR_H_
2 #define SPACE_COLOR_H_
3
4 #include <SDL/SDL.h>
5
6
7 namespace space {
8
9 struct Color {
10
11         constexpr Color()
12         : Color(0, 0, 0) { }
13         constexpr Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 0xFF)
14         : r(r), g(g), b(b), a(a) { }
15
16         Uint32 MapRGB(SDL_Surface *s) const
17                 { return MapRGB(s->format); }
18         Uint32 MapRGB(SDL_PixelFormat *f) const
19                 { return SDL_MapRGB(f, r, g, b); }
20
21         Uint32 MapRGBA(SDL_Surface *s) const
22                 { return MapRGBA(s->format); }
23         Uint32 MapRGBA(SDL_PixelFormat *f) const
24                 { return SDL_MapRGBA(f, r, g, b, a); }
25
26         Uint8 r, g, b, a;
27
28 };
29
30 }
31
32 #endif