[pixel] multiplex sprixel_cell_wipe()

This commit is contained in:
nick black 2021-03-20 02:29:29 -04:00 committed by Nick Black
parent 6ab325a36e
commit d6cb986d72
4 changed files with 22 additions and 0 deletions

View File

@ -6,6 +6,10 @@ int yield_demo(struct notcurses* nc){
}
int dimy, dimx;
struct ncplane* std = notcurses_stddim_yx(nc, &dimy, &dimx);
// in sixel-based implementation, if we redraw each cycle, the underlying
// material will be redrawn, taking time. erasing won't eliminate the
// flicker, but it does minimize it.
ncplane_erase(std);
char* pic = find_data("worldmap.png");
struct ncvisual* wmv = ncvisual_from_file(pic);
free(pic);

View File

@ -315,6 +315,10 @@ typedef struct tinfo {
bool sixel_supported; // do we support sixel (post pixel_query_done)?
int sprixelnonce; // next sprixel id
int (*pixel_destroy)(struct notcurses* nc, const struct ncpile* p, FILE* out, sprixel* s);
// wipe out a cell's worth of pixels from within a sprixel. for sixel, this
// means leaving out the pixels (and likely resizes the string). for kitty,
// this means dialing down their alpha to 0 (in equivalent space).
int (*pixel_cell_wipe)(sprixel* s, int y, int x);
bool pixel_query_done; // have we yet performed pixel query?
bool sextants; // do we have (good, vetted) Unicode 13 sextant support?
bool braille; // do we have Braille support? (linux console does not)
@ -1257,6 +1261,9 @@ ncdirect_bg_default_p(const struct ncdirect* nc){
return channels_bg_default_p(ncdirect_channels(nc));
}
int sprite_sixel_cell_wipe(sprixel* s, int y, int x);
int sprite_kitty_cell_wipe(sprixel* s, int y, int x);
int sixel_blit(ncplane* nc, int linesize, const void* data, int begy, int begx,
int leny, int lenx, const blitterargs* bargs);

View File

@ -922,6 +922,11 @@ emit_bg_palindex(notcurses* nc, FILE* out, const nccell* srccell){
return 0;
}
int sprite_kitty_cell_wipe(sprixel* s, int y, int x){
// FIXME
return 0;
}
int sprite_kitty_annihilate(notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
(void)p;
(void)nc;
@ -931,6 +936,10 @@ int sprite_kitty_annihilate(notcurses* nc, const ncpile* p, FILE* out, sprixel*
return 0;
}
int sprite_sixel_cell_wipe(sprixel* s, int y, int x){
return 0; // FIXME
}
int sprite_sixel_annihilate(notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
(void)out;
struct crender* rvec = p->crender;

View File

@ -60,6 +60,7 @@ apply_term_heuristics(tinfo* ti, const char* termname){
ti->sextants = true; // work since bugfix in 0.19.3
ti->pixel_query_done = true;
ti->sixel_supported = true;
ti->pixel_cell_wipe = sprite_kitty_cell_wipe;
ti->pixel_destroy = sprite_kitty_annihilate;
set_pixel_blitter(kitty_blit);
/*}else if(strstr(termname, "alacritty")){
@ -346,6 +347,7 @@ query_sixel(tinfo* ti, int fd){
ti->sixel_supported = true;
ti->color_registers = 256; // assumed default [shrug]
ti->pixel_destroy = sprite_sixel_annihilate;
ti->pixel_cell_wipe = sprite_sixel_cell_wipe;
ti->sixel_maxx = ti->sixel_maxy = 0;
}
}