mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
notcurses-view: select blitter with numbers #671
This commit is contained in:
parent
2b31d6ce4d
commit
c0f820db94
@ -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)**
|
||||
|
@ -1,9 +1,9 @@
|
||||
% notcurses_ncvisual(3)
|
||||
% notcurses_visual(3)
|
||||
% nick black <nickblack@linux.com>
|
||||
% v1.4.4.1
|
||||
|
||||
# NAME
|
||||
notcurses_ncvisual - notcurses multimedia
|
||||
notcurses_visual - notcurses multimedia
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<ncblitter_e>(ie - '0');
|
||||
}else if(ie == NCKey::Resize){
|
||||
--i; // rerun with the new size
|
||||
if(!nc.refresh(&dimy, &dimx)){
|
||||
|
Loading…
x
Reference in New Issue
Block a user