remove support for the iTerm2 graphics protocol #2060

pull/2083/head
nick black 3 years ago committed by nick black
parent 0cd42fdde2
commit 91dfb487ad

@ -7,6 +7,9 @@ rearrangements of Notcurses.
deprecated for ABI3. New code ought not be written using it.
* Added `ncplane_scrollup()` and `ncplane_scrollup_child()`.
* Fixed grotesque errors in `ncplane_set_*_palindex()`.
* Removed support for the iTerm2 graphics protocol, which is unsuitable for
the Notcurses model. macOS users who want graphics are recommended to use
Kitty or WezTerm. It will be added back if it gains necessary capabilities.
* 2.3.13 (2021-08-04)
* Added the portable utility functions `notcurses_accountname()` and

@ -118,7 +118,7 @@ Color Erase) capability, but Notcurses never relies on `bce` behavior.
### WezTerm
WezTerm [implements](https://wezfurlong.org/wezterm/escape-sequences.html) some
interesting underline options, and the iTerm2 graphic protocol.
interesting underline options, and both the Sixel and Kitty graphic protocols.
### GNU screen

@ -76,11 +76,10 @@ The next five lines describe properties of the terminal environment:
* The fifth line describes the available bitmap graphics. If Sixels are
available, the maximum number of color registers and maximum Sixel
geometry are reported. If the iTerm2 protocol or Linux framebuffer graphics
are available, that is reported. If the Kitty graphics protocol is
detected, that will be reported with "rgba graphics are available"; if
Kitty's animation support is also present, that will be reported with
"rgba pixel animation support".
geometry are reported. If Linux framebuffer graphics are available, that is
reported. If the Kitty graphics protocol is detected, that will be reported
with "rgba graphics are available"; if Kitty's animation support is also
present, that will be reported with "rgba pixel animation support".
The final eleven lines, only printed when in a UTF8 locale, show various
Unicode glyphs. The first four lines include the quadrant, sextant, and

@ -353,8 +353,6 @@ tinfo_debug_bitmaps(struct ncplane* n, const tinfo* ti, const char* indent){
}
}else if(ti->pixel_draw_late){
ncplane_printf(n, "%sframebuffer graphics supported", indent);
}else if(ti->pixel_move == NULL){
ncplane_printf(n, "%siTerm2 graphics support", indent);
}else if(ti->sixel_maxy_pristine){
ncplane_printf(n, "%srgba pixel graphics support", indent);
}else{

@ -1,101 +0,0 @@
// the iterm2 graphics protocol is based entirely around containerized formats
// https://iterm2.com/documentation-images.html
#include <stdio.h>
#include "internal.h"
#include "termdesc.h"
#include "sprite.h"
#include "fbuf.h"
#include "png.h"
// yank a cell out of the PNG by setting all of its alphas to 0. the alphas
// will be preserved in the auxvec.
int iterm_wipe(sprixel* s, int ycell, int xcell){
(void)s; // FIXME
(void)ycell;
(void)xcell;
return -1;
}
// build a cell of the PNG back up by copying auxvec alphas to it.
int iterm_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec){
(void)s; // FIXME
(void)ycell;
(void)xcell;
(void)auxvec;
return -1;
}
// spit out the control sequence and data.
int iterm_draw(const tinfo* ti, const ncpile *p, sprixel* s, fbuf* f, int y, int x){
(void)ti;
if(p){
if(goto_location(p->nc, f, y, x)){
return -1;
}
}
if(fbuf_putn(f, s->glyph.buf, s->glyph.used) < 0){
return -1;
}
return s->glyph.used;
}
static int
write_iterm_graphic(tament* tam, const void* data, int leny, int stride, int lenx, fbuf *f){
if(fbuf_puts(f, "\e]1337;File=inline=1:") < 0){
return -1;
}
if(write_png_b64(tam, data, leny, stride, lenx, f)){
return -1;
}
if(fbuf_puts(f, "\x1b\\") < 0){
return -1;
}
return 0;
}
// create an iterm2 control sequence complete with base64-encoded PNG.
int iterm_blit(ncplane* n, int linesize, const void* data,
int leny, int lenx, const blitterargs* bargs){
int cols = bargs->u.pixel.spx->dimx;
int rows = bargs->u.pixel.spx->dimy;
sprixel* s = bargs->u.pixel.spx;
tament* tam = NULL;
bool reuse = false;
// if we have a sprixel attached to this plane, see if we can reuse it
// (we need the same dimensions) and thus immediately apply its T-A table.
if(n->tam){
if(n->leny == rows && n->lenx == cols){
tam = n->tam;
reuse = true;
}
}
int parse_start = 0;
if(!reuse){
tam = malloc(sizeof(*tam) * rows * cols);
if(tam == NULL){
return -1;
}
memset(tam, 0, sizeof(*tam) * rows * cols);
}
if(fbuf_init(&s->glyph)){
free(tam);
return -1;
}
if(write_iterm_graphic(tam, data, leny, linesize, lenx, &s->glyph)){
if(!reuse){
free(tam);
}
fbuf_free(&s->glyph);
return -1;
}
scrub_tam_boundaries(tam, leny, lenx, s->cellpxy, s->cellpxx);
if(plane_blit_sixel(s, &s->glyph, leny, lenx, parse_start, tam) < 0){
if(!reuse){
free(tam);
}
fbuf_free(&s->glyph);
return -1;
}
return 1;
}

@ -166,11 +166,9 @@ int kitty_wipe(sprixel* s, int ycell, int xcell);
int kitty_wipe_animation(sprixel* s, int ycell, int xcell);
int kitty_wipe_selfref(sprixel* s, int ycell, int xcell);
// wipes out a cell by changing the alpha value throughout the PNG cell to 0.
int iterm_wipe(sprixel* s, int ycell, int xcell);
int fbcon_wipe(sprixel* s, int ycell, int xcell);
int sixel_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
int kitty_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
int iterm_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
int fbcon_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
int kitty_rebuild_animation(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
int kitty_rebuild_selfref(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
@ -178,8 +176,6 @@ int sixel_draw(const tinfo* ti, const struct ncpile *p, sprixel* s,
fbuf* f, int y, int x);
int kitty_draw(const tinfo* ti, const struct ncpile *p, sprixel* s,
fbuf* f, int y, int x);
int iterm_draw(const tinfo* ti, const struct ncpile *p, sprixel* s,
fbuf* f, int y, int x);
int kitty_move(sprixel* s, fbuf* f, unsigned noscroll);
int sixel_scrub(const struct ncpile* p, sprixel* s);
int kitty_scrub(const struct ncpile* p, sprixel* s);
@ -197,8 +193,6 @@ int sixel_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int kitty_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int iterm_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int kitty_blit_animated(struct ncplane* n, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int kitty_blit_selfref(struct ncplane* nc, int linesize, const void* data,

@ -67,27 +67,6 @@ setup_sixel_bitmaps(tinfo* ti, int fd, bool invert80){
sprite_init(ti, fd);
}
// iterm2 has a container-based protocol
static inline void
setup_iterm_bitmaps(tinfo* ti, int fd){
ti->pixel_init = NULL;
ti->pixel_shutdown = NULL;
ti->pixel_remove = NULL;
// be awarre: absence of pixel_move plus absence of sixel details is used by
// notcurses-info to determine iTerm2 support.
ti->pixel_move = NULL;
ti->color_registers = 0;
ti->pixel_scrub = sixel_scrub;
ti->pixel_scroll = NULL;
ti->pixel_draw = iterm_draw;
ti->pixel_draw_late = NULL;
ti->pixel_wipe = iterm_wipe;
ti->pixel_rebuild = iterm_rebuild;
ti->pixel_trans_auxvec = kitty_trans_auxvec;
set_pixel_blitter(iterm_blit);
sprite_init(ti, fd);
}
// kitty 0.19.3 didn't have C=1, and thus needs sixel_maxy_pristine. it also
// lacked animation, and must thus redraw the complete image every time it
// changes. requires the older interface.
@ -578,7 +557,6 @@ apply_term_heuristics(tinfo* ti, const char* termname, queried_terminals_e qterm
}
ti->caps.quadrants = true;
ti->caps.rgb = true;
setup_iterm_bitmaps(ti, ti->ttyfd);
}else if(qterm == TERMINAL_APPLE){
termname = "Terminal.app";
// no quadrants, no sextants, no rgb, but it does have braille

Loading…
Cancel
Save