diff --git a/doc/man/man1/notcurses-view.1.md b/doc/man/man1/notcurses-view.1.md index 8bcb887bd..b61f318d5 100644 --- a/doc/man/man1/notcurses-view.1.md +++ b/doc/man/man1/notcurses-view.1.md @@ -40,6 +40,10 @@ area exactly. **scale** resizes the object so that the longer edge of the rendering area is matched exactly, and the other edge is changed to maintain aspect ratio. **none** uses the original image size. +Blitters can be selected by pressing '0' through '8'. **NCBLIT_DEFAULT** +corresponds to '0'. The various blitters are described in +**notcurses_visual**. + # NOTES Optimal display requires a terminal advertising the **rgb** terminfo(5) @@ -50,6 +54,6 @@ fixed-width font with good coverage of the Unicode Block Drawing Characters. # SEE ALSO **notcurses(3)**, -**notcurses_ncvisual(3)**, +**notcurses_visual(3)**, **terminfo(5)**, **unicode(7)** diff --git a/doc/man/man3/notcurses_visual.3.md b/doc/man/man3/notcurses_visual.3.md index ed5730b6a..8b486839a 100644 --- a/doc/man/man3/notcurses_visual.3.md +++ b/doc/man/man3/notcurses_visual.3.md @@ -1,9 +1,9 @@ -% notcurses_ncvisual(3) +% notcurses_visual(3) % nick black % v1.4.4.1 # NAME -notcurses_ncvisual - notcurses multimedia +notcurses_visual - notcurses multimedia # SYNOPSIS diff --git a/src/lib/blitset.h b/src/lib/blitset.h index 825f56b49..cb282f0d3 100644 --- a/src/lib/blitset.h +++ b/src/lib/blitset.h @@ -15,11 +15,15 @@ lookup_blitset(const struct notcurses* nc, ncblitter_e setid, bool may_degrade) } const struct blitset* bset = notcurses_blitters; while(bset->egcs){ - if(bset->geom == setid){ + if(bset->geom == setid && bset->blit){ return bset; } ++bset; } + // handle other currently-invalid blitters via degrade + if(may_degrade){ + return lookup_blitset(nc, NCBLIT_2x1, true); + } return NULL; } diff --git a/src/view/view.cpp b/src/view/view.cpp index f1ff00ba4..65486cada 100644 --- a/src/view/view.cpp +++ b/src/view/view.cpp @@ -106,6 +106,9 @@ auto perframe(struct ncplane* n, struct ncvisual* ncv, if(keyp == NCKEY_RESIZE){ return 0; } + if(keyp >= '0' && keyp <= '8'){ // FIXME eliminate ctrl/alt + // FIXME change blitter -- how? + } return 1; } } @@ -195,6 +198,7 @@ auto main(int argc, char** argv) -> int { std::cerr << "Notcurses was compiled without multimedia support\n"; return EXIT_FAILURE; } + ncblitter_e blitter = NCBLIT_DEFAULT; int dimy, dimx; bool failed = false; { @@ -214,6 +218,8 @@ auto main(int argc, char** argv) -> int { struct ncvisual_options vopts{}; vopts.n = *stdn; vopts.scaling = scalemode; + vopts.blitter = blitter; + vopts.flags = NCVISUAL_OPTION_MAYDEGRADE; int r = ncv->stream(&vopts, &err, timescale, perframe, &frames); if(r < 0){ // positive is intentional abort std::cerr << "Error decoding " << argv[i] << ": " << nc_strerror(err) << std::endl; @@ -228,6 +234,9 @@ auto main(int argc, char** argv) -> int { break; }else if(ie == 'q'){ break; + }else if(ie >= '0' && ie <= '8'){ + --i; // rerun same input with the new blitter + blitter = static_cast(ie - '0'); }else if(ie == NCKey::Resize){ --i; // rerun with the new size if(!nc.refresh(&dimy, &dimx)){