From 47e2be7dc500839d0ceb0b9d552a258acaf64d21 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 15 Mar 2021 20:23:19 -0400 Subject: [PATCH] [pixel] hook up kitty image destroy #1401 --- src/lib/kitty.c | 5 ++++- src/lib/notcurses.c | 1 + src/lib/render.c | 6 +++++- src/poc/pixel.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/kitty.c b/src/lib/kitty.c index d81c671b6..2838f0750 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -78,7 +78,10 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, const uint32_t* dat //fprintf(stderr, "total: %d chunks = %d, s=%d,v=%d\n", total, chunks, lenx, leny); while(chunks--){ if(totalout == 0){ - fprintf(fp, "\e_Gf=32,s=%d,v=%d,a=T%s;", lenx, leny, chunks > 1 ? ",m=1" : ""); + // FIXME need to send image id from notcurses struct + static int horror = 1; + fprintf(fp, "\e_Gf=32,s=%d,v=%d,i=%d,q=1,a=T%s;", lenx, leny, horror, chunks > 1 ? ",m=1" : ""); + ++horror; }else{ fprintf(fp, "\e_Gm=%d;", chunks ? 1 : 0); } diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index dae07fffd..02f7a8fb5 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -951,6 +951,7 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){ ret->margin_r = opts->margin_r; ret->cursory = ret->cursorx = -1; ret->sprixelcache = NULL; + ret->sprixelnonce = 1; memset(&ret->stats, 0, sizeof(ret->stats)); memset(&ret->stashed_stats, 0, sizeof(ret->stashed_stats)); reset_stats(&ret->stats); diff --git a/src/lib/render.c b/src/lib/render.c index 86c2fd41e..fa72755d4 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -923,7 +923,11 @@ emit_bg_palindex(notcurses* nc, FILE* out, const nccell* srccell){ } int sprite_kitty_annihilate(notcurses* nc, const ncpile* p, FILE* out, sprixel* s){ - // FIXME + (void)p; + (void)nc; + if(fprintf(out, "\e_Ga=d,d=i,i=%d,q=1\e\\", s->id) < 0){ + return 0; + } return 0; } diff --git a/src/poc/pixel.c b/src/poc/pixel.c index 786790129..67f86ee22 100644 --- a/src/poc/pixel.c +++ b/src/poc/pixel.c @@ -12,7 +12,7 @@ handle(struct notcurses* nc, const char *fn){ struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx); uint64_t channels = CHANNELS_RGB_INITIALIZER(100, 140, 100, 140, 100, 140); ncplane_set_base(stdn, "a", 0, channels); - for(int x = 0 ; x < dimx ; x += 5){ + for(int x = 0 ; x < dimx ; x += 15){ struct ncvisual_options vopts = { .x = x, .scaling = NCSCALE_NONE_HIRES,