mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-06 03:20:26 +00:00
kitty: write transcolor pixel alpha as 0
when we're building out the kitty graphic, we check whether alpha is low, or whether the color matches the transparent color. in the latter case, we're writing the original alpha to the auxvec. in rebuild, however, we don't know what the transcolor was, and thus a pixel that matched it will become visible. instead, rewrite alpha as 0 on transcolor match, so that 0 is restored should we rebuild the cell.
This commit is contained in:
parent
fcd62a04ec
commit
cc6bdf4b55
@ -551,6 +551,7 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols,
|
||||
tam[tyx].auxvector[vyx] = ncpixel_a(source[e]);
|
||||
}
|
||||
if(rgba_trans_p(source[e], transcolor)){
|
||||
ncpixel_set_a(&source[e], 0); // in case it was transcolor
|
||||
if(x % cdimx == 0 && y % cdimy == 0){
|
||||
tam[tyx].state = SPRIXCELL_ANNIHILATED_TRANS;
|
||||
}
|
||||
@ -561,6 +562,7 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols,
|
||||
}else{
|
||||
wipe[e] = 0;
|
||||
if(rgba_trans_p(source[e], transcolor)){
|
||||
ncpixel_set_a(&source[e], 0); // in case it was transcolor
|
||||
if(x % cdimx == 0 && y % cdimy == 0){
|
||||
tam[tyx].state = SPRIXCELL_TRANSPARENT;
|
||||
}else if(tam[tyx].state == SPRIXCELL_OPAQUE_KITTY){
|
||||
|
@ -179,7 +179,8 @@ int sprite_wipe(const notcurses* nc, sprixel* s, int ycell, int xcell){
|
||||
int idx = s->dimx * ycell + xcell;
|
||||
if(s->n->tam[idx].state == SPRIXCELL_TRANSPARENT){
|
||||
// need to make a transparent auxvec, because a reload will force us to
|
||||
// update said auxvec.
|
||||
// update said auxvec, but needn't actually change the glyph. auxvec will
|
||||
// be entirely 0s coming from pixel_trans_auxvec().
|
||||
if(s->n->tam[idx].auxvector == NULL){
|
||||
s->n->tam[idx].auxvector = nc->tcache.pixel_trans_auxvec(&nc->tcache);
|
||||
if(s->n->tam[idx].auxvector == NULL){
|
||||
|
Loading…
Reference in New Issue
Block a user