7 memset(&default_opts, 0,
sizeof(default_opts));
38static const char right_egcs[8][5] = {
39 " ",
"🮇",
"🮇",
"🮈",
"▐",
"🮉",
"🮊",
"🮋",
42static const char left_egcs[8][5] = {
43 " ",
"▏",
"▎",
"▍",
"▌",
"▋",
"▊",
"▉",
46static const char down_egcs[8][5] = {
47 " ",
"▔",
"🮂",
"🮃",
"▀",
"🮄",
"🮅",
"🮆",
50static const char up_egcs[8][5] = {
51 " ",
"▁",
"▂",
"▃",
"▄",
"▅",
"▆",
"▇",
60 const bool horizontal = dimx > dimy;
63 uint32_t
ul,
ur, bl, br;
70 ul =
n->urchannel;
ur =
n->brchannel;
71 bl =
n->ulchannel; br =
n->blchannel;
74 ul =
n->blchannel;
ur =
n->ulchannel;
75 bl =
n->brchannel; br =
n->urchannel;
83 ul =
n->brchannel;
ur =
n->blchannel;
84 bl =
n->urchannel; br =
n->ulchannel;
87 ul =
n->ulchannel;
ur =
n->urchannel;
88 bl =
n->blchannel; br =
n->brchannel;
97 if(
ncplane_gradient(ncp, -1, -1, 0, 0,
" ", 0,
ul,
ur, bl, br) <= 0){
109 double eachcell = (1.0 / range);
110 double chunk =
n->progress;
111 const int chunks =
n->progress / eachcell;
112 chunk -= eachcell * chunks;
113 pos += delt * chunks;
124 const int egcidx = (int)(chunk / (eachcell / 8));
125 const char*
egc = egcs + egcidx * 5;
127 for(
unsigned freepos = 0 ; freepos < dimy ; ++freepos){
129 nccell*
c = ncplane_cell_ref_yx(ncp, freepos, pos);
130 if(pool_blit_direct(&ncp->
pool,
c,
egc, strlen(
egc), 1) <= 0){
133 cell_set_bchannel(
c, 0);
135 if(ncplane_putchar_yx(ncp, freepos, pos,
' ') <= 0){
141 for(
unsigned freepos = 0 ; freepos < dimx ; ++freepos){
143 nccell*
c = ncplane_cell_ref_yx(ncp, pos, freepos);
144 if(pool_blit_direct(&ncp->
pool,
c,
egc, strlen(
egc), 1) <= 0){
147 cell_set_bchannel(
c, 0);
149 if(ncplane_putchar_yx(ncp, pos, freepos,
' ') <= 0){
157 while(pos >= 0 && pos < range){
159 for(
unsigned freepos = 0 ; freepos < dimy ; ++freepos){
160 nccell*
c = ncplane_cell_ref_yx(ncp, freepos, pos);
165 for(
unsigned freepos = 0 ; freepos < dimx ; ++freepos){
166 nccell*
c = ncplane_cell_ref_yx(ncp, pos, freepos);
183 return progbar_redraw(
n);
192 if(ncplane_set_widget(
n->ncp,
NULL,
NULL) == 0){
API int API int API int uint64_t ul
API int API int API int uint64_t uint64_t ur
int ncplane_gradient2x1(ncplane *n, int y, int x, unsigned ylen, unsigned xlen, uint32_t ul, uint32_t ur, uint32_t ll, uint32_t lr)
int ncplane_gradient(ncplane *n, int y, int x, unsigned ylen, unsigned xlen, const char *egc, uint16_t stylemask, uint64_t ul, uint64_t ur, uint64_t bl, uint64_t br)
#define logerror(fmt,...)
void ncplane_home(ncplane *n)
int ncplane_destroy(ncplane *ncp)
notcurses * ncplane_notcurses(const ncplane *n)
void ncplane_dim_yx(const ncplane *n, unsigned *rows, unsigned *cols)
#define NCPROGBAR_OPTION_RETROGRADE
const struct ncplane_options * opts
ncprogbar * ncprogbar_create(ncplane *n, const ncprogbar_options *opts)
ncplane * ncprogbar_plane(ncprogbar *n)
void ncprogbar_destroy(ncprogbar *n)
int ncprogbar_set_progress(ncprogbar *n, double p)
double ncprogbar_progress(const ncprogbar *n)
void nccell_release(ncplane *n, nccell *c)