paint: carry through pixel bit #200

pull/1377/head
nick black 3 years ago committed by Nick Black
parent a1776d950b
commit 310d8aeec9

@ -898,7 +898,7 @@ sixel_blit(ncplane* nc, int placey, int placex, int linesize,
if(pool_blit_direct(&nc->pool, c, sixel, offset, 1) <= 0){
return -1;
}
cell_set_pixels(c);
cell_set_pixels(c, 1);
} // FIXME otherwise, reset?
}
}

@ -416,7 +416,9 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np, int xoff){
}
if(!channels_pixel_p(channels)){
if(pixelmode){
// FIXME leave pixel mode
if(term_emit(n->tcache.pixeloff, n->ttyfp, false)){
return -1;
}
pixelmode = false;
}
if(channels_fg_alpha(channels) == CELL_ALPHA_TRANSPARENT){
@ -430,7 +432,9 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np, int xoff){
ncdirect_set_bg_rgb(n, channels_bg_rgb(channels));
}
}else if(!pixelmode){
// FIXME enter pixel mode
if(term_emit(n->tcache.pixelon, n->ttyfp, false)){
return -1;
}
pixelmode = true;
}
//fprintf(stderr, "%03d/%03d [%s] (%03dx%03d)\n", y, x, egc, dimy, dimx);
@ -443,6 +447,11 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np, int xoff){
// yes, we want to reset colors and emit an explicit new line following
// each line of output; this is necessary if our output is lifted out and
// used in something e.g. paste(1).
if(pixelmode){
if(term_emit(n->tcache.pixeloff, n->ttyfp, false)){
return -1;
}
}
// FIXME replace with a SGR clear
ncdirect_set_fg_default(n);
ncdirect_set_bg_default(n);

@ -634,8 +634,12 @@ cell_pixels_p(const nccell* c){
}
static inline nccell*
cell_set_pixels(nccell* c){
c->channels |= CELL_PIXEL_GRAPHICS;
cell_set_pixels(nccell* c, unsigned p){
if(p){
c->channels |= CELL_PIXEL_GRAPHICS;
}else{
c->channels &= ~CELL_PIXEL_GRAPHICS;
}
return c;
}

@ -401,6 +401,7 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
targc->stylemask = vis->stylemask;
targc->width = vis->width;
}
cell_set_pixels(targc, cell_pixels_p(vis));
crender->p = p;
}else if(cell_wide_right_p(vis)){
crender->p = p;
@ -607,9 +608,9 @@ term_putc(notcurses* nc, FILE* out, const egcpool* e, const nccell* c){
if(enter_pixel_mode(nc, out)){
return -1;
}
if(ncfputs(egcpool_extended_gcluster(e, c), out) == EOF){
return -1;
}
}
if(ncfputs(egcpool_extended_gcluster(e, c), out) == EOF){
return -1;
}
}else{
if(nc->rstate.pixelmode){

@ -304,7 +304,7 @@ auto main(int argc, char** argv) -> int {
ncscale_e scalemode;
notcurses_options ncopts{};
ncopts.flags = NCOPTION_VERIFY_SIXEL;
ncblitter_e blitter = NCBLIT_DEFAULT;
ncblitter_e blitter = NCBLIT_PIXEL;
bool quiet = false;
bool loop = false;
auto nonopt = handle_opts(argc, argv, ncopts, &quiet, &timescale, &scalemode,

Loading…
Cancel
Save