|
|
@ -116,21 +116,7 @@ typedef struct tinfo {
|
|
|
|
// bg_collides_default is either 0x0000000 or (if in use) 0x1RRGGBB.
|
|
|
|
// bg_collides_default is either 0x0000000 or (if in use) 0x1RRGGBB.
|
|
|
|
uint32_t bg_collides_default;
|
|
|
|
uint32_t bg_collides_default;
|
|
|
|
|
|
|
|
|
|
|
|
// sprixel support. there are several different sprixel protocols, of
|
|
|
|
// bitmap support. if we support bitmaps, pixel_draw will be non-NULL
|
|
|
|
// which we support sixel and kitty. the kitty protocol is used based
|
|
|
|
|
|
|
|
// on TERM heuristics. otherwise, we attempt to detect sixel support, and
|
|
|
|
|
|
|
|
// query the details of the implementation.
|
|
|
|
|
|
|
|
int color_registers; // sixel color registers (post pixel_query_done)
|
|
|
|
|
|
|
|
int sixel_maxx; // maximum theoretical sixel width
|
|
|
|
|
|
|
|
// in sixel, we can't render to the bottom row, lest we force a one-line
|
|
|
|
|
|
|
|
// scroll. we thus clamp sixel_maxy_pristine to the minimum of
|
|
|
|
|
|
|
|
// sixel_maxy_pristine (the reported sixel_maxy), and the number of rows
|
|
|
|
|
|
|
|
// less one times the cell height. sixel_maxy is thus recomputed whenever
|
|
|
|
|
|
|
|
// we get a resize event. it is only defined if we have sixel_maxy_pristine,
|
|
|
|
|
|
|
|
// so kitty graphics (which don't force a scroll) never deal with this.
|
|
|
|
|
|
|
|
int sixel_maxy; // maximum working sixel height
|
|
|
|
|
|
|
|
int sixel_maxy_pristine; // maximum theoretical sixel height, as queried
|
|
|
|
|
|
|
|
int (*pixel_destroy)(const struct notcurses* nc, const struct ncpile* p, FILE* out, struct sprixel* s);
|
|
|
|
|
|
|
|
// wipe out a cell's worth of pixels from within a sprixel. for sixel, this
|
|
|
|
// 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,
|
|
|
|
// means leaving out the pixels (and likely resizes the string). for kitty,
|
|
|
|
// this means dialing down their alpha to 0 (in equivalent space).
|
|
|
|
// this means dialing down their alpha to 0 (in equivalent space).
|
|
|
@ -142,14 +128,28 @@ typedef struct tinfo {
|
|
|
|
int (*pixel_draw)(const struct ncpile* p, struct sprixel* s, FILE* out);
|
|
|
|
int (*pixel_draw)(const struct ncpile* p, struct sprixel* s, FILE* out);
|
|
|
|
// execute move (erase old graphic, place at new location) if non-NULL
|
|
|
|
// execute move (erase old graphic, place at new location) if non-NULL
|
|
|
|
int (*pixel_move)(const struct ncpile* p, struct sprixel* s, FILE* out);
|
|
|
|
int (*pixel_move)(const struct ncpile* p, struct sprixel* s, FILE* out);
|
|
|
|
|
|
|
|
int (*pixel_destroy)(const struct notcurses* nc, const struct ncpile* p, FILE* out, struct sprixel* s);
|
|
|
|
int (*pixel_shutdown)(int fd); // called during context shutdown
|
|
|
|
int (*pixel_shutdown)(int fd); // called during context shutdown
|
|
|
|
int (*pixel_clear_all)(int fd); // called during startup, kitty only
|
|
|
|
int (*pixel_clear_all)(int fd); // called during startup, kitty only
|
|
|
|
|
|
|
|
// sprixel parameters. there are several different sprixel protocols, of
|
|
|
|
|
|
|
|
// which we support sixel and kitty. the kitty protocol is used based
|
|
|
|
|
|
|
|
// on TERM heuristics. otherwise, we attempt to detect sixel support, and
|
|
|
|
|
|
|
|
// query the details of the implementation.
|
|
|
|
|
|
|
|
int color_registers; // sixel color registers (post pixel_query_done)
|
|
|
|
|
|
|
|
int sixel_maxx; // maximum theoretical sixel width
|
|
|
|
|
|
|
|
// in sixel, we can't render to the bottom row, lest we force a one-line
|
|
|
|
|
|
|
|
// scroll. we thus clamp sixel_maxy_pristine to the minimum of
|
|
|
|
|
|
|
|
// sixel_maxy_pristine (the reported sixel_maxy), and the number of rows
|
|
|
|
|
|
|
|
// less one times the cell height. sixel_maxy is thus recomputed whenever
|
|
|
|
|
|
|
|
// we get a resize event. it is only defined if we have sixel_maxy_pristine,
|
|
|
|
|
|
|
|
// so kitty graphics (which don't force a scroll) never deal with this.
|
|
|
|
|
|
|
|
int sixel_maxy; // maximum working sixel height
|
|
|
|
|
|
|
|
int sixel_maxy_pristine; // maximum theoretical sixel height, as queried
|
|
|
|
int sprixel_scale_height; // sprixel must be a multiple of this many rows
|
|
|
|
int sprixel_scale_height; // sprixel must be a multiple of this many rows
|
|
|
|
const char* termname; // terminal name from environment variables/init
|
|
|
|
const char* termname; // terminal name from environment variables/init
|
|
|
|
char* termversion; // terminal version (freeform) from query responses
|
|
|
|
char* termversion; // terminal version (freeform) from query responses
|
|
|
|
struct termios tpreserved; // terminal state upon entry
|
|
|
|
struct termios tpreserved; // terminal state upon entry
|
|
|
|
ncinputlayer input; // input layer
|
|
|
|
ncinputlayer input; // input layer
|
|
|
|
bool bitmap_supported; // do we support bitmaps (post pixel_query_done)?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// mlterm resets the cursor (i.e. makes it visible) any time you print
|
|
|
|
// mlterm resets the cursor (i.e. makes it visible) any time you print
|
|
|
|
// a sprixel. we work around this spiritedly unorthodox decision. it
|
|
|
|
// a sprixel. we work around this spiritedly unorthodox decision. it
|
|
|
|