chunli/view: trans out

This commit is contained in:
nick black 2020-01-04 07:49:10 -05:00
parent 54fb468dfe
commit 9c8ce83f95
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 8 additions and 9 deletions

View File

@ -10,9 +10,9 @@ typedef struct chunli {
// test of sprites from files
int chunli_demo(struct notcurses* nc){
struct ncplane* stdn = notcurses_stdplane(nc);
cell c = CELL_SIMPLE_INITIALIZER(' ');
ncplane_set_base(stdn, &c);
cell b = CELL_TRIVIAL_INITIALIZER;
cell_set_fg_alpha(&b, CELL_ALPHA_TRANSPARENT);
cell_set_bg_alpha(&b, CELL_ALPHA_TRANSPARENT);
struct timespec iterdelay;
timespec_div(&demodelay, 10, &iterdelay);
int averr, dimy, dimx;
@ -33,6 +33,7 @@ int chunli_demo(struct notcurses* nc){
return -1;
}
chuns[i].n = ncvisual_plane(chuns[i].ncv);
ncplane_set_base(chuns[i].n, &b);
int thisx, thisy;
ncplane_dim_yx(chuns[i].n, &thisy, &thisx);
if(ncplane_move_yx(chuns[i].n, (dimy - thisy) / 2, (dimx - thisx) / 2)){
@ -55,9 +56,6 @@ int chunli_demo(struct notcurses* nc){
return -1;
}
struct ncplane* ncp = ncvisual_plane(ncv);
cell b = CELL_TRIVIAL_INITIALIZER;
cell_set_fg_alpha(&b, CELL_ALPHA_TRANSPARENT);
cell_set_bg_alpha(&b, CELL_ALPHA_TRANSPARENT);
ncplane_set_base(ncp, &b);
const int offsets[] = {
0, 50, 100, 154, 208, 260, 312, 368, 420, 479, 538, 588, 638, 688, 736, 786, 836, 888, 942

View File

@ -123,6 +123,10 @@ int view_demo(struct notcurses* nc){
ncplane_destroy(dsplane);
return -1;
}
cell b = CELL_TRIVIAL_INITIALIZER;
cell_set_fg_alpha(&b, CELL_ALPHA_TRANSPARENT);
cell_set_bg_alpha(&b, CELL_ALPHA_TRANSPARENT);
ncplane_set_base(ncvisual_plane(ncv2), &b);
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
demo_render(nc);

View File

@ -347,9 +347,6 @@ int ncvisual_render(const ncvisual* ncv, int begy, int begx, int leny, int lenx)
if(!rgbbase_up[3] || !rgbbase_down[3]){
cell_set_bg_alpha(c, CELL_ALPHA_TRANSPARENT);
if(!rgbbase_up[3] && !rgbbase_down[3]){
if(cell_load(ncv->ncp, c, " ") <= 0){
return -1;
}
cell_set_fg_alpha(c, CELL_ALPHA_TRANSPARENT);
}else if(!rgbbase_up[3]){ // down has the color
if(cell_load(ncv->ncp, c, "\u2584") <= 0){ // lower half block