|
|
@ -45,12 +45,14 @@ typedef struct nc##X##plot { \
|
|
|
|
\
|
|
|
|
\
|
|
|
|
int redraw_plot_##T(nc##X##plot* ncp){ \
|
|
|
|
int redraw_plot_##T(nc##X##plot* ncp){ \
|
|
|
|
ncplane_erase(ncp->plot.ncp); \
|
|
|
|
ncplane_erase(ncp->plot.ncp); \
|
|
|
|
const int scale = ncp->plot.bset->width; \
|
|
|
|
const int scale = ncp->plot.bset->geom == NCBLIT_PIXEL ? \
|
|
|
|
|
|
|
|
ncplane_notcurses_const(ncp->plot.ncp)->tcache.cellpixx : ncp->plot.bset->width; \
|
|
|
|
int dimy, dimx; \
|
|
|
|
int dimy, dimx; \
|
|
|
|
ncplane_dim_yx(ncp->plot.ncp, &dimy, &dimx); \
|
|
|
|
ncplane_dim_yx(ncp->plot.ncp, &dimy, &dimx); \
|
|
|
|
const int scaleddim = dimx * scale; \
|
|
|
|
const int scaleddim = dimx * scale; \
|
|
|
|
/* each transition is worth this much change in value */ \
|
|
|
|
/* each transition is worth this much change in value */ \
|
|
|
|
const size_t states = ncp->plot.bset->height + 1; \
|
|
|
|
const size_t states = (ncp->plot.bset->geom == NCBLIT_PIXEL ? \
|
|
|
|
|
|
|
|
ncplane_notcurses_const(ncp->plot.ncp)->tcache.cellpixy : ncp->plot.bset->height) + 1; \
|
|
|
|
/* FIXME can we not rid ourselves of this meddlesome double? either way, the \
|
|
|
|
/* FIXME can we not rid ourselves of this meddlesome double? either way, the \
|
|
|
|
interval is one row's range (for linear plots), or the base (base^slots== \
|
|
|
|
interval is one row's range (for linear plots), or the base (base^slots== \
|
|
|
|
maxy-miny) of the range (for exponential plots). */ \
|
|
|
|
maxy-miny) of the range (for exponential plots). */ \
|
|
|
@ -138,6 +140,7 @@ int redraw_plot_##T(nc##X##plot* ncp){ \
|
|
|
|
calc_gradient_channels(&channels, ncp->plot.minchannels, ncp->plot.minchannels, \
|
|
|
|
calc_gradient_channels(&channels, ncp->plot.minchannels, ncp->plot.minchannels, \
|
|
|
|
ncp->plot.maxchannels, ncp->plot.maxchannels, y, x, dimy, dimx); \
|
|
|
|
ncp->plot.maxchannels, ncp->plot.maxchannels, y, x, dimy, dimx); \
|
|
|
|
ncplane_set_channels(ncp->plot.ncp, channels); \
|
|
|
|
ncplane_set_channels(ncp->plot.ncp, channels); \
|
|
|
|
|
|
|
|
if(egc){ \
|
|
|
|
size_t egcidx = 0, sumidx = 0; \
|
|
|
|
size_t egcidx = 0, sumidx = 0; \
|
|
|
|
/* if we've got at least one interval's worth on the number of positions \
|
|
|
|
/* if we've got at least one interval's worth on the number of positions \
|
|
|
|
times the number of intervals per position plus the starting offset, \
|
|
|
|
times the number of intervals per position plus the starting offset, \
|
|
|
@ -161,14 +164,14 @@ int redraw_plot_##T(nc##X##plot* ncp){ \
|
|
|
|
}else{ \
|
|
|
|
}else{ \
|
|
|
|
egcidx = 0; \
|
|
|
|
egcidx = 0; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
/* printf(stderr, "y: %d i(scale): %d gvals[%d]: %ju egcidx: %zu sumidx: %zu interval: %f intervalbase: %ju\n", y, i, i, gvals[i], egcidx, sumidx, interval, intervalbase); */ \
|
|
|
|
/* printf(stderr, "y: %d i(scale): %d gvals[%d]: %ju egcidx: %zu sumidx: %zu interval: %f intervalbase: %ju\n", y, i, i, gvals[i], egcidx, sumidx, interval, intervalbase); */ \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
/* if we're not UTF8, we can only arrive here via NCBLIT_1x1 (otherwise \
|
|
|
|
/* if we're not UTF8, we can only arrive here via NCBLIT_1x1 (otherwise \
|
|
|
|
we would have errored out during construction). even then, however, \
|
|
|
|
we would have errored out during construction). even then, however, \
|
|
|
|
we need handle ASCII differently, since it can't print full block. \
|
|
|
|
we need handle ASCII differently, since it can't print full block. \
|
|
|
|
in ASCII mode, sumidx != 0 means swap colors and use space. in all \
|
|
|
|
in ASCII mode, sumidx != 0 means swap colors and use space. in all \
|
|
|
|
modes, sumidx == 0 means don't do shit, since we erased earlier. */ \
|
|
|
|
modes, sumidx == 0 means don't do shit, since we erased earlier. */ \
|
|
|
|
/* if(sumidx)fprintf(stderr, "dimy: %d y: %d x: %d sumidx: %zu egc[%zu]: %lc\n", dimy, y, x, sumidx, sumidx, egc[sumidx]); */ \
|
|
|
|
/* if(sumidx)fprintf(stderr, "dimy: %d y: %d x: %d sumidx: %zu egc[%zu]: %lc\n", dimy, y, x, sumidx, sumidx, egc[sumidx]); */ \
|
|
|
|
if(sumidx){ \
|
|
|
|
if(sumidx){ \
|
|
|
|
if(notcurses_canutf8(ncplane_notcurses(ncp->plot.ncp))){ \
|
|
|
|
if(notcurses_canutf8(ncplane_notcurses(ncp->plot.ncp))){ \
|
|
|
|
char utf8[MB_CUR_MAX + 1]; \
|
|
|
|
char utf8[MB_CUR_MAX + 1]; \
|
|
|
@ -201,6 +204,7 @@ int redraw_plot_##T(nc##X##plot* ncp){ \
|
|
|
|
if(done){ \
|
|
|
|
if(done){ \
|
|
|
|
break; \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
|
|
|
|
} \
|
|
|
|
if(ncp->plot.exponentiali){ \
|
|
|
|
if(ncp->plot.exponentiali){ \
|
|
|
|
intervalbase = ncp->miny + pow(interval, (y + 1) * states - 1); \
|
|
|
|
intervalbase = ncp->miny + pow(interval, (y + 1) * states - 1); \
|
|
|
|
}else{ \
|
|
|
|
}else{ \
|
|
|
|