add a channel to colors and add TRANSPARENT

This commit is contained in:
Gwenhael Le Moine 2024-09-05 13:06:39 +02:00
parent b9ebdb2486
commit dec8e90061
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 64 additions and 5 deletions

View file

@ -147,6 +147,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 255,
.g = 255,
.b = 255,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 255,
},
@ -155,6 +156,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 255,
.g = 166,
.b = 0,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 230,
},
@ -163,6 +165,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 0,
.g = 210,
.b = 255,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 169,
},
@ -171,6 +174,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 109,
.g = 93,
.b = 93,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 91,
},
@ -179,6 +183,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 90,
.g = 77,
.b = 77,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 81,
},
@ -187,6 +192,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 76,
.g = 65,
.b = 65,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 69,
},
@ -195,6 +201,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 202,
.g = 221,
.b = 92,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 205,
},
@ -203,6 +210,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 0,
.g = 0,
.b = 128,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 20,
},
@ -211,6 +219,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 109,
.g = 78,
.b = 78,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 88,
},
@ -219,6 +228,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 90,
.g = 64,
.b = 64,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 73,
},
@ -227,6 +237,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 76,
.g = 54,
.b = 54,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 60,
},
@ -235,6 +246,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 155,
.g = 118,
.b = 84,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 124,
},
@ -243,6 +255,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 124,
.g = 94,
.b = 67,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 99,
},
@ -251,6 +264,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 100,
.g = 75,
.b = 53,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 79,
},
@ -259,6 +273,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 204,
.g = 169,
.b = 107,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 172,
},
@ -267,6 +282,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 64,
.g = 64,
.b = 64,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 65,
},
@ -275,6 +291,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 202,
.g = 184,
.b = 144,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 185,
},
@ -283,6 +300,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 0,
.g = 0,
.b = 0,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 0,
},
@ -291,6 +309,7 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 60,
.g = 42,
.b = 42,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 48,
},
@ -299,6 +318,16 @@ color_t colors_sx[ NB_COLORS ] = {
.r = 0,
.g = 0,
.b = 0,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 0,
},
{
.name = "transparent",
.r = 0,
.g = 0,
.b = 0,
.a = 0,
.mono_rgb = 0,
.gray_rgb = 0,
},
@ -310,6 +339,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 255,
.g = 255,
.b = 255,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 255,
},
@ -318,6 +348,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 255,
.g = 186,
.b = 255,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 220,
},
@ -326,6 +357,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 0,
.g = 255,
.b = 204,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 169,
},
@ -334,6 +366,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 104,
.g = 104,
.b = 104,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 104,
},
@ -342,6 +375,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 88,
.g = 88,
.b = 88,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 88,
},
@ -350,6 +384,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 74,
.g = 74,
.b = 74,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 74,
},
@ -358,6 +393,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 202,
.g = 221,
.b = 92,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 205,
},
@ -366,6 +402,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 0,
.g = 0,
.b = 128,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 20,
},
@ -374,6 +411,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 88,
.g = 88,
.b = 88,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 88,
},
@ -382,6 +420,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 74,
.g = 74,
.b = 74,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 74,
},
@ -390,6 +429,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 64,
.g = 64,
.b = 64,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 64,
},
@ -398,6 +438,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 128,
.g = 128,
.b = 138,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 128,
},
@ -406,6 +447,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 104,
.g = 104,
.b = 110,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 104,
},
@ -414,6 +456,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 84,
.g = 84,
.b = 90,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 84,
},
@ -422,6 +465,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 176,
.g = 176,
.b = 184,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 176,
},
@ -430,6 +474,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 104,
.g = 104,
.b = 110,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 104,
},
@ -438,6 +483,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 240,
.g = 240,
.b = 240,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 240,
},
@ -446,6 +492,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 0,
.g = 0,
.b = 0,
.a = 255,
.mono_rgb = 255,
.gray_rgb = 0,
},
@ -454,6 +501,7 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 104,
.g = 104,
.b = 110,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 104,
},
@ -462,6 +510,16 @@ color_t colors_gx[ NB_COLORS ] = {
.r = 0,
.g = 0,
.b = 0,
.a = 255,
.mono_rgb = 0,
.gray_rgb = 0,
},
{
.name = "transparent",
.r = 0,
.g = 0,
.b = 0,
.a = 0,
.mono_rgb = 0,
.gray_rgb = 0,
},

View file

@ -24,9 +24,10 @@
#define FRAME 17
#define UNDERLAY 18
#define BLACK 19
#define TRANSPARENT 20
#define FIRST_COLOR WHITE
#define LAST_COLOR BLACK
#define LAST_COLOR TRANSPARENT
#define NB_COLORS ( LAST_COLOR + 1 )
/***********/
@ -39,7 +40,7 @@ typedef struct letter_t {
typedef struct color_t {
const char* name;
int r, g, b;
int r, g, b, a;
int mono_rgb;
int gray_rgb;
} color_t;

View file

@ -110,13 +110,13 @@ static SDL_Texture* bitmap_to_texture( unsigned int w, unsigned int h, unsigned
static void __draw_pixel( int x, int y, int color )
{
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, 255 );
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, colors[ color ].a );
SDL_RenderDrawPoint( renderer, x, y );
}
static void __draw_line( int x1, int y1, int x2, int y2, int color )
{
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, 255 );
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, colors[ color ].a );
SDL_RenderDrawLine( renderer, x1, y1, x2, y2 );
}
@ -128,7 +128,7 @@ static void __draw_rect( int x, int y, int w, int h, int color )
rect.w = w;
rect.h = h;
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, 255 );
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, colors[ color ].a );
SDL_RenderFillRect( renderer, &rect );
}