mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
sixel: write pixelon/off from tcache #1095
This commit is contained in:
parent
5bd1db168b
commit
210052906e
@ -821,10 +821,10 @@ static void
|
||||
init_banner(const notcurses* nc, const char* shortname_term){
|
||||
if(!nc->suppress_banner){
|
||||
char prefixbuf[BPREFIXSTRLEN + 1];
|
||||
term_fg_palindex(nc, stdout, nc->tcache.colors <= 256 ? 50 % nc->tcache.colors : 0x20e080);
|
||||
term_fg_palindex(nc, stdout, 50 % nc->tcache.colors);
|
||||
printf("\n notcurses %s by nick black et al", notcurses_version());
|
||||
printf(" on %s", shortname_term ? shortname_term : "?");
|
||||
term_fg_palindex(nc, stdout, nc->tcache.colors <= 256 ? 12 % nc->tcache.colors : 0x2080e0);
|
||||
term_fg_palindex(nc, stdout, 12 % nc->tcache.colors);
|
||||
if(nc->tcache.cellpixy && nc->tcache.cellpixx){
|
||||
printf("\n %d rows (%dpx) %d cols (%dpx) (%sB) %d colors",
|
||||
nc->stdplane->leny, nc->tcache.cellpixy,
|
||||
|
@ -161,10 +161,11 @@ write_rle(FILE* fp, int seenrle, unsigned char crle){
|
||||
|
||||
// Emit the sprixel in its entirety, plus enable and disable pixel mode.
|
||||
static int
|
||||
write_sixel_data(FILE* fp, int lenx, sixeltable* stab){
|
||||
write_sixel_data(ncplane* n, FILE* fp, int lenx, sixeltable* stab){
|
||||
notcurses* nc = ncplane_notcurses(n);
|
||||
// DECSDM (sixel scrolling enable) plus enter sixel mode
|
||||
// FIXME i think we can print DESDM on the first one, and never again
|
||||
fprintf(fp, "\e[?80h\ePq"); // FIXME pixelon
|
||||
fprintf(fp, nc->tcache.pixelon);
|
||||
|
||||
// Set Raster Attributes - pan/pad=1 (pixel aspect ratio), Ph=lenx, Pv=leny
|
||||
// using Ph/Pv causes a background to be drawn using color register 0 for all
|
||||
@ -209,7 +210,7 @@ write_sixel_data(FILE* fp, int lenx, sixeltable* stab){
|
||||
}
|
||||
p += lenx;
|
||||
}
|
||||
fprintf(fp, "\e\\"); // FIXME pixeloff
|
||||
fprintf(fp, nc->tcache.pixeloff);
|
||||
if(fclose(fp) == EOF){
|
||||
return -1;
|
||||
}
|
||||
@ -228,7 +229,7 @@ int sixel_blit_inner(ncplane* nc, int placey, int placex, int lenx,
|
||||
if(fp == NULL){
|
||||
return -1;
|
||||
}
|
||||
if(write_sixel_data(fp, lenx, stab)){
|
||||
if(write_sixel_data(nc, fp, lenx, stab)){
|
||||
fclose(fp);
|
||||
free(buf);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user