2022-03-21 21:51:23 -04:00
|
|
|
#ifndef COLOR_H
|
|
|
|
#define COLOR_H
|
|
|
|
|
2022-07-27 17:50:56 -04:00
|
|
|
#include "endianness.h"
|
|
|
|
|
2022-03-21 21:51:23 -04:00
|
|
|
typedef struct {
|
|
|
|
u8 r, g, b;
|
|
|
|
} Color_RGB8;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u8 r, g, b, a;
|
|
|
|
} Color_RGBA8;
|
|
|
|
|
|
|
|
// only use when necessary for alignment purposes
|
|
|
|
typedef union {
|
|
|
|
struct {
|
2022-07-27 17:50:56 -04:00
|
|
|
#ifdef IS_BIGENDIAN
|
|
|
|
u8 r, g, b, a;
|
|
|
|
#else
|
2022-03-21 21:51:23 -04:00
|
|
|
u8 a, b, g, r;
|
2022-07-27 17:50:56 -04:00
|
|
|
#endif
|
2022-03-21 21:51:23 -04:00
|
|
|
};
|
|
|
|
u32 rgba;
|
|
|
|
} Color_RGBA8_u32;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
f32 r, g, b, a;
|
|
|
|
} Color_RGBAf;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
u16 r : 5;
|
|
|
|
u16 g : 5;
|
|
|
|
u16 b : 5;
|
|
|
|
u16 a : 1;
|
|
|
|
};
|
|
|
|
u16 rgba;
|
|
|
|
} Color_RGBA16;
|
|
|
|
|
|
|
|
#endif
|