GTGColor.h
Go to the documentation of this file.
#ifndef _GTGCOLOR_H_
#define _GTGCOLOR_H_
#include <stdint.h>
typedef uint32_t gtg_rgb_color_t;
struct gtg_color {
char* color_name;
gtg_rgb_color_t rgb;
};
typedef struct gtg_color* gtg_color_t;
/* In a 4-byte value, the first byte corresponds to blue,
* the second to green, the third to red. The 4th byte is
* unused (for now). ie. a color is represented as follows:
* 0x00rrggbb
*/
#define GTG_COLOR_BLUE_POS 0
#define GTG_COLOR_GREEN_POS 8
#define GTG_COLOR_RED_POS 16
#define GTG_COLOR_BLUE_MASK (0x000000ff << GTG_COLOR_BLUE_POS)
#define GTG_COLOR_GREEN_MASK (0x000000ff << GTG_COLOR_GREEN_POS)
#define GTG_COLOR_RED_MASK (0x000000ff << GTG_COLOR_RED_POS)
static inline uint8_t
GTG_COLOR_GET_BLUE(gtg_rgb_color_t rgb)
{
return (((rgb) & GTG_COLOR_BLUE_MASK) >> GTG_COLOR_BLUE_POS );
}
static inline uint8_t
GTG_COLOR_GET_GREEN(gtg_rgb_color_t rgb)
{
return (((rgb) & GTG_COLOR_GREEN_MASK) >> GTG_COLOR_GREEN_POS);
}
static inline uint8_t
GTG_COLOR_GET_RED(gtg_rgb_color_t rgb)
{
return (((rgb) & GTG_COLOR_RED_MASK) >> GTG_COLOR_RED_POS );
}
static inline gtg_rgb_color_t
GTG_COLOR_SET_COLOR(uint8_t r, uint8_t g, uint8_t b)
{
return ((r << GTG_COLOR_RED_POS) |
(g << GTG_COLOR_GREEN_POS) |
(b << GTG_COLOR_BLUE_POS));
}
extern gtg_color_t GTG_BLACK;
extern gtg_color_t GTG_RED;
extern gtg_color_t GTG_GREEN;
extern gtg_color_t GTG_BLUE;
extern gtg_color_t GTG_WHITE;
extern gtg_color_t GTG_TEAL;
extern gtg_color_t GTG_DARKGREY;
extern gtg_color_t GTG_YELLOW;
extern gtg_color_t GTG_PURPLE;
extern gtg_color_t GTG_LIGHTBROWN;
extern gtg_color_t GTG_LIGHTGREY;
extern gtg_color_t GTG_DARKBLUE;
extern gtg_color_t GTG_PINK;
extern gtg_color_t GTG_DARKPINK;
extern gtg_color_t GTG_SEABLUE;
extern gtg_color_t GTG_KAKI;
extern gtg_color_t GTG_REDBLOOD;
extern gtg_color_t GTG_BROWN;
extern gtg_color_t GTG_GRENAT;
extern gtg_color_t GTG_ORANGE;
extern gtg_color_t GTG_MAUVE;
extern gtg_color_t GTG_LIGHTPINK;
void gtg_color_init();
void gtg_color_exit();
gtg_color_t gtg_color_create( const char *name, uint8_t r, uint8_t g, uint8_t b);
void gtg_color_free(gtg_color_t color);
#endif /* _GTGCOLOR_H_ */
GTG_BROWN
gtg_color_t GTG_BROWN
Default brown color. (R,G,B) = (100, 25, 25)
GTG_DARKBLUE
gtg_color_t GTG_DARKBLUE
Default dark blue color. (R,G,B) = (0, 0, 80)
uint32_t
otf2_id_t uint32_t
Definition: GTGOTF2_Structs.h:32
GTG_PURPLE
gtg_color_t GTG_PURPLE
Default purple color. (R,G,B) = (153, 25, 230)
gtg_color_free
void gtg_color_free(gtg_color_t color)
GTG_BLUE
gtg_color_t GTG_BLUE
Default blue color. (R,G,B) = (0, 0, 255)
GTG_LIGHTGREY
gtg_color_t GTG_LIGHTGREY
Default light grey color. (R,G,B) = (200, 200, 200)
GTG_DARKPINK
gtg_color_t GTG_DARKPINK
Default dark pink color. (R,G,B) = (180, 80, 180)
gtg_color::color_name
char * color_name
Definition: GTGColor.h:27
GTG_COLOR_SET_COLOR
static gtg_rgb_color_t GTG_COLOR_SET_COLOR(uint8_t r, uint8_t g, uint8_t b)
Return the 4-bytes RGB color from 3 1-byte components.
Definition: GTGColor.h:86
GTG_DARKGREY
gtg_color_t GTG_DARKGREY
Default dark grey color. (R,G,B) = (85, 85, 85)
GTG_BLACK
gtg_color_t GTG_BLACK
Default black color. (R,G,B) = (0, 0, 0)
GTG_TEAL
gtg_color_t GTG_TEAL
Default teal color. (R,G,B) = (0, 255, 255)
GTG_KAKI
gtg_color_t GTG_KAKI
Default kaki color. (R,G,B) = (80, 100, 25)
gtg_color_t
struct gtg_color * gtg_color_t
Definition: GTGColor.h:31
GTG_COLOR_GET_BLUE
static uint8_t GTG_COLOR_GET_BLUE(gtg_rgb_color_t rgb)
Return the 1-byte value of the blue component of a rgb color.
Definition: GTGColor.h:52
GTG_ORANGE
gtg_color_t GTG_ORANGE
Default orange color. (R,G,B) = (255, 160, 0)
GTG_COLOR_GREEN_MASK
#define GTG_COLOR_GREEN_MASK
Definition: GTGColor.h:43
GTG_PINK
gtg_color_t GTG_PINK
Default pink color. (R,G,B) = (255, 0, 255)
GTG_RED
gtg_color_t GTG_RED
Default red color. (R,G,B) = (255, 0, 0)
GTG_COLOR_GREEN_POS
#define GTG_COLOR_GREEN_POS
Definition: GTGColor.h:39
GTG_MAUVE
gtg_color_t GTG_MAUVE
Default mauve color. (R,G,B) = (128, 0, 255)
GTG_GREEN
gtg_color_t GTG_GREEN
Default green color. (R,G,B) = (0, 255, 0)
GTG_COLOR_GET_GREEN
static uint8_t GTG_COLOR_GET_GREEN(gtg_rgb_color_t rgb)
Return the 1-byte value of the green component of a rgb color.
Definition: GTGColor.h:63
gtg_color_create
gtg_color_t gtg_color_create(const char *name, uint8_t r, uint8_t g, uint8_t b)
GTG_YELLOW
gtg_color_t GTG_YELLOW
Default yellow color. (R,G,B) = (255, 255, 0)
GTG_GRENAT
gtg_color_t GTG_GRENAT
Default grenat color. (R,G,B) = (100, 0, 80)
GTG_COLOR_RED_MASK
#define GTG_COLOR_RED_MASK
Definition: GTGColor.h:44
GTG_COLOR_BLUE_POS
#define GTG_COLOR_BLUE_POS
Definition: GTGColor.h:38
gtg_color
This structure defines a color that can be used by GTG.
Definition: GTGColor.h:25
gtg_rgb_color_t
uint32_t gtg_rgb_color_t
Definition: GTGColor.h:18
GTG_COLOR_RED_POS
#define GTG_COLOR_RED_POS
Definition: GTGColor.h:40
gtg_color_init
void gtg_color_init()
GTG_REDBLOOD
gtg_color_t GTG_REDBLOOD
Default red blood color. (R,G,B) = (200, 25, 25)
GTG_WHITE
gtg_color_t GTG_WHITE
Default white color. (R,G,B) = (255, 255, 255)
GTG_COLOR_GET_RED
static uint8_t GTG_COLOR_GET_RED(gtg_rgb_color_t rgb)
Return the 1-byte value of the red component of a rgb color.
Definition: GTGColor.h:74
gtg_color_exit
void gtg_color_exit()
GTG_LIGHTPINK
gtg_color_t GTG_LIGHTPINK
Default light pink color. (R,G,B) = (255, 128, 255)
GTG_SEABLUE
gtg_color_t GTG_SEABLUE
Default sea blue color. (R,G,B) = (25, 128, 200)
GTG_COLOR_BLUE_MASK
#define GTG_COLOR_BLUE_MASK
Definition: GTGColor.h:42
gtg_color::rgb
gtg_rgb_color_t rgb
Definition: GTGColor.h:28
GTG_LIGHTBROWN
gtg_color_t GTG_LIGHTBROWN
Default light brown color. (R,G,B) = (170, 130, 130)