ncplot: define 2x2 and 4x2 sets #461

pull/500/head
nick black 4 years ago committed by Nick Black
parent 4297bbb3dc
commit d274af34b9

@ -2506,12 +2506,12 @@ API int ncmenu_destroy(struct ncmenu* n);
// states: empty, the three shaded blocks, and the full block.
typedef enum {
NCPLOT_1x1, // full block █
NCPLOT_2x1, // full/(upper|left) blocks
NCPLOT_1x1x4, // shaded full blocks ▓▒░
//NCPLOT_2x2, // quadrants ▖▘▝▗ ▛ ▜ ▟ ▙ ▘▗ ▖▝
NCPLOT_2x1, // full/(upper|left) blocks
NCPLOT_1x1x4, // shaded full blocks ▓▒░
NCPLOT_2x2, // quadrants ▗▐ ▖▄▟▌▙█
NCPLOT_4x1, // four vert/horz levels █▆▄▂ / ▎▌▊█
NCPLOT_8x1, // eight vert/horz levels █▇▆▅▄▃▂▁ / ▏▎▍▌▋▊▉█
//NCPLOT_4x2, // 4 rows, 2 cols (braille) ...etc...
NCPLOT_4x2, // 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿
NCPLOT_8x1, // eight vert/horz levels █▇▆▅▄▃▂▁ / ▏▎▍▌▋▊▉█
} ncgridgeom_e;
// Plots. Given a rectilinear area, an ncplot can graph samples along some axis.

@ -219,7 +219,7 @@ int main(void){
popts.minchannel = popts.maxchannel = 0;
channels_set_fg_rgb(&popts.minchannel, 0x40, 0x50, 0xb0);
channels_set_fg_rgb(&popts.maxchannel, 0x40, 0xff, 0xd0);
popts.gridtype = static_cast<ncgridgeom_e>(NCPLOT_8x1);
popts.gridtype = static_cast<ncgridgeom_e>(NCPLOT_4x2);
plot = ncplot_create(pplane, &popts);
if(!plot){
return EXIT_FAILURE;

@ -2,13 +2,16 @@
static const struct {
ncgridgeom_e geom;
int width;
const wchar_t* egcs;
} geomdata[] = {
{ .geom = NCPLOT_1x1, .egcs = L"", },
{ .geom = NCPLOT_2x1, .egcs = L" ▄█", },
{ .geom = NCPLOT_1x1x4, .egcs = L" ▒░▓█", },
{ .geom = NCPLOT_4x1, .egcs = L" ▂▄▆█", },
{ .geom = NCPLOT_8x1, .egcs = L" ▁▂▃▄▅▆▇█", },
{ .geom = NCPLOT_1x1, .width = 1, .egcs = L"", },
{ .geom = NCPLOT_2x1, .width = 1, .egcs = L" ▄█", },
{ .geom = NCPLOT_1x1x4, .width = 1, .egcs = L" ▒░▓█", },
{ .geom = NCPLOT_2x2, .width = 2, .egcs = L" ▗▐ ▖▄▟▌▙█", },
{ .geom = NCPLOT_4x1, .width = 1, .egcs = L" ▂▄▆█", },
{ .geom = NCPLOT_4x2, .width = 2, .egcs = L" ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿", },
{ .geom = NCPLOT_8x1, .width = 1, .egcs = L" ▁▂▃▄▅▆▇█", },
};
static int

@ -145,6 +145,8 @@ TEST_CASE("Plot") {
ncplot_destroy(p);
}
// FIXME need some rendering tests, one for each geometry
CHECK(0 == notcurses_stop(nc_));
CHECK(0 == fclose(outfp_));
}

Loading…
Cancel
Save