mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
ncdirect_stream: need to call new pixel_remove #1537
This commit is contained in:
parent
5c216c2f9b
commit
9b38fe515c
@ -558,6 +558,7 @@ ncdirect_render_visual(ncdirect* n, ncvisual* ncv, ncblitter_e blitfxn,
|
||||
free_plane(ncdv);
|
||||
return NULL;
|
||||
}
|
||||
ncdv->sprite = bargs.u.pixel.spx;
|
||||
}
|
||||
if(ncvisual_blit(ncv, disprows, dispcols, ncdv, bset, leny, lenx, &bargs)){
|
||||
free_plane(ncdv);
|
||||
@ -1139,6 +1140,8 @@ int ncdirect_stream(ncdirect* n, const char* filename, ncstreamcb streamer,
|
||||
// starting position *after displaying one frame* so as to effect any
|
||||
// necessary scrolling.
|
||||
int y = -1, x = -1;
|
||||
int lastid = -1;
|
||||
int thisid = -1;
|
||||
do{
|
||||
if(y > 0){
|
||||
ncdirect_cursor_up(n, y);
|
||||
@ -1154,9 +1157,20 @@ int ncdirect_stream(ncdirect* n, const char* filename, ncstreamcb streamer,
|
||||
return -1;
|
||||
}
|
||||
ncplane_dim_yx(v, &y, &x);
|
||||
if(v->sprite){
|
||||
thisid = v->sprite->id;
|
||||
}
|
||||
ncdirect_raster_frame(n, v, (vopts->flags & NCVISUAL_OPTION_HORALIGNED) ? vopts->x : 0);
|
||||
if(lastid > -1){
|
||||
if(n->tcache.pixel_remove){
|
||||
if(n->tcache.pixel_remove(lastid, n->ttyfp)){
|
||||
ncvisual_destroy(ncv);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
streamer(ncv, vopts, NULL, curry);
|
||||
// FIXME need to issue a kitty-kill when appropriate, how?
|
||||
lastid = thisid;
|
||||
}while(ncvisual_decode(ncv) == 0);
|
||||
ncvisual_destroy(ncv);
|
||||
return 0;
|
||||
|
@ -447,6 +447,7 @@ typedef struct tinfo {
|
||||
// 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)(const struct notcurses* nc, sprixel* s, int y, int x);
|
||||
int (*pixel_remove)(int id, FILE* out); // kitty only, issue actual delete command
|
||||
int (*pixel_init)(int fd); // called when support is detected
|
||||
int (*pixel_draw)(const struct notcurses* n, const struct ncpile* p, sprixel* s, FILE* out);
|
||||
int (*pixel_shutdown)(int fd); // called during context shutdown
|
||||
@ -935,6 +936,7 @@ int sprixel_load(sprixel* spx, char* s, int bytes, int placey, int placex,
|
||||
int pixy, int pixx, int parse_start);
|
||||
int sixel_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
|
||||
int kitty_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
|
||||
int kitty_remove(int id, FILE* out);
|
||||
int kitty_init(int fd);
|
||||
int sixel_init(int fd);
|
||||
int sprite_init(const notcurses* nc);
|
||||
|
@ -372,12 +372,19 @@ int kitty_blit(ncplane* n, int linesize, const void* data,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int kitty_remove(int id, FILE* out){
|
||||
if(fprintf(out, "\e_Ga=d,d=i,i=%d\e\\", id) < 0){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// removes the kitty bitmap graphic identified by s->id, and damages those
|
||||
// cells which weren't SPRIXCEL_OPAQUE
|
||||
int kitty_delete(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
|
||||
(void)p;
|
||||
(void)nc;
|
||||
if(fprintf(out, "\e_Ga=d,d=i,i=%d\e\\", s->id) < 0){
|
||||
if(kitty_remove(s->id, out)){
|
||||
return -1;
|
||||
}
|
||||
//fprintf(stderr, "MOVED FROM: %d/%d\n", s->movedfromy, s->movedfromx);
|
||||
|
@ -64,6 +64,7 @@ apply_term_heuristics(tinfo* ti, const char* termname){
|
||||
ti->pixel_cell_wipe = kitty_wipe;
|
||||
ti->pixel_destroy = kitty_delete;
|
||||
ti->pixel_init = kitty_init;
|
||||
ti->pixel_remove = kitty_remove;
|
||||
ti->pixel_draw = kitty_draw;
|
||||
ti->pixel_shutdown = kitty_shutdown;
|
||||
ti->sprixel_height_factor = 1;
|
||||
@ -342,6 +343,7 @@ setup_sixel(tinfo* ti){
|
||||
ti->pixel_draw = sixel_draw;
|
||||
ti->sixel_maxx = 4096; // whee!
|
||||
ti->sixel_maxy = 4096;
|
||||
ti->pixel_remove = NULL;
|
||||
ti->pixel_destroy = sixel_delete;
|
||||
ti->pixel_cell_wipe = sixel_wipe;
|
||||
ti->pixel_shutdown = sixel_shutdown;
|
||||
|
Loading…
x
Reference in New Issue
Block a user