mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
reinitialize cells to OPAQUE when reloading sprixels
This commit is contained in:
parent
df8ff1f947
commit
debd9e3578
@ -17,7 +17,8 @@ relies on the font. Patches to correct/complete this table are very welcome!
|
||||
|
||||
| Terminal | Pixel `TIOCGWINSZ` | `ccc` | Blocks | Recommended environment | Notes |
|
||||
| --------------- | ------------------ | ----- | ------ | ----------------------- | ----- |
|
||||
| [Alacritty](https://github.com/alacritty/alacritty) | ✅ | ✅ |❌ |`TERM=alacritty` `COLORTERM=24bit` | Sixel support WIP: https://github.com/ayosec/alacritty/tree/graphics |
|
||||
| [Alacritty](https://github.com/alacritty/alacritty) | ✅ | ✅ |❌ |`TERM=alacritty` `COLORTERM=24bit` | [Sixel support WIP](https://github.com/ayosec/alacritty/tree/graphics) |
|
||||
| [Contour](https://github.com/christianparpart/contour) | ❌ | ✅ |? |`TERM=contour-latest` ? | Claims Sixel support |
|
||||
| [FBterm](https://github.com/zhangyuanwei/fbterm) | ❌ | ? |? |`TERM=fbterm` | 256 colors, no RGB color. |
|
||||
| [foot](https://codeberg.org/dnkl/foot) | ✅ | ✅ |✅ |`TERM=foot` | Sixel support. |
|
||||
| [Gnome Terminal](https://gitlab.gnome.org/GNOME/gnome-terminal) | | ❌ |✅ |`TERM=gnome` `COLORTERM=24bit` | `ccc` support *is* available when run with `vte-256color`. |
|
||||
|
@ -291,8 +291,12 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx,
|
||||
}else if(tacache[tyx] == SPRIXCELL_OPAQUE){
|
||||
tacache[tyx] = SPRIXCELL_MIXED;
|
||||
}
|
||||
}else if(tacache[tyx] == SPRIXCELL_TRANSPARENT){
|
||||
tacache[tyx] = SPRIXCELL_MIXED;
|
||||
}else{
|
||||
if(x % cdimx == 0 && y % cdimy == 0){
|
||||
tacache[tyx] = SPRIXCELL_OPAQUE;
|
||||
}else if(tacache[tyx] == SPRIXCELL_TRANSPARENT){
|
||||
tacache[tyx] = SPRIXCELL_MIXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
++x;
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
// Check whether the terminal geometry has changed, and if so, copies what can
|
||||
// be copied from the old lastframe. Assumes that the screen is always anchored
|
||||
// at the same origin.
|
||||
// at the same origin. Initiates a resize cascade for the pile containing |pp|.
|
||||
// The current terminal geometry, changed or not, is written to |rows|/|cols|.
|
||||
static int
|
||||
notcurses_resize_internal(ncplane* pp, int* restrict rows, int* restrict cols){
|
||||
notcurses* n = ncplane_notcurses(pp);
|
||||
@ -64,6 +65,7 @@ notcurses_resize_internal(ncplane* pp, int* restrict rows, int* restrict cols){
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Check for a window resize on the standard pile.
|
||||
static int
|
||||
notcurses_resize(notcurses* n, int* restrict rows, int* restrict cols){
|
||||
pthread_mutex_lock(&n->pilelock);
|
||||
@ -72,6 +74,8 @@ notcurses_resize(notcurses* n, int* restrict rows, int* restrict cols){
|
||||
return ret;
|
||||
}
|
||||
|
||||
// write(2) until we've written it all. Uses poll(2) to avoid spinning on
|
||||
// EAGAIN, at a small cost of latency.
|
||||
static int
|
||||
blocking_write(int fd, const char* buf, size_t buflen){
|
||||
//fprintf(stderr, "writing %zu to %d...\n", buflen, fd);
|
||||
@ -115,6 +119,7 @@ int nccell_duplicate(ncplane* n, nccell* targ, const nccell* c){
|
||||
return 0;
|
||||
}
|
||||
|
||||
// deprecated, goes away in abi3
|
||||
int cell_duplicate(struct ncplane* n, nccell* targ, const nccell* c){
|
||||
return nccell_duplicate(n, targ, c);
|
||||
}
|
||||
|
@ -170,23 +170,25 @@ extract_color_table(const uint32_t* data, int linesize, int cols,
|
||||
for(int sy = visy ; sy < (begy + leny) && sy < visy + 6 ; ++sy){ // offset within sprixel
|
||||
const uint32_t* rgb = (data + (linesize / 4 * sy) + visx);
|
||||
int txyidx = (sy / cdimy) * cols + (visx / cdimx);
|
||||
if(rgba_trans_p(*rgb, bargs->transcolor)){
|
||||
if(tacache[txyidx] == SPRIXCELL_OPAQUE){
|
||||
if(sy % cdimy == 0 && visx % cdimx == 0){
|
||||
tacache[txyidx] = SPRIXCELL_TRANSPARENT;
|
||||
}else{
|
||||
tacache[txyidx] = SPRIXCELL_MIXED;
|
||||
}
|
||||
}
|
||||
stab->p2 = SIXEL_P2_TRANS;
|
||||
continue;
|
||||
}else if(tacache[txyidx] == SPRIXCELL_TRANSPARENT){
|
||||
tacache[txyidx] = SPRIXCELL_MIXED;
|
||||
}
|
||||
if(tacache[txyidx] == SPRIXCELL_ANNIHILATED){
|
||||
//fprintf(stderr, "TRANS SKIP %d %d %d %d (cell: %d %d)\n", visy, visx, sy, txyidx, sy / cdimy, visx / cdimx);
|
||||
continue;
|
||||
}
|
||||
if(rgba_trans_p(*rgb, bargs->transcolor)){
|
||||
if(sy % cdimy == 0 && visx % cdimx == 0){
|
||||
tacache[txyidx] = SPRIXCELL_TRANSPARENT;
|
||||
}else if(tacache[txyidx] == SPRIXCELL_OPAQUE){
|
||||
tacache[txyidx] = SPRIXCELL_MIXED;
|
||||
}
|
||||
stab->p2 = SIXEL_P2_TRANS; // even one forces P2=1
|
||||
continue;
|
||||
}else{
|
||||
if(sy % cdimy == 0 && visx % cdimx == 0){
|
||||
tacache[txyidx] = SPRIXCELL_OPAQUE;
|
||||
}else if(tacache[txyidx] == SPRIXCELL_TRANSPARENT){
|
||||
tacache[txyidx] = SPRIXCELL_MIXED;
|
||||
}
|
||||
}
|
||||
unsigned char comps[RGBSIZE];
|
||||
break_sixel_comps(comps, *rgb, mask);
|
||||
int c = find_color(stab, comps);
|
||||
|
@ -12,7 +12,7 @@ sprixel_debug(FILE* out, const sprixel* s){
|
||||
int idx = 0;
|
||||
for(int y = 0 ; y < s->dimy ; ++y){
|
||||
for(int x = 0 ; x < s->dimx ; ++x){
|
||||
fprintf(out, "%d ", s->n->tacache[idx]);
|
||||
fprintf(out, "%d", s->n->tacache[idx]);
|
||||
++idx;
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user