kitty: cut alphas in half with NCVISUAL_OPTION_BLEND #1735

This commit is contained in:
nick black 2021-06-08 04:32:13 -04:00 committed by Nick Black
parent 94cefb091f
commit 863c1778aa
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,8 @@ rearrangements of Notcurses.
scaling in `ncvisual_render()`. `ncvisual_render()` without a multimedia
engine will now use this method for any requested scaling (previously,
scaling was not performed without a linked multimedia backend).
* `NCVISUAL_OPTION_BLEND` used with `NCBLIT_PIXEL` will now, when the Kitty
graphics protocol is in use, cut the alpha of each pixel in half.
* 2.3.2 (2021-06-03)
* Fixed a bug affecting certain scalings of `ncvisual` objects created from

View File

@ -428,6 +428,7 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols,
fclose(fp);
return -1;
}
bool translucent = bargs->flags & NCVISUAL_OPTION_BLEND;
int sprixelid = bargs->u.pixel.spx->id;
int cdimy = bargs->u.pixel.celldimy;
int cdimx = bargs->u.pixel.celldimx;
@ -464,6 +465,9 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols,
}
const uint32_t* line = data + (linesize / sizeof(*data)) * y;
source[e] = line[x];
if(translucent){
ncpixel_set_a(&source[e], ncpixel_a(source[e]) / 2);
}
//fprintf(stderr, "%u/%u/%u -> %c%c%c%c %u %u %u %u\n", r, g, b, b64[0], b64[1], b64[2], b64[3], b64[0], b64[1], b64[2], b64[3]);
int xcell = x / cdimx;
int ycell = y / cdimy;