mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-08 01:10:23 +00:00
[zoo] clean up background
This commit is contained in:
parent
8dc396c916
commit
4153e24f8b
@ -2,8 +2,11 @@
|
||||
|
||||
// open up changes.jpg, stretch it to fill, drop it to greyscale
|
||||
static int
|
||||
draw_background(struct notcurses* nc){
|
||||
if(notcurses_canopen_images(nc)){
|
||||
draw_background(struct notcurses* nc, struct ncplane** bgp){
|
||||
*bgp = NULL;
|
||||
if(!notcurses_canopen_images(nc)){
|
||||
return 0;
|
||||
}
|
||||
struct ncplane* n = notcurses_stdplane(nc);
|
||||
char* path = find_data("changes.jpg");
|
||||
struct ncvisual* ncv = ncvisual_from_file(path);
|
||||
@ -16,13 +19,12 @@ draw_background(struct notcurses* nc){
|
||||
.n = n,
|
||||
.flags = NCVISUAL_OPTION_CHILDPLANE,
|
||||
};
|
||||
if(ncvisual_blit(nc, ncv, &vopts) == NULL){
|
||||
if((*bgp = ncvisual_blit(nc, ncv, &vopts)) == NULL){
|
||||
ncvisual_destroy(ncv);
|
||||
return -1;
|
||||
}
|
||||
ncplane_greyscale(n);
|
||||
ncvisual_destroy(ncv);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -438,8 +440,11 @@ done:
|
||||
// screen. as it does so, two widgets (selector and multiselector) come in
|
||||
// from the left and right, respectively. they then fade out.
|
||||
int zoo_demo(struct notcurses* nc){
|
||||
if(draw_background(nc)){
|
||||
struct ncplane* bgp;
|
||||
if(draw_background(nc, &bgp)){
|
||||
return -1;
|
||||
}
|
||||
return reader_demo(nc);
|
||||
int ret = reader_demo(nc);
|
||||
ncplane_destroy(bgp);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user