mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-16 00:13:00 +00:00
NCVISUAL_OPTION_MAYDEGRADE -> NCVISUAL_OPTION_NODEGRADE, doc 'em
This commit is contained in:
parent
3bc9a4cfa2
commit
b172d2b97e
@ -28,8 +28,8 @@ typedef enum {
|
||||
NCBLIT_SIXEL, // six rows, 1 column (RGB)
|
||||
} ncblitter_e;
|
||||
|
||||
#define NCVISUAL_OPTION_MAYDEGRADE 0x0001
|
||||
#define NCVISUAL_OPTION_BLEND 0x0002
|
||||
#define NCVISUAL_OPTION_NODEGRADE 0x0001
|
||||
#define NCVISUAL_OPTION_BLEND 0x0002
|
||||
|
||||
struct ncvisual_options {
|
||||
struct ncplane* n;
|
||||
@ -110,6 +110,17 @@ in the future.
|
||||
the current frame if such a subtitle was decoded. Note that a subtitle might
|
||||
be returned for multiple frames, or might not.
|
||||
|
||||
**ncvisual_render** blits the visual to an **ncplane**, based on the contents
|
||||
of its **struct ncvisual_options**. If **n** is not **NULL**, it specifies the
|
||||
plane on which to render, and **y**/**x** specify a location within that plane.
|
||||
Otherwise, a new plane will be created, and placed at **y**/**x** relative to
|
||||
the rendering area. **begy**/**begx** specify the upper left corner of a
|
||||
subsection of the **ncvisual** to render, while **leny**/**lenx** specify the
|
||||
geometry of same. **flags** is a bitfield over:
|
||||
|
||||
* **NCVISUAL_OPTION_NODEGRADE** If the specified blitter is not available, fail rather than degrading.
|
||||
* **NCVISUAL_OPTION_BLEND**: Render with **CELL_ALPHA_BLEND**.
|
||||
|
||||
# BLITTERS
|
||||
|
||||
The different **ncblitter_e** values select from among available glyph sets:
|
||||
|
@ -15,12 +15,12 @@
|
||||
* Finalize Debian changelog with `dch -r`
|
||||
* Repack DFSG-safe tarball with uscan, upload to github
|
||||
* `uscan --repack --compression xz --force`
|
||||
* `gpg --sign --armor --detach-sign notcurses_$VERSION+dfsg.1.orig.tar.xz`
|
||||
* `gpg --sign --armor --detach-sign ../notcurses_$VERSION+dfsg.1.orig.tar.xz`
|
||||
* sign, upload dfsg+sig to github
|
||||
* import new version: `gbp import-orig ../notcurses_$VERSION+dfsg.1.orig.tar.xz`
|
||||
* `git push --tags`
|
||||
* build source package: `dpkg-buildpackage --build=source`
|
||||
* build binaries: `cd .. && sudo pbuilder build *dsc`
|
||||
* build binaries: `cd .. && export TERM=xterm-256color && sudo pbuilder build *dsc`
|
||||
* perform this in xterm with TERM=xterm-256color
|
||||
* beware: freak TERMs won't be present in pbuilder
|
||||
* Copy `../*notcurses*$VERSION*` to apt repo, import with `reprepro`
|
||||
|
@ -2166,8 +2166,8 @@ API nc_err_e ncvisual_rotate(struct ncvisual* n, double rads);
|
||||
// transformation, unless the size is unchanged.
|
||||
API nc_err_e ncvisual_resize(struct ncvisual* n, int rows, int cols);
|
||||
|
||||
#define NCVISUAL_OPTION_MAYDEGRADE 0x0001 // blitter can be worse than requested
|
||||
#define NCVISUAL_OPTION_BLEND 0x0002 // use CELL_ALPHA_BLEND with visual
|
||||
#define NCVISUAL_OPTION_NODEGRADE 0x0001 // fail rather than degrading
|
||||
#define NCVISUAL_OPTION_BLEND 0x0002 // use CELL_ALPHA_BLEND with visual
|
||||
|
||||
struct ncvisual_options {
|
||||
// if no ncplane is provided, one will be created using the exact size
|
||||
@ -2745,7 +2745,7 @@ API int ncmenu_destroy(struct ncmenu* n);
|
||||
#define NCPLOT_OPTION_LABELTICKSD 0x0001 // show labels for dependent axis
|
||||
#define NCPLOT_OPTION_EXPONENTIALD 0x0002 // exponential dependent axis
|
||||
#define NCPLOT_OPTION_VERTICALI 0x0004 // independent axis is vertical
|
||||
#define NCPLOT_OPTION_MAYDEGRADE 0x0008 // blitter can be worse than requested
|
||||
#define NCPLOT_OPTION_NODEGRADE 0x0008 // fail rather than degrade blitter
|
||||
|
||||
typedef struct ncplot_options {
|
||||
// channels for the maximum and minimum levels. linear interpolation will be
|
||||
|
@ -38,7 +38,7 @@ zoom_map(struct notcurses* nc, const char* map, int* ret){
|
||||
}
|
||||
int vheight, yscale;
|
||||
int vwidth, xscale;
|
||||
if(ncvisual_geom(nc, ncv, NCBLIT_DEFAULT, &vheight, &vwidth, &yscale, &xscale)){
|
||||
if(ncvisual_geom(nc, ncv, NCBLIT_2x2, &vheight, &vwidth, &yscale, &xscale)){
|
||||
ncvisual_destroy(ncv);
|
||||
return NULL;
|
||||
}
|
||||
@ -68,6 +68,7 @@ zoom_map(struct notcurses* nc, const char* map, int* ret){
|
||||
.y = 1,
|
||||
.n = zncp,
|
||||
.scaling = NCSCALE_STRETCH,
|
||||
.blitter = NCBLIT_2x2,
|
||||
};
|
||||
if(ncvisual_render(nc, ncv, &vopts) == NULL || (*ret = demo_render(nc))){
|
||||
ncvisual_destroy(ncv);
|
||||
|
@ -218,7 +218,7 @@ int main(void){
|
||||
ncpp::Plane pplane{PLOTHEIGHT, dimx, dimy - PLOTHEIGHT, 0, nullptr};
|
||||
struct ncplot_options popts{};
|
||||
// FIXME would be nice to switch over to exponential at some level
|
||||
popts.flags = NCPLOT_OPTION_LABELTICKSD | NCPLOT_OPTION_MAYDEGRADE;
|
||||
popts.flags = NCPLOT_OPTION_LABELTICKSD;
|
||||
popts.minchannel = popts.maxchannel = 0;
|
||||
channels_set_fg_rgb(&popts.minchannel, 0x40, 0x50, 0xb0);
|
||||
channels_set_fg_rgb(&popts.maxchannel, 0x40, 0xff, 0xd0);
|
||||
|
@ -459,7 +459,7 @@ int ncblit_bgrx(const void* data, int linesize, const struct ncvisual_options* v
|
||||
if(begy < 0 || begx < 0 || lenx < -1 || leny < -1){
|
||||
return -1;
|
||||
}
|
||||
const bool degrade = (vopts->flags & NCVISUAL_OPTION_MAYDEGRADE);
|
||||
const bool degrade = !(vopts->flags & NCVISUAL_OPTION_NODEGRADE);
|
||||
const struct blitset* bset = lookup_blitset(nc->nc, vopts->blitter, degrade);
|
||||
if(bset == NULL){
|
||||
return -1;
|
||||
@ -485,7 +485,7 @@ int ncblit_rgba(const void* data, int linesize, const struct ncvisual_options* v
|
||||
if(begy < 0 || begx < 0 || lenx < -1 || leny < -1){
|
||||
return -1;
|
||||
}
|
||||
const bool degrade = (vopts->flags & NCVISUAL_OPTION_MAYDEGRADE);
|
||||
const bool degrade = !(vopts->flags & NCVISUAL_OPTION_NODEGRADE);
|
||||
const struct blitset* bset = lookup_blitset(nc->nc, vopts->blitter, degrade);
|
||||
if(bset == NULL){
|
||||
return -1;
|
||||
|
@ -32,10 +32,7 @@ class ncppplot {
|
||||
blitter = NCBLIT_1x1;
|
||||
}
|
||||
}
|
||||
bool degrade_blitter = true;
|
||||
if(opts && !(opts->flags & NCPLOT_OPTION_MAYDEGRADE)){
|
||||
degrade_blitter = false;
|
||||
}
|
||||
bool degrade_blitter = !(opts && (opts->flags & NCPLOT_OPTION_NODEGRADE));
|
||||
auto bset = lookup_blitset(ncplane_notcurses(n), blitter, degrade_blitter);
|
||||
if(bset == nullptr){
|
||||
return false;
|
||||
|
@ -65,7 +65,7 @@ auto ncvisual_geom(const notcurses* nc, const ncvisual* n, ncblitter_e blitter,
|
||||
static const struct blitset*
|
||||
rgba_blitter(const notcurses* nc, const struct ncvisual_options* opts){
|
||||
const struct blitset* bset;
|
||||
const bool maydegrade = !opts || (opts->flags & NCVISUAL_OPTION_MAYDEGRADE);
|
||||
const bool maydegrade = !(opts && (opts->flags & NCVISUAL_OPTION_NODEGRADE));
|
||||
if(opts && opts->blitter != NCBLIT_DEFAULT){
|
||||
bset = lookup_blitset(nc, opts->blitter, maydegrade);
|
||||
}else{
|
||||
|
@ -220,7 +220,6 @@ auto main(int argc, char** argv) -> int {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user