palpic2png.c: improve, make usable with ppic binary files
[rofl0r-openDOW.git] / sdl_rgb.h
blobf88061373cee917d77f2c56a1667e9c190b93644
1 #ifndef SDL_RGB_H
2 #define SDL_RGB_H
4 #include "../lib/include/endianness.h"
6 typedef union {
7 struct {
8 #ifdef IS_LITTLE_ENDIAN
9 unsigned char b;
10 unsigned char g;
11 unsigned char r;
12 unsigned char a;
13 #else
14 unsigned char a;
15 unsigned char r;
16 unsigned char g;
17 unsigned char b;
18 #endif
19 } colors;
20 uint32_t asInt;
21 } sdl_rgb_t;
23 #ifndef IN_KDEVELOP_PARSER
25 #define SRGB(R, G, B) ((sdl_rgb_t) {.colors.r = R, .colors.g = G, .colors.b = B, .colors.a = 0xff})
26 #define SRGB_BLUE SRGB(0x0,0x0,0xFF)
28 //#define SRGB2(R, G, B) ((union { struct {uint8_t b;uint8_t g;uint8_t r;uint8_t a;} colors; uint32_t asInt; }) {.colors.r = R, .colors.g = G, .colors.b = B, .colors.a = 0})
29 #define SRGB_WHITE SRGB(0xFF,0xFF,0xFF)
30 #define SRGB_BLACK SRGB(0x00,0x00,0x00)
32 #endif
34 #if __GNUC__ + 0 > 3
35 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
36 #endif
38 #endif