pixelplot: set primary plane transparent but on top #1382

pull/2091/head
nick black 3 years ago committed by nick black
parent c77978d721
commit 242ec7a7bf

@ -619,6 +619,19 @@ update_sample_double(ncdplot* ncp, int64_t x, double y, bool reset){
}
}
static inline int
create_pixelp(ncplot *p, ncplane* n){
if(((p->pixelp = ncplane_dup(n, NULL)) == NULL)){
return -1;
}
ncplane_move_below(p->pixelp, n);
uint64_t basechan = 0;
ncchannels_set_bg_alpha(&basechan, NCALPHA_TRANSPARENT);
ncchannels_set_fg_alpha(&basechan, NCALPHA_TRANSPARENT);
ncplane_set_base(n, "", 0, basechan);
return 0;
}
// takes ownership of n on all paths
ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy){
ncuplot* ret = malloc(sizeof(*ret));
@ -633,7 +646,7 @@ ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, u
return NULL;
}
if(bset->geom == NCBLIT_PIXEL){
if(((ret->plot.pixelp = ncplane_dup(n, NULL)) == NULL)){
if(create_pixelp(&ret->plot, n)){
ncuplot_destroy(ret);
return NULL;
}
@ -682,7 +695,7 @@ ncdplot* ncdplot_create(ncplane* n, const ncplot_options* opts, double miny, dou
return NULL;
}
if(bset->geom == NCBLIT_PIXEL){
if(((ret->plot.pixelp = ncplane_dup(n, NULL)) == NULL)){
if(create_pixelp(&ret->plot, n)){
ncdplot_destroy(ret);
return NULL;
}

Loading…
Cancel
Save