new graphics method interp_colors

This commit is contained in:
K. Lange 2018-04-24 20:27:15 +09:00 committed by Kevin Lange
parent b59f8e8aea
commit e1d67ec921
4 changed files with 9 additions and 16 deletions

View File

@ -59,14 +59,6 @@ struct ListEntry_Separator {
struct ListEntry;
};
static uint32_t interp_colors(uint32_t bottom, uint32_t top, uint8_t interp) {
uint8_t red = (_RED(bottom) * (255 - interp) + _RED(top) * interp) / 255;
uint8_t gre = (_GRE(bottom) * (255 - interp) + _GRE(top) * interp) / 255;
uint8_t blu = (_BLU(bottom) * (255 - interp) + _BLU(top) * interp) / 255;
uint8_t alp = (_ALP(bottom) * (255 - interp) + _ALP(top) * interp) / 255;
return rgba(red,gre,blu, alp);
}
#define HILIGHT_BORDER_TOP rgb(54,128,205)
#define HILIGHT_GRADIENT_TOP rgb(93,163,236)
#define HILIGHT_GRADIENT_BOTTOM rgb(56,137,220)

View File

@ -637,14 +637,6 @@ static void read_applications(FILE * f) {
fclose(f);
}
static uint32_t interp_colors(uint32_t bottom, uint32_t top, uint8_t interp) {
uint8_t red = (_RED(bottom) * (255 - interp) + _RED(top) * interp) / 255;
uint8_t gre = (_GRE(bottom) * (255 - interp) + _GRE(top) * interp) / 255;
uint8_t blu = (_BLU(bottom) * (255 - interp) + _BLU(top) * interp) / 255;
uint8_t alp = (_ALP(bottom) * (255 - interp) + _ALP(top) * interp) / 255;
return rgba(red,gre,blu, alp);
}
#define HILIGHT_BORDER_TOP rgb(54,128,205)
#define HILIGHT_GRADIENT_TOP rgb(93,163,236)
#define HILIGHT_GRADIENT_BOTTOM rgb(56,137,220)

View File

@ -90,3 +90,4 @@ extern void gfx_clear_clip(gfx_context_t * ctx);
extern uint32_t getBilinearFilteredPixelColor(sprite_t * tex, double u, double v);
extern uint32_t interp_colors(uint32_t bottom, uint32_t top, uint8_t interp);

View File

@ -718,3 +718,11 @@ void draw_sprite_scaled_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x,
}
}
uint32_t interp_colors(uint32_t bottom, uint32_t top, uint8_t interp) {
uint8_t red = (_RED(bottom) * (255 - interp) + _RED(top) * interp) / 255;
uint8_t gre = (_GRE(bottom) * (255 - interp) + _GRE(top) * interp) / 255;
uint8_t blu = (_BLU(bottom) * (255 - interp) + _BLU(top) * interp) / 255;
uint8_t alp = (_ALP(bottom) * (255 - interp) + _ALP(top) * interp) / 255;
return rgba(red,gre,blu, alp);
}