2018-01-29 14:36:13 +01:00
|
|
|
#ifndef GUARD_RGB_H
|
|
|
|
#define GUARD_RGB_H
|
|
|
|
|
2020-09-02 23:43:21 +02:00
|
|
|
#define GET_R(color) ((color) & 0x1F)
|
|
|
|
#define GET_G(color) (((color) >> 5) & 0x1F)
|
|
|
|
#define GET_B(color) (((color) >> 10) & 0x1F)
|
2020-09-02 20:14:29 +02:00
|
|
|
|
2021-01-19 18:15:12 +01:00
|
|
|
#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
|
2018-12-29 12:10:06 +01:00
|
|
|
#define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r))
|
2018-02-04 16:11:00 +01:00
|
|
|
#define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F))
|
2023-01-28 15:03:18 +01:00
|
|
|
#define RGB2GBA(r, g, b) (((r >> 3) & 31) | (((g >> 3) & 31) << 5) | (((b >> 3) & 31) << 10))
|
2018-01-29 14:36:13 +01:00
|
|
|
|
2021-01-19 18:15:12 +01:00
|
|
|
#define RGB_ALPHA (1 << 15)
|
2021-01-19 18:59:36 +01:00
|
|
|
#define IS_ALPHA(color) ((color) & RGB_ALPHA)
|
2021-01-19 18:15:12 +01:00
|
|
|
|
|
|
|
#define RGB_BLACK RGB(0, 0, 0)
|
|
|
|
#define RGB_WHITE RGB(31, 31, 31)
|
|
|
|
#define RGB_RED RGB(31, 0, 0)
|
|
|
|
#define RGB_GREEN RGB(0, 31, 0)
|
|
|
|
#define RGB_BLUE RGB(0, 0, 31)
|
2021-01-29 08:59:08 +01:00
|
|
|
#define RGB_PURPLE RGB(24, 0, 24)
|
2021-01-19 18:15:12 +01:00
|
|
|
#define RGB_YELLOW RGB(31, 31, 0)
|
|
|
|
#define RGB_MAGENTA RGB(31, 0, 31)
|
|
|
|
#define RGB_CYAN RGB(0, 31, 31)
|
|
|
|
#define RGB_WHITEALPHA (RGB_WHITE | RGB_ALPHA)
|
2018-01-29 14:36:13 +01:00
|
|
|
|
2023-01-28 15:03:18 +01:00
|
|
|
#define RGB_LIME_GREEN RGB2GBA(222, 230, 49)
|
|
|
|
|
2018-01-29 14:36:13 +01:00
|
|
|
#endif // GUARD_RGB_H
|