keller: use only meaningful blitters

pull/1085/head
nick black 4 years ago committed by Nick Black
parent 09279191bf
commit 63abad4569

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

@ -3,17 +3,25 @@
// show it with each blitter, with a legend
static int
visualize(struct notcurses* nc, struct ncvisual* ncv){
for(ncblitter_e b = NCBLIT_DEFAULT + 1 ; b < NCBLIT_SIXEL ; ++b){
struct timespec ts = { .tv_sec = 0, .tv_nsec = GIG / 2, };
ncblitter_e bs[] = {
NCBLIT_1x1,
NCBLIT_2x1,
NCBLIT_2x2,
NCBLIT_3x2,
NCBLIT_BRAILLE,
};
for(size_t i = 0 ; i < sizeof(bs) / sizeof(*bs) ; ++i){
struct timespec ts;
timespec_div(&demodelay, 2, &ts);
struct ncvisual_options vopts = {
.scaling = NCSCALE_STRETCH,
.blitter = b,
.blitter = bs[i],
};
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
if(n == NULL){
return -1;
}
const char* name = notcurses_str_blitter(b);
const char* name = notcurses_str_blitter(bs[i]);
ncplane_set_bg_rgb(n, 0);
int scalex, scaley, truey, truex;
ncvisual_geom(nc, ncv, &vopts, &truey, &truex, &scaley, &scalex);
@ -23,7 +31,10 @@ visualize(struct notcurses* nc, struct ncvisual* ncv){
ncplane_printf_aligned(n, ncplane_dim_y(n) / 2 + 1, NCALIGN_CENTER,
"%d:%d pixels -> cell", scalex, scaley);
int ret = demo_render(nc);
demo_nanosleep(nc, &ts);
if(ret){
return ret;
}
ret = demo_nanosleep(nc, &ts);
ncplane_destroy(n);
if(ret){
return ret;
@ -36,7 +47,7 @@ int keller_demo(struct notcurses* nc){
if(!notcurses_canopen_images(nc)){
return 0;
}
const char* files[] = { "covid19.jpg", "warmech.bmp", NULL, };
const char* files[] = { "covid19.jpg", "aidsrobots.jpeg", "warmech.bmp", "fonts.jpg", NULL, };
for(const char** file = files ; *file ; ++file){
char* f = find_data(*file);
if(f == NULL){

Loading…
Cancel
Save