From 02303ee98e04fd9734d372b9a5eaee323aba3110 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 16 Oct 2021 01:32:58 -0400 Subject: [PATCH] notcurses-info: ncvisual_blit, inline all emoji #1462 --- src/info/main.c | 19 +++++++++++++++++-- src/poc/interp.c | 16 ++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/info/main.c b/src/info/main.c index cdbda53a9..edbc1d1d4 100644 --- a/src/info/main.c +++ b/src/info/main.c @@ -104,7 +104,21 @@ finish_line(struct ncplane* n){ static int emoji_viz(struct ncplane* n){ - static const char emoji[] = "πŸ‘ΎπŸ΄πŸ€˜πŸš¬πŸŒπŸŒŽπŸŒπŸ₯†πŸ’£πŸ—‘πŸ”«βš—οΈβš›οΈβ˜’οΈβ˜£οΈ" + static const char emoji[] = "\U0001f47e" // alien monster + "\U0001f3f4" // waving black flag + "\U0001f918" // sign of the horns + "\U0001f6ac" // cigarette, delicious + "\U0001f30d" // globe europe/africa + "\U0001f30e" // globe americas + "\U0001f30f" // globe asia/australia + "\U0001F946" // rifle + "\U0001f4a3" // bomb + "\U0001f5e1" // dagger + "\U0001F52B" // pistol + "\u2697\ufe0f" // alembic + "\u269b\ufe0f" // atom + "\u2622\ufe0f" // radiation sign + "\u2623\ufe0f" // biohazard "\U0001F33F" // herb "\U0001F3B1" // billiards "\U0001F3E7" // automated teller machine @@ -114,6 +128,7 @@ emoji_viz(struct ncplane* n){ "\U0001F4E1" // satellite antenna "\U0001F93B" // modern pentathlon "\U0001F991" // squid + "\U0001f1e6\U0001f1f6" // regional indicators AQ (antarctica) "\U0001f469\u200d\U0001f52c" // woman scientist "\U0001faa4" // mouse trap "\U0001f6b1" // non-potable water @@ -332,7 +347,7 @@ display_logo(struct ncplane* n, const char* path){ .blitter = NCBLIT_PIXEL, .flags = NCVISUAL_OPTION_CHILDPLANE | NCVISUAL_OPTION_NODEGRADE, }; - struct ncplane* bitm = ncvisual_render(ncplane_notcurses(n), ncv, &vopts); + struct ncplane* bitm = ncvisual_blit(ncplane_notcurses(n), ncv, &vopts); if(bitm == NULL){ ncvisual_destroy(ncv); return -1; diff --git a/src/poc/interp.c b/src/poc/interp.c index 13f3b7a5c..a098a0e0a 100644 --- a/src/poc/interp.c +++ b/src/poc/interp.c @@ -19,10 +19,12 @@ interp(struct notcurses* nc, int cellpixy, int cellpixx){ return -1; } struct ncvisual_options vopts = { + .n = stdn, .y = 1, .blitter = NCBLIT_PIXEL, + .flags = NCVISUAL_OPTION_CHILDPLANE | NCVISUAL_OPTION_NODEGRADE, }; - struct ncplane* ncvp = ncvisual_render(nc, ncv, &vopts); + struct ncplane* ncvp = ncvisual_blit(nc, ncv, &vopts); if(ncvp == NULL){ free(randrgb); return -1; @@ -38,7 +40,7 @@ interp(struct notcurses* nc, int cellpixy, int cellpixx){ vopts.n = scalep; vopts.scaling = NCSCALE_STRETCH; popts.x += ncplane_dim_x(scalep) + 1; - if(ncvisual_render(nc, ncv, &vopts) == NULL){ + if(ncvisual_blit(nc, ncv, &vopts) == NULL){ free(randrgb); return -1; } @@ -46,7 +48,7 @@ interp(struct notcurses* nc, int cellpixy, int cellpixx){ struct ncplane* scalepni = ncplane_create(stdn, &popts); vopts.n = scalepni; vopts.flags = NCVISUAL_OPTION_NOINTERPOLATE; - if(ncvisual_render(nc, ncv, &vopts) == NULL){ + if(ncvisual_blit(nc, ncv, &vopts) == NULL){ free(randrgb); return -1; } @@ -64,7 +66,7 @@ interp(struct notcurses* nc, int cellpixy, int cellpixx){ vopts.flags = 0; vopts.n = resizep; vopts.scaling = NCSCALE_NONE; - if(ncvisual_render(nc, ncv, &vopts) == NULL){ + if(ncvisual_blit(nc, ncv, &vopts) == NULL){ free(randrgb); return -1; } @@ -81,7 +83,7 @@ interp(struct notcurses* nc, int cellpixy, int cellpixx){ if(ncvisual_resize_noninterpolative(ncv, popts.rows * cellpixy, popts.cols * cellpixx)){ return -1; } - if(ncvisual_render(nc, ncv, &vopts) == NULL){ + if(ncvisual_blit(nc, ncv, &vopts) == NULL){ return -1; } ncplane_putstr_yx(stdn, 2, 41, "resize(no)"); @@ -108,7 +110,9 @@ int main(void){ goto err; } ncinput ni; - notcurses_getc_blocking(nc, &ni); + do{ + notcurses_getc_blocking(nc, &ni); + }while(ni.id != (uint32_t)-1 && ni.evtype != NCTYPE_RELEASE); notcurses_stop(nc); return EXIT_SUCCESS;