From 8d66938a0eaaccafce2653972b99d854b5e9b4e8 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 25 Oct 2020 18:49:57 -0400 Subject: [PATCH] sexblitter: purge NCBLIT_1x1x4, add NCBLIT_3x2 #1071 --- doc/man/man3/notcurses_visual.3.md | 24 ++++++++++++------------ include/notcurses/notcurses.h | 14 +++++++------- src/lib/blit.c | 13 +++++++++++-- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/doc/man/man3/notcurses_visual.3.md b/doc/man/man3/notcurses_visual.3.md index 3a5cb2f57..98cde9d83 100644 --- a/doc/man/man3/notcurses_visual.3.md +++ b/doc/man/man3/notcurses_visual.3.md @@ -18,14 +18,14 @@ typedef enum { typedef enum { NCBLIT_DEFAULT, // let the ncvisual pick - NCBLIT_1x1, // full block █ - NCBLIT_2x1, // upper half + 1x1 ▀█ - NCBLIT_1x1x4, // shaded full blocks ▓▒░█ - NCBLIT_2x2, // quadrants + 2x1 ▗▐ ▖▀▟▌▙█ - NCBLIT_4x1, // four vertical levels █▆▄▂ - NCBLIT_BRAILLE, // 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿ - NCBLIT_8x1, // eight vertical levels █▇▆▅▄▃▂▁ - NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals + NCBLIT_1x1, // spaces only + NCBLIT_2x1, // halves + 1x1 + NCBLIT_2x2, // quadrants + 2x1 + NCBLIT_3x2, // sextants + 1x1 + NCBLIT_4x1, // four vertical levels + NCBLIT_BRAILLE, // 4 rows, 2 cols (braille) + NCBLIT_8x1, // eight vertical levels + NCBLIT_SIXEL, // 6 rows, 1 col (RGB) } ncblitter_e; #define NCVISUAL_OPTION_NODEGRADE 0x0001 @@ -37,7 +37,7 @@ struct ncvisual_options { int y, x; int begy, begx; // origin of rendered section int leny, lenx; // size of rendered section - ncblitter_e blitter; // glyph set to use (maps input to output cells) + ncblitter_e blitter; // glyph set to use uint64_t flags; // bitmask over NCVISUAL_OPTION_* }; @@ -147,10 +147,10 @@ geometry of same. **flags** is a bitfield over: The different **ncblitter_e** values select from among available glyph sets: * **NCBLIT_DEFAULT**: Let the **ncvisual** choose its own blitter. -* **NCBLIT_1x1**: Full block (█) or empty glyph. -* **NCBLIT_2x1**: Adds the lower half block (▄) to **NCBLIT_1x1**. -* **NCBLIT_1x1x4**: Adds three shaded full blocks (▓▒░) to **NCBLIT_1x1**. +* **NCBLIT_1x1**: Spaces only. Works in ASCII, unlike other blitters. +* **NCBLIT_2x1**: Adds the half blocks (▄▀) to **NCBLIT_1x1**. * **NCBLIT_2x2**: Adds left and right half blocks (▌▐) and quadrants (▖▗▟▙) to **NCBLIT_2x1**. +* **NCBLIT_3x2**: Adds sextants to **NCBLIT_1x1**. * **NCBLIT_4x1**: Adds ¼ and ¾ blocks (▂▆) to **NCBLIT_2x1**. * **NCBLIT_BRAILLE**: 4 rows and 2 columns of braille (⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿). * **NCBLIT_8x1**: Adds ⅛, ⅜, ⅝, and ⅞ blocks (▇▅▃▁) to **NCBLIT_4x1**. diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index b88dbcd96..bf3aecc70 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -55,13 +55,13 @@ struct ncfadectx; // context for a palette fade operation // background set to the desired foreground. typedef enum { NCBLIT_DEFAULT, // let the ncvisual pick - NCBLIT_1x1, // spaces, compatible with ASCII - NCBLIT_2x1, // upper half + 1x1 (space) ▀ - NCBLIT_1x1x4, // shaded full blocks ▓▒░█ - NCBLIT_2x2, // quadrants + 2x1 ▗▐ ▖▀▟▌▙█ - NCBLIT_4x1, // four vertical levels █▆▄▂ - NCBLIT_BRAILLE, // 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿ - NCBLIT_8x1, // eight vertical levels █▇▆▅▄▃▂▁ + NCBLIT_1x1, // space, compatible with ASCII + NCBLIT_2x1, // halves + 1x1 (space) ▄▀ + NCBLIT_2x2, // quadrants + 2x1 ▗▐ ▖▀▟▌▙█ + NCBLIT_3x2, // sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻 + NCBLIT_4x1, // four vertical levels █▆▄▂ + NCBLIT_BRAILLE, // 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿ + NCBLIT_8x1, // eight vertical levels █▇▆▅▄▃▂▁ NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals } ncblitter_e; diff --git a/src/lib/blit.c b/src/lib/blit.c index a20d6870f..a3ba5701c 100644 --- a/src/lib/blit.c +++ b/src/lib/blit.c @@ -448,6 +448,15 @@ quadrant_blit(ncplane* nc, int placey, int placex, int linesize, return total; } +// quadrant blitter. maps 2x2 to each cell. since we only have two colors at +// our disposal (foreground and background), we lose some fidelity. +static inline int +sextant_blit(ncplane* nc, int placey, int placex, int linesize, + const void* data, int begy, int begx, + int leny, int lenx, bool bgr, bool blendcolors){ + return 0; +} + // fold the r, g, and b components of the pixel into *r, *g, and *b, and // increment *foldcount static inline void @@ -592,10 +601,10 @@ const struct blitset notcurses_blitters[] = { .blit = tria_blit_ascii,.name = "ascii", .fill = false, }, { .geom = NCBLIT_2x1, .width = 1, .height = 2, .egcs = L" ▄█", .blit = tria_blit, .name = "halfblock", .fill = false, }, - { .geom = NCBLIT_1x1x4, .width = 1, .height = 4, .egcs = L" ▒░▓█", - .blit = tria_blit, .name = "shadeblocks", .fill = false, }, { .geom = NCBLIT_2x2, .width = 2, .height = 2, .egcs = L" ▗▐▖▄▟▌▙█", .blit = quadrant_blit, .name = "quadblitter", .fill = false, }, + { .geom = NCBLIT_3x2, .width = 2, .height = 3, .egcs = L" 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻█", + .blit = sextant_blit, .name = "hexblitter", .fill = false, }, { .geom = NCBLIT_4x1, .width = 1, .height = 4, .egcs = L" ▂▄▆█", .blit = tria_blit, .name = "fourstep", .fill = false, }, { .geom = NCBLIT_BRAILLE, .width = 2, .height = 4, .egcs = L"⠀⢀⢠⢰⢸⡀⣀⣠⣰⣸⡄⣄⣤⣴⣼⡆⣆⣦⣶⣾⡇⣇⣧⣷⣿",