Skip to content

Commit

Permalink
blitsets: break up egcs/plotegcs, use latter for plots #1490
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed May 31, 2021
1 parent 2e0ae78 commit c72572c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
27 changes: 18 additions & 9 deletions src/lib/blit.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,23 +857,32 @@ braille_blit(ncplane* nc, int linesize, const void* data,
// always be the full block █ (note that this will be rendered as a space, so
// it's safe to use even in the NCBLIT_1x1 ASCII case).
static struct blitset notcurses_blitters[] = {
{ .geom = NCBLIT_8x1, .width = 1, .height = 8, .egcs = L" ▁▂▃▄▅▆▇█",
{ .geom = NCBLIT_8x1, .width = 1, .height = 8,
.egcs = NULL, .plotegcs = L" ▁▂▃▄▅▆▇█",
.blit = tria_blit, .name = "eightstep", .fill = false, },
{ .geom = NCBLIT_1x1, .width = 1, .height = 1, .egcs = L" █",
{ .geom = NCBLIT_1x1, .width = 1, .height = 1,
.egcs = L" █", .plotegcs = L" █",
.blit = tria_blit_ascii,.name = "ascii", .fill = false, },
{ .geom = NCBLIT_2x1, .width = 1, .height = 2, .egcs = L" ▀▄█",
{ .geom = NCBLIT_2x1, .width = 1, .height = 2,
.egcs = L" ▀▄█", .plotegcs = L" ▄█",
.blit = tria_blit, .name = "half", .fill = false, },
{ .geom = NCBLIT_2x2, .width = 2, .height = 2, .egcs = L" ▘▝▀▖ ▌▞▛▗▚▐▜▄▙▟█",
{ .geom = NCBLIT_2x2, .width = 2, .height = 2,
.egcs = L" ▗▐▖▄▟▌▙█", .plotegcs = L" ▘▝▀▖▌▞▛▗▚▐▜▄▙▟█",
.blit = quadrant_blit, .name = "quad", .fill = false, },
{ .geom = NCBLIT_3x2, .width = 2, .height = 3, .egcs = L" 🬞🬦▐🬏🬭🬵🬷🬓🬱🬹🬻▌🬲🬺█",
{ .geom = NCBLIT_3x2, .width = 2, .height = 3,
.egcs = L" 🬞🬦▐🬏🬭🬵🬷🬓🬱🬹🬻▌🬲🬺█", .plotegcs = NULL,
.blit = sextant_blit, .name = "sex", .fill = false, },
{ .geom = NCBLIT_4x1, .width = 1, .height = 4, .egcs = L" ▂▄▆█",
{ .geom = NCBLIT_4x1, .width = 1, .height = 4,
.egcs = NULL, .plotegcs = L" ▂▄▆█",
.blit = tria_blit, .name = "fourstep", .fill = false, },
{ .geom = NCBLIT_BRAILLE, .width = 2, .height = 4, .egcs = L"⠀⢀⢠⢰⢸⡀⣀⣠⣰⣸⡄⣄⣤⣴⣼⡆⣆⣦⣶⣾⡇⣇⣧⣷⣿",
{ .geom = NCBLIT_BRAILLE, .width = 2, .height = 4,
.egcs = L"⠀⢀⢠⢰⢸⡀⣀⣠⣰⣸⡄⣄⣤⣴⣼⡆⣆⣦⣶⣾⡇⣇⣧⣷⣿", .plotegcs = NULL,
.blit = braille_blit, .name = "braille", .fill = true, },
{ .geom = NCBLIT_PIXEL, .width = 1, .height = 1, .egcs = L"",
{ .geom = NCBLIT_PIXEL, .width = 1, .height = 1,
.egcs = L"", .plotegcs = L"",
.blit = sixel_blit, .name = "pixel", .fill = true, },
{ .geom = 0, .width = 0, .height = 0, .egcs = NULL,
{ .geom = 0, .width = 0, .height = 0,
.egcs = NULL, .plotegcs = NULL,
.blit = NULL, .name = NULL, .fill = false, },
};

Expand Down
1 change: 1 addition & 0 deletions src/lib/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ struct blitset {
// quickly, i.e. it can be indexed as height arrays of 1 + height glyphs. i.e.
// the first five braille EGCs are all 0 on the left, [0..4] on the right.
const wchar_t* egcs;
const wchar_t* plotegcs;
ncblitter blit;
const char* name;
bool fill;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int redraw_plot_##T(nc##X##plot* ncp){ \
direction, drawing egcs from the grid specification, aborting early if \
we can't draw anything in a given cell. */ \
T intervalbase = ncp->miny; \
const wchar_t* egc = ncp->bset->egcs; \
const wchar_t* egc = ncp->bset->plotegcs; \
bool done = !ncp->bset->fill; \
for(int y = 0 ; y < dimy ; ++y){ \
uint64_t channels = 0; \
Expand Down

0 comments on commit c72572c

Please sign in to comment.