[visual] allow NCBLIT_PIXEL in ascii mode

This commit is contained in:
nick black 2021-03-28 19:40:21 -04:00
parent c67981d668
commit b92991e57b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 7 additions and 6 deletions

View File

@ -2983,7 +2983,7 @@ channels_set_bg_default(uint64_t* channels){
familiar pixel graphics routines, and then rendered to a (character- familiar pixel graphics routines, and then rendered to a (character-
graphics) plane using a variety of blitting methods: graphics) plane using a variety of blitting methods:
* Space with background color -- the only blitter that works in ASCII * Space with background color -- the only cell blitter that works in ASCII
mode. 1:1 pixels map losslessly to 2:1 cells. mode. 1:1 pixels map losslessly to 2:1 cells.
* Unicode upper- and lower-half blocks (▀ and ▄, respectively). 2:1 pixels * Unicode upper- and lower-half blocks (▀ and ▄, respectively). 2:1 pixels
map losslessly to 2:1 cells. The default blitting mode. map losslessly to 2:1 cells. The default blitting mode.
@ -2991,6 +2991,7 @@ graphics) plane using a variety of blitting methods:
* Unicode sextants. 3x2 pixels map to 2:1 cells. * Unicode sextants. 3x2 pixels map to 2:1 cells.
* Braille. 4:2 pixels map to 2:1 cells. Useful when only two colors are needed * Braille. 4:2 pixels map to 2:1 cells. Useful when only two colors are needed
in a small area, due to high resolution. in a small area, due to high resolution.
* Sixel- and Kitty-based bitmaps.
It is most typicaly to prepare `ncvisual`s from files on disk (see It is most typicaly to prepare `ncvisual`s from files on disk (see
[Multimedia](#multimedia) below); this requires Notcurses to be built against [Multimedia](#multimedia) below); this requires Notcurses to be built against
@ -3086,7 +3087,7 @@ typedef enum {
NCBLIT_2x2, // quadrants + 2x1 ▗▐ ▖▀▟▌▙ NCBLIT_2x2, // quadrants + 2x1 ▗▐ ▖▀▟▌▙
NCBLIT_3x2, // sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞 NCBLIT_3x2, // sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞
NCBLIT_BRAILLE, // 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿ NCBLIT_BRAILLE, // 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿
NCBLIT_PIXEL, // pixel graphics NCBLIT_PIXEL, // pixel graphics (also work in ASCII)
NCBLIT_4x1, // four vertical levels █▆▄▂ (plots only) NCBLIT_4x1, // four vertical levels █▆▄▂ (plots only)
NCBLIT_8x1, // eight vertical levels █▇▆▅▄▃▂▁ (plots only) NCBLIT_8x1, // eight vertical levels █▇▆▅▄▃▂▁ (plots only)
} ncblitter_e; } ncblitter_e;

View File

@ -171,12 +171,12 @@ is interpreted as an **ncalign_e** rather than an absolute position.
The different **ncblitter_e** values select from among available glyph sets: The different **ncblitter_e** values select from among available glyph sets:
* **NCBLIT_DEFAULT**: Let the **ncvisual** choose its own blitter. * **NCBLIT_DEFAULT**: Let the **ncvisual** choose its own blitter.
* **NCBLIT_1x1**: Spaces only. Works in ASCII, unlike other blitters. * **NCBLIT_1x1**: Spaces only. Works in ASCII, unlike most other blitters.
* **NCBLIT_2x1**: Adds the half blocks (▄▀) to **NCBLIT_1x1**. * **NCBLIT_2x1**: Adds the half blocks (▄▀) to **NCBLIT_1x1**.
* **NCBLIT_2x2**: Adds left and right half blocks (▌▐) and quadrants (▖▗▟▙) to **NCBLIT_2x1**. * **NCBLIT_2x2**: Adds left and right half blocks (▌▐) and quadrants (▖▗▟▙) to **NCBLIT_2x1**.
* **NCBLIT_3x2**: Adds sextants to **NCBLIT_1x1**. * **NCBLIT_3x2**: Adds sextants to **NCBLIT_1x1**.
* **NCBLIT_BRAILLE**: 4 rows and 2 columns of braille (⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿). * **NCBLIT_BRAILLE**: 4 rows and 2 columns of braille (⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿).
* **NCBLIT_PIXEL**: Adds pixel graphics. * **NCBLIT_PIXEL**: Adds pixel graphics (these also work in ASCII).
Two more blitters exist for plots, but are unsuitable for generic media: Two more blitters exist for plots, but are unsuitable for generic media:

View File

@ -897,8 +897,8 @@ const struct blitset* lookup_blitset(const tinfo* tcache, ncblitter_e setid, boo
return NULL; return NULL;
} }
} }
// the only viable blitter in ASCII is NCBLIT_1x1 // the only viable blitters in ASCII are NCBLIT_1x1 and NCBLIT_PIXEL
if(!tcache->utf8 && setid != NCBLIT_1x1){ if(!tcache->utf8 && (setid != NCBLIT_1x1 && setid != NCBLIT_PIXEL)){
if(may_degrade){ if(may_degrade){
setid = NCBLIT_1x1; setid = NCBLIT_1x1;
}else{ }else{