![]() |
µGFX
2.9
version 2.9
|
Sub-Module for color handling.
Color Type Constants | |
#define | GDISP_COLORSYSTEM_TRUECOLOR 0x2000 |
#define | GDISP_COLORSYSTEM_GRAYSCALE 0x4000 |
#define | GDISP_COLORSYSTEM_PALETTE 0x6000 |
Some basic colors | |
#define | GFX_WHITE HTML2COLOR(0xFFFFFF) |
#define | GFX_BLACK HTML2COLOR(0x000000) |
#define | GFX_GRAY HTML2COLOR(0x808080) |
#define | GFX_GREY GFX_GRAY |
#define | GFX_BLUE HTML2COLOR(0x0000FF) |
#define | GFX_RED HTML2COLOR(0xFF0000) |
#define | GFX_FUCHSIA HTML2COLOR(0xFF00FF) |
#define | GFX_MAGENTA GFX_FUCHSIA |
#define | GFX_GREEN HTML2COLOR(0x008000) |
#define | GFX_YELLOW HTML2COLOR(0xFFFF00) |
#define | GFX_AQUA HTML2COLOR(0x00FFFF) |
#define | GFX_CYAN GFX_AQUA |
#define | GFX_LIME HTML2COLOR(0x00FF00) |
#define | GFX_MAROON HTML2COLOR(0x800000) |
#define | GFX_NAVY HTML2COLOR(0x000080) |
#define | GFX_OLIVE HTML2COLOR(0x808000) |
#define | GFX_PURPLE HTML2COLOR(0x800080) |
#define | GFX_SILVER HTML2COLOR(0xC0C0C0) |
#define | GFX_TEAL HTML2COLOR(0x008080) |
#define | GFX_ORANGE HTML2COLOR(0xFFA500) |
#define | GFX_PINK HTML2COLOR(0xFFC0CB) |
#define | GFX_SKYBLUE HTML2COLOR(0x87CEEB) |
Color bits | |
#define | COLOR_BITS_R 5 |
#define | COLOR_BITS_G 6 |
#define | COLOR_BITS_B 5 |
Color bit shifts | |
The number of bits to shift each of red, green and blue to put it in the correct place in the color | |
#define | COLOR_SHIFT_R 11 |
#define | COLOR_SHIFT_G 5 |
#define | COLOR_SHIFT_B 0 |
Extraction macros (quick) | |
Extract the luma/red/green/blue component (0 to 255) of a color value.
| |
#define | LUMA_OF(c) ((RED_OF(c)+((gU16)GREEN_OF(c)<<1)+BLUE_OF(c))>>2) |
#define | RED_OF(c) (((c) & 0xF800)>>8) |
#define | GREEN_OF(c) (((c)&0x07E0)>>3) |
#define | BLUE_OF(c) (((c)&0x001F)<<3) |
Extraction macros (precise) | |
Extract the exact luma/red/green/blue component (0 to 255) of a color value.
| |
#define | EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((gU16)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2) |
#define | EXACT_RED_OF(c) (((((c)>>11)&0x1F)*255)/31) |
#define | EXACT_GREEN_OF(c) (((((c)>>5)&0x3F)*255)/63) |
#define | EXACT_BLUE_OF(c) (((((c)>>0)&0x1F)*255)/31) |
Macros | |
#define | COLOR_SYSTEM GDISP_COLORSYSTEM_TRUECOLOR |
The color system (grayscale, palette or truecolor) More... | |
#define | COLOR_BITS 16 |
The number of bits in a color value. More... | |
#define | COLOR_NEEDS_MASK GFXOFF |
Does the color need masking to remove invalid bits. More... | |
#define | COLOR_MASK 0xFFFF |
If the color needs masking to remove invalid bits, this is the mask. More... | |
#define | COLOR_TYPE gU16 |
The color type. More... | |
#define | COLOR_TYPE_BITS 16 |
The number of bits in the color type (not necessarily the same as COLOR_BITS). More... | |
#define | LUMA2COLOR(l) ((gColor)((((l) & 0xF8)<<8) | (((l) & 0xFC)<<3) | (((l) & 0xF8)>>3))) |
Convert a luminance (0 to 255) into a color value. More... | |
#define | RGB2COLOR(r, g, b) ((gColor)((((r) & 0xF8)<<8) | (((g) & 0xFC)<<3) | (((b) & 0xF8)>>3))) |
Convert red, green, blue (each 0 to 255) into a color value. More... | |
#define | HTML2COLOR(h) ((gColor)((((h) & 0xF80000)>>8) | (((h) & 0x00FC00)>>5) | (((h) & 0x0000F8)>>3))) |
Convert a 6 digit HTML code (hex) into a color value. More... | |
Typedefs | |
typedef COLOR_TYPE | gColor |
The color type definition. More... | |
#define COLOR_BITS 16 |
The number of bits in a color value.
Definition at line 141 of file gdisp_colors.h.
#define COLOR_MASK 0xFFFF |
If the color needs masking to remove invalid bits, this is the mask.
Definition at line 171 of file gdisp_colors.h.
#define COLOR_NEEDS_MASK GFXOFF |
Does the color need masking to remove invalid bits.
Definition at line 166 of file gdisp_colors.h.
#define COLOR_SYSTEM GDISP_COLORSYSTEM_TRUECOLOR |
The color system (grayscale, palette or truecolor)
Definition at line 136 of file gdisp_colors.h.
#define COLOR_TYPE gU16 |
The color type.
Definition at line 176 of file gdisp_colors.h.
#define COLOR_TYPE_BITS 16 |
The number of bits in the color type (not necessarily the same as COLOR_BITS).
Definition at line 181 of file gdisp_colors.h.
#define HTML2COLOR | ( | h | ) | ((gColor)((((h) & 0xF80000)>>8) | (((h) & 0x00FC00)>>5) | (((h) & 0x0000F8)>>3))) |
Convert a 6 digit HTML code (hex) into a color value.
Definition at line 201 of file gdisp_colors.h.
#define LUMA2COLOR | ( | l | ) | ((gColor)((((l) & 0xF8)<<8) | (((l) & 0xFC)<<3) | (((l) & 0xF8)>>3))) |
Convert a luminance (0 to 255) into a color value.
LUMA2COLOR()
uses a linear conversion (0.33R + 0.33G + 0.33B). Note this is different to color tv luminance (0.26126R + 0.7152G + 0.0722B), digital tv luminance of (0.299R + 0.587G + 0.114B), or LUMA_OF()
which uses (0.25R + 0.5G + 0.25B). Definition at line 191 of file gdisp_colors.h.
#define RGB2COLOR | ( | r, | |
g, | |||
b | |||
) | ((gColor)((((r) & 0xF8)<<8) | (((g) & 0xFC)<<3) | (((b) & 0xF8)>>3))) |
Convert red, green, blue (each 0 to 255) into a color value.
Definition at line 196 of file gdisp_colors.h.
typedef COLOR_TYPE gColor |
The color type definition.
Definition at line 437 of file gdisp_colors.h.