introduce NCVISUAL_OPTION_BLEND #652

pull/658/head
nick black 4 years ago
parent acd956393b
commit 0331ae4c4c
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1839,7 +1839,7 @@ typedef struct ncreel_options {
uint64_t tabletchan; // tablet border styling channel
uint64_t focusedchan;// focused tablet border styling channel
uint64_t bgchannel; // background colors
unsigned flags; // bitfield over NCREEL_OPTIONS_*
unsigned flags; // bitfield over NCREEL_OPTION_*
} ncreel_options;
struct nctablet;

Binary file not shown.

@ -25,15 +25,15 @@ struct ncmenu_section {
int itemcount;
};
#define NCMENU_OPTIONS_BOTTOM 0x0001 // bottom row (as opposed to top row)
#define NCMENU_OPTIONS_HIDING 0x0002 // hide the menu when not being used
#define NCMENU_OPTION_BOTTOM 0x0001 // bottom row (as opposed to top row)
#define NCMENU_OPTION_HIDING 0x0002 // hide the menu when not being used
typedef struct ncmenu_options {
struct ncmenu_section* sections; // 'sectioncount' menu_sections
int sectioncount; // must be positive
uint64_t headerchannels; // styling for header
uint64_t sectionchannels; // styling for sections
unsigned flags; // bitfield on NCMENU_OPTIONS_*
unsigned flags; // bitfield on NCMENU_OPTION_*
} ncmenu_options;
```

@ -39,7 +39,7 @@ typedef struct ncmultiselector_options {
uint64_t footchannels; // secondary and footer channels
uint64_t boxchannels; // border channels
uint64_t bgchannels; // background channels for body
unsigned flags; // bitfield over NCMULTISELECTOR_OPTIONS_*
unsigned flags; // bitfield over NCMULTISELECTOR_OPTION_*
} ncmultiselector_options;
```

@ -11,9 +11,9 @@ notcurses_plot - high level widget for plotting
**#include <notcurses/notcurses.h>**
```c
#define NCPLOT_OPTIONS_LABELTICKSD 0x0001
#define NCPLOT_OPTIONS_EXPONENTIALD 0x0002
#define NCPLOT_OPTIONS_VERTICALI 0x0004
#define NCPLOT_OPTION_LABELTICKSD 0x0001
#define NCPLOT_OPTION_EXPONENTIALD 0x0002
#define NCPLOT_OPTION_VERTICALI 0x0004
typedef struct ncplot_options {
// channels for the maximum and minimum levels.
@ -77,9 +77,9 @@ how the braille glyphs will look in a given font.
The same **ncplot_options** struct can be used with all ncplot types. The
**flags** field is a bitmask composed of:
* **NCPLOT_OPTIONS_LABELTICKSD**: Label dependent axis ticks.
* **NCPLOT_OPTIONS_EXPONENTIALD**: Use an exponential dependent axis.
* **NCPLOT_OPTIONS_VERTICALI**: Vertical independent axis.
* **NCPLOT_OPTION_LABELTICKSD**: Label dependent axis ticks.
* **NCPLOT_OPTION_EXPONENTIALD**: Use an exponential dependent axis.
* **NCPLOT_OPTION_VERTICALI**: Vertical independent axis.
# NOTES

@ -27,7 +27,7 @@ typedef struct ncreader_options {
char* egc; // egc used for empty space
int physrows;
int physcols;
unsigned flags; // bitfield over NCREADER_OPTIONS_*
unsigned flags; // bitfield over NCREADER_OPTION_*
} ncreader_options;
```

@ -11,8 +11,8 @@ notcurses_reel - high-level widget for hierarchical data
**#include <notcurses/notcurses.h>**
```c
#define NCREEL_OPTIONS_INFINITESCROLL 0x0001
#define NCREEL_OPTIONS_CIRCULAR 0x0002
#define NCREEL_OPTION_INFINITESCROLL 0x0001
#define NCREEL_OPTION_CIRCULAR 0x0002
typedef struct ncreel_options {
// require this many rows and columns (including borders).
@ -48,7 +48,7 @@ typedef struct ncreel_options {
uint64_t tabletchan; // tablet border styling channel
uint64_t focusedchan;// focused tablet border styling channel
uint64_t bgchannel; // background colors
unsigned flags; // bitfield over NCREEL_OPTIONS_*
unsigned flags; // bitfield over NCREEL_OPTION_*
} ncreel_options;
```

@ -38,7 +38,7 @@ typedef struct ncselector_options {
uint64_t footchannels; // secondary and footer channels
uint64_t boxchannels; // border channels
uint64_t bgchannels; // background channels for body
unsigned flags; // bitfield over NCSELECTOR_OPTIONS_*
unsigned flags; // bitfield over NCSELECTOR_OPTION_*
} ncselector_options;
```

@ -28,7 +28,8 @@ typedef enum {
NCBLIT_SIXEL, // six rows, 1 column (RGB)
} ncblitter_e;
#define NCVISUAL_OPTIONS_MAYDEGRADE 0x0001
#define NCVISUAL_OPTION_MAYDEGRADE 0x0001
#define NCVISUAL_OPTION_BLEND 0x0002
struct ncvisual_options {
struct ncplane* n;
@ -37,7 +38,7 @@ struct ncvisual_options {
int begy, begx; // origin of rendered section
int leny, lenx; // size of rendered section
ncblitter_e blitter; // glyph set to use (maps input to output cells)
uint64_t flags; // bitmask over NCVISUAL_OPTIONS_*
uint64_t flags; // bitmask over NCVISUAL_OPTION_*
};
typedef int (*streamcb)(struct notcurses*, struct ncvisual*, void*);

@ -2142,7 +2142,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_OPTIONS_MAYDEGRADE 0x0001 // blitter can be worse than requested
#define NCVISUAL_OPTION_MAYDEGRADE 0x0001 // blitter can be worse than requested
#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
@ -2166,7 +2167,7 @@ struct ncvisual_options {
// use NCBLIT_DEFAULT if you don't care, to use NCBLIT_2x2 (assuming
// UTF8) or NCBLIT_1x1 (in an ASCII environment)
ncblitter_e blitter; // glyph set to use (maps input to output cells)
uint64_t flags; // bitmask over NCVISUAL_OPTIONS_*
uint64_t flags; // bitmask over NCVISUAL_OPTION_*
};
// Render the decoded frame to the specified ncplane (if one is not provided,
@ -2254,11 +2255,11 @@ API int ncblit_rgba(struct ncplane* nc, int placey, int placex, int linesize,
// is scrolling infinite (can one move down or up forever, or is an end
// reached?). if true, 'circular' specifies how to handle the special case of
// an incompletely-filled reel.
#define NCREEL_OPTIONS_INFINITESCROLL 0x0001
#define NCREEL_OPTION_INFINITESCROLL 0x0001
// is navigation circular (does moving down from the last panel move to the
// first, and vice versa)? only meaningful when infinitescroll is true. if
// infinitescroll is false, this must be false.
#define NCREEL_OPTIONS_CIRCULAR 0x0002
#define NCREEL_OPTION_CIRCULAR 0x0002
typedef struct ncreel_options {
// require this many rows and columns (including borders). otherwise, a
@ -2290,7 +2291,7 @@ typedef struct ncreel_options {
uint64_t tabletchan; // tablet border styling channel
uint64_t focusedchan;// focused tablet border styling channel
uint64_t bgchannel; // background colors
unsigned flags; // bitfield over NCREEL_OPTIONS_*
unsigned flags; // bitfield over NCREEL_OPTION_*
} ncreel_options;
struct nctablet;
@ -2647,15 +2648,15 @@ struct ncmenu_section {
ncinput shortcut; // shortcut, will be underlined if present in name
};
#define NCMENU_OPTIONS_BOTTOM 0x0001 // bottom row (as opposed to top row)
#define NCMENU_OPTIONS_HIDING 0x0002 // hide the menu when not being used
#define NCMENU_OPTION_BOTTOM 0x0001 // bottom row (as opposed to top row)
#define NCMENU_OPTION_HIDING 0x0002 // hide the menu when not being used
typedef struct ncmenu_options {
struct ncmenu_section* sections; // array of 'sectioncount' menu_sections
int sectioncount; // must be positive
uint64_t headerchannels; // styling for header
uint64_t sectionchannels; // styling for sections
unsigned flags; // flag word of NCMENU_OPTIONS_*
unsigned flags; // flag word of NCMENU_OPTION_*
} ncmenu_options;
// Create a menu with the specified options. Menus are currently bound to an
@ -2738,10 +2739,10 @@ API int ncmenu_destroy(struct ncmenu* n);
//
// This options structure works for both the ncuplot (uint64_t) and ncdplot
// (double) types.
#define NCPLOT_OPTIONS_LABELTICKSD 0x0001 // show labels for dependent axis
#define NCPLOT_OPTIONS_EXPONENTIALD 0x0002 // exponential dependent axis
#define NCPLOT_OPTIONS_VERTICALI 0x0004 // independent axis is vertical
#define NCPLOT_OPTIONS_MAYDEGRADE 0x0008 // blitter can be worse than requested
#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
typedef struct ncplot_options {
// channels for the maximum and minimum levels. linear interpolation will be
@ -2756,7 +2757,7 @@ typedef struct ncplot_options {
// resolution, the independent variable would be the range [0..3600): 3600.
// if rangex is 0, it is dynamically set to the number of columns.
int rangex;
unsigned flags; // bitfield over NCPLOT_OPTIONS_*
unsigned flags; // bitfield over NCPLOT_OPTION_*
} ncplot_options;
// Use the provided plane 'n' for plotting according to the options 'opts'.
@ -2794,7 +2795,7 @@ typedef int(*ncfdplane_done_cb)(struct ncfdplane* n, int fderrno, void* curry);
typedef struct ncfdplane_options {
void* curry; // parameter provided to callbacks
bool follow; // keep reading after hitting end? (think tail -f)
unsigned flags; // bitfield over NCOPTIONS_FDPLANE_*
unsigned flags; // bitfield over NCOPTION_FDPLANE_*
} ncfdplane_options;
// Create an ncfdplane around the fd 'fd'. Consider this function to take
@ -2809,7 +2810,7 @@ API int ncfdplane_destroy(struct ncfdplane* n);
typedef struct ncsubproc_options {
void* curry;
uint64_t restart_period; // restart this many seconds after an exit (watch)
unsigned flags; // bitfield over NCOPTIONS_SUBPROC_*
unsigned flags; // bitfield over NCOPTION_SUBPROC_*
} ncsubproc_options;
// see exec(2). p-types use $PATH. e-type passes environment vars.
@ -2888,7 +2889,8 @@ struct blitset {
// the first five braille EGCs are all 0 on the left, [0..4] on the right.
const wchar_t* egcs;
int (*blit)(struct ncplane* nc, int placey, int placex, int linesize,
const void* data, int begy, int begx, int leny, int lenx, bool bgr);
const void* data, int begy, int begx, int leny, int lenx,
bool bgr, bool blendcolors);
bool fill;
};

@ -400,7 +400,7 @@ typedef struct ncmenu_options {
int sectioncount; // must be positive
uint64_t headerchannels; // styling for header
uint64_t sectionchannels; // styling for sections
unsigned flags; // bitfield over NCMENU_OPTIONS_*
unsigned flags; // bitfield over NCMENU_OPTION_*
} ncmenu_options;
struct ncmenu* ncmenu_create(struct ncplane* n, const ncmenu_options* opts);
int ncmenu_unroll(struct ncmenu* n, int sectionidx);
@ -425,7 +425,7 @@ typedef struct ncreel_options {
uint64_t tabletchan;
uint64_t focusedchan;
uint64_t bgchannel;
unsigned flags; // bitfield over NCREEL_OPTIONS_*
unsigned flags; // bitfield over NCREEL_OPTION_*
} ncreel_options;
struct ncreel* ncreel_create(struct ncplane* nc, const ncreel_options* popts, int efd);
struct ncplane* ncreel_plane(struct ncreel* pr);
@ -501,7 +501,7 @@ typedef struct ncreader_options {
char* egc; // egc used for empty space
int physrows;
int physcols;
unsigned flags; // bitfield over NCREADER_OPTIONS_*
unsigned flags; // bitfield over NCREADER_OPTION_*
} ncreader_options;
struct ncreader* ncreader_create(struct ncplane* n, int y, int x, const ncreader_options* opts);
int ncreader_clear(struct ncreader* n);

@ -548,7 +548,7 @@ int fpsgraph_init(struct notcurses* nc){
ncplane_set_base(newp, "", attrword, channels);
ncplot_options opts;
memset(&opts, 0, sizeof(opts));
opts.flags = NCPLOT_OPTIONS_LABELTICKSD | NCPLOT_OPTIONS_EXPONENTIALD;
opts.flags = NCPLOT_OPTION_LABELTICKSD | NCPLOT_OPTION_EXPONENTIALD;
channels_set_fg_rgb(&opts.minchannel, 0xff, 0x00, 0xff);
channels_set_bg(&opts.minchannel, 0x201020);
channels_set_bg_alpha(&opts.minchannel, CELL_ALPHA_BLEND);

@ -150,6 +150,7 @@ int outro(struct notcurses* nc){
struct ncvisual_options vopts = {
.n = ncp,
.scaling = NCSCALE_STRETCH,
.flags = NCVISUAL_OPTION_BLEND,
};
if(ncvisual_render(nc, chncv, &vopts) == NULL){
ncvisual_destroy(chncv);

@ -289,7 +289,7 @@ ncreel_demo_core(struct notcurses* nc, int efdr, int efdw){
.roff = x,
.boff = y,
.bgchannel = 0,
.flags = NCREEL_OPTIONS_INFINITESCROLL | NCREEL_OPTIONS_CIRCULAR,
.flags = NCREEL_OPTION_INFINITESCROLL | NCREEL_OPTION_CIRCULAR,
};
channels_set_fg_rgb(&popts.focusedchan, 58, 150, 221);
channels_set_bg_rgb(&popts.focusedchan, 97, 214, 214);

@ -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_OPTIONS_LABELTICKSD | NCPLOT_OPTIONS_MAYDEGRADE;
popts.flags = NCPLOT_OPTION_LABELTICKSD | NCPLOT_OPTION_MAYDEGRADE;
popts.minchannel = popts.maxchannel = 0;
channels_set_fg_rgb(&popts.minchannel, 0x40, 0x50, 0xb0);
channels_set_fg_rgb(&popts.maxchannel, 0x40, 0xff, 0xd0);

@ -18,7 +18,7 @@ ffmpeg_trans_p(bool bgr, unsigned char alpha){
static inline int
tria_blit_ascii(ncplane* nc, int placey, int placex, int linesize,
const void* data, int begy, int begx,
int leny, int lenx, bool bgr){
int leny, int lenx, bool bgr, bool blendcolors){
//fprintf(stderr, "ASCII %d X %d @ %d X %d (%p) place: %d X %d\n", leny, lenx, begy, begx, data, placey, placex);
const int bpp = 32;
const int rpos = bgr ? 2 : 0;
@ -64,7 +64,7 @@ tria_blit_ascii(ncplane* nc, int placey, int placex, int linesize,
static inline int
tria_blit(ncplane* nc, int placey, int placex, int linesize,
const void* data, int begy, int begx,
int leny, int lenx, bool bgr){
int leny, int lenx, bool bgr, bool blendcolors){
//fprintf(stderr, "HALF %d X %d @ %d X %d (%p) place: %d X %d\n", leny, lenx, begy, begx, data, placey, placex);
const int bpp = 32;
const int rpos = bgr ? 2 : 0;
@ -92,6 +92,10 @@ tria_blit(ncplane* nc, int placey, int placex, int linesize,
// effective in that case anyway
c->channels = 0;
c->attrword = 0;
if(blendcolors){
cell_set_bg_alpha(c, CELL_ALPHA_BLEND);
cell_set_fg_alpha(c, CELL_ALPHA_BLEND);
}
if(ffmpeg_trans_p(bgr, rgbbase_up[3]) || ffmpeg_trans_p(bgr, rgbbase_down[3])){
cell_set_bg_alpha(c, CELL_ALPHA_TRANSPARENT);
if(ffmpeg_trans_p(bgr, rgbbase_up[3]) && ffmpeg_trans_p(bgr, rgbbase_down[3])){
@ -133,7 +137,7 @@ tria_blit(ncplane* nc, int placey, int placex, int linesize,
static inline int
quadrant_blit(ncplane* nc, int placey, int placex, int linesize,
const void* data, int begy, int begx,
int leny, int lenx, bool bgr){
int leny, int lenx, bool bgr, bool blendcolors){
const int bpp = 32;
const int rpos = bgr ? 2 : 0;
const int bpos = bgr ? 0 : 2;
@ -204,7 +208,7 @@ quadrant_blit(ncplane* nc, int placey, int placex, int linesize,
static inline int
braille_blit(ncplane* nc, int placey, int placex, int linesize,
const void* data, int begy, int begx,
int leny, int lenx, bool bgr){
int leny, int lenx, bool bgr, bool blendcolors){
const int bpp = 32;
const int rpos = bgr ? 2 : 0;
const int bpos = bgr ? 0 : 2;
@ -313,22 +317,27 @@ int ncblit_bgrx(ncplane* nc, int placey, int placex,
int linesize, const void* data, int begy, int begx, int leny,
int lenx){
if(!nc->nc->utf8){
return tria_blit_ascii(nc, placey, placex, linesize, data, begy, begx, leny, lenx, true);
return tria_blit_ascii(nc, placey, placex, linesize, data, begy, begx,
leny, lenx, true, false);
}
return tria_blit(nc, placey, placex, linesize, data, begy, begx, leny, lenx, true);
return tria_blit(nc, placey, placex, linesize, data, begy, begx,
leny, lenx, true, false);
}
int ncblit_rgba(ncplane* nc, int placey, int placex,
int linesize, const void* data, int begy, int begx, int leny,
int lenx){
if(!nc->nc->utf8){
return tria_blit_ascii(nc, placey, placex, linesize, data, begy, begx, leny, lenx, false);
return tria_blit_ascii(nc, placey, placex, linesize, data, begy, begx,
leny, lenx, false, false);
}
return tria_blit(nc, placey, placex, linesize, data, begy, begx, leny, lenx, false);
return tria_blit(nc, placey, placex, linesize, data, begy, begx,
leny, lenx, false, false);
}
int rgba_blit_dispatch(ncplane* nc, const struct blitset* bset, int placey,
int placex, int linesize, const void* data, int begy,
int begx, int leny, int lenx){
return bset->blit(nc, placey, placex, linesize, data, begy, begx, leny, lenx, false);
int begx, int leny, int lenx, bool blendcolors){
return bset->blit(nc, placey, placex, linesize, data, begy, begx,
leny, lenx, false, blendcolors);
}

@ -377,7 +377,8 @@ int ncvisual_stream(notcurses* nc, ncvisual* ncv, nc_err_e* ncerr,
nc_err_e ncvisual_blit(ncvisual* ncv, int rows, int cols, ncplane* n,
const struct blitset* bset, int placey, int placex,
int begy, int begx, int leny, int lenx) {
int begy, int begx, int leny, int lenx,
bool blendcolors) {
const AVFrame* inframe = ncv->details.oframe ? ncv->details.oframe : ncv->details.frame;
void* data = nullptr;
int stride = 0;
@ -429,7 +430,8 @@ nc_err_e ncvisual_blit(ncvisual* ncv, int rows, int cols, ncplane* n,
data = ncv->data;
}
//fprintf(stderr, "place: %d/%d rows/cols: %d/%d %d/%d+%d/%d\n", placey, placex, rows, cols, begy, begx, leny, lenx);
if(rgba_blit_dispatch(n, bset, placey, placex, stride, data, begy, begx, leny, lenx) <= 0){
if(rgba_blit_dispatch(n, bset, placey, placex, stride, data, begy, begx,
leny, lenx, blendcolors) <= 0){
if(sframe){
av_freep(sframe->data);
av_freep(&sframe);

@ -635,7 +635,7 @@ void* bgra_to_rgba(const void* data, int rows, int rowstride, int cols);
int rgba_blit_dispatch(ncplane* nc, const struct blitset* bset, int placey,
int placex, int linesize, const void* data, int begy,
int begx, int leny, int lenx);
int begx, int leny, int lenx, bool blendcolors);
// find the "center" cell of two lengths. in the case of even rows/columns, we
// place the center on the top/left. in such a case there will be one more

@ -289,7 +289,7 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
if(opts->sectioncount <= 0 || !opts->sections){
return NULL;
}
if(opts->flags & ~(NCMENU_OPTIONS_BOTTOM)){ // HIDDEN is not yet implemented
if(opts->flags & ~(NCMENU_OPTION_BOTTOM)){ // HIDDEN is not yet implemented
return NULL;
}
int totalheight = 1;
@ -300,7 +300,7 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
int dimy, dimx;
ncplane_dim_yx(notcurses_stdplane(n->nc), &dimy, &dimx);
if(ret){
ret->bottom = !!(opts->flags & NCMENU_OPTIONS_BOTTOM);
ret->bottom = !!(opts->flags & NCMENU_OPTION_BOTTOM);
if(dup_menu_sections(ret, opts, &totalwidth, &totalheight) == 0){
ret->headerwidth = totalwidth;
if(totalwidth < dimx){

@ -103,7 +103,7 @@ nc_err_e ncvisual_resize(ncvisual* nc, int rows, int cols) {
nc_err_e ncvisual_blit(struct ncvisual* ncv, int rows, int cols,
ncplane* n, const struct blitset* bset,
int placey, int placex, int begy, int begx,
int leny, int lenx) {
int leny, int lenx, bool blendcolors) {
//fprintf(stderr, "%d/%d -> %d/%d on the resize\n", ncv->rows, ncv->cols, rows, cols);
void* data = nullptr;
int stride = 0;
@ -124,7 +124,8 @@ nc_err_e ncvisual_blit(struct ncvisual* ncv, int rows, int cols,
data = ncv->data;
stride = ncv->rowstride;
}
if(rgba_blit_dispatch(n, bset, placey, placex, stride, data, begy, begx, leny, lenx) <= 0){
if(rgba_blit_dispatch(n, bset, placey, placex, stride, data, begy, begx,
leny, lenx, blendcolors)) <= 0){
return NCERR_DECODE;
}
return NCERR_SUCCESS;

@ -33,7 +33,7 @@ class ncppplot {
}
}
bool degrade_blitter = true;
if(opts && !(opts->flags & NCPLOT_OPTIONS_MAYDEGRADE)){
if(opts && !(opts->flags & NCPLOT_OPTION_MAYDEGRADE)){
degrade_blitter = false;
}
auto bset = lookup_blitset(ncplane_notcurses(n), blitter, degrade_blitter);
@ -57,7 +57,7 @@ class ncppplot {
if(dimx < ncpp->rangex){
ncpp->slotcount = scaleddim;
}
if( (ncpp->labelaxisd = opts->flags & NCPLOT_OPTIONS_LABELTICKSD) ){
if( (ncpp->labelaxisd = opts->flags & NCPLOT_OPTION_LABELTICKSD) ){
if(ncpp->slotcount + scaledprefixlen > scaleddim){
if(scaleddim > scaledprefixlen){
ncpp->slotcount = scaleddim - scaledprefixlen;
@ -74,8 +74,8 @@ class ncppplot {
ncpp->bset = bset;
ncpp->miny = miny;
ncpp->maxy = maxy;
ncpp->vertical_indep = opts->flags & NCPLOT_OPTIONS_VERTICALI;
ncpp->exponentiali = opts->flags & NCPLOT_OPTIONS_EXPONENTIALD;
ncpp->vertical_indep = opts->flags & NCPLOT_OPTION_VERTICALI;
ncpp->exponentiali = opts->flags & NCPLOT_OPTION_EXPONENTIALD;
if( (ncpp->detectdomain = (miny == maxy)) ){
ncpp->maxy = 0;
ncpp->miny = std::numeric_limits<T>::max();

@ -9,6 +9,7 @@
// a single, distinct ncplane.
typedef struct nctablet {
ncplane* p; // visible panel, NULL when offscreen
ncplane* border;
struct nctablet* next;
struct nctablet* prev;
tabletcb cbfxn; // application callback to draw tablet
@ -551,8 +552,8 @@ validate_ncreel_opts(ncplane* w, const ncreel_options* ropts){
if(w == NULL){
return false;
}
if(ropts->flags & NCREEL_OPTIONS_CIRCULAR){
if(!(ropts->flags & NCREEL_OPTIONS_INFINITESCROLL)){
if(ropts->flags & NCREEL_OPTION_CIRCULAR){
if(!(ropts->flags & NCREEL_OPTION_INFINITESCROLL)){
return false; // can't set circular without infinitescroll
}
}

@ -9,7 +9,7 @@
nc_err_e ncvisual_blit(struct ncvisual* ncv, int rows, int cols,
ncplane* n, const struct blitset* bset,
int placey, int placex, int begy, int begx,
int leny, int lenx);
int leny, int lenx, bool blendcolors);
// ncv constructors other than ncvisual_from_file() need to set up the
// AVFrame* 'frame' according to their own data, which is assumed to
@ -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_OPTIONS_MAYDEGRADE);
const bool maydegrade = !opts || (opts->flags & NCVISUAL_OPTION_MAYDEGRADE);
if(opts && opts->blitter != NCBLIT_DEFAULT){
bset = lookup_blitset(nc, opts->blitter, maydegrade);
}else{
@ -377,7 +377,7 @@ auto ncvisual_from_bgra(const void* bgra, int rows, int rowstride,
auto ncvisual_render(notcurses* nc, ncvisual* ncv,
const struct ncvisual_options* vopts) -> ncplane* {
if(vopts && vopts->flags > NCVISUAL_OPTIONS_MAYDEGRADE){
if(vopts && vopts->flags > NCVISUAL_OPTION_BLEND){
return nullptr;
}
int lenx = vopts ? vopts->lenx : 0;
@ -459,7 +459,8 @@ auto ncvisual_render(notcurses* nc, ncvisual* ncv,
//fprintf(stderr, "render: %dx%d:%d+%d of %d/%d stride %u %p\n", begy, begx, leny, lenx, ncv->rows, ncv->cols, ncv->rowstride, ncv->data);
if(ncvisual_blit(ncv, disprows * encoding_y_scale(bset),
dispcols * encoding_x_scale(bset), n, bset,
placey, placex, begy, begx, leny, lenx)){
placey, placex, begy, begx, leny, lenx,
vopts && (vopts->flags & NCVISUAL_OPTION_BLEND))){
ncplane_destroy(n);
return nullptr;
}
@ -544,11 +545,12 @@ int ncvisual_init(int loglevel) {
nc_err_e ncvisual_blit(ncvisual* ncv, int rows, int cols, ncplane* n,
const struct blitset* bset, int placey, int placex,
int begy, int begx, int leny, int lenx) {
int begy, int begx, int leny, int lenx,
bool blendcolors) {
(void)rows;
(void)cols;
if(rgba_blit_dispatch(n, bset, placey, placex, ncv->rowstride, ncv->data,
begy, begx, leny, lenx) <= 0){
begy, begx, leny, lenx, blendcolors) <= 0){
return NCERR_DECODE;
}
return NCERR_SUCCESS;

@ -132,7 +132,7 @@ int main(void){
ncplane_erase(n);
mopts.flags |= NCMENU_OPTIONS_BOTTOM;
mopts.flags |= NCMENU_OPTION_BOTTOM;
struct ncmenu* bottom = ncmenu_create(n, &mopts);
if(bottom == NULL){
goto err;

@ -24,7 +24,7 @@ TEST_CASE("MenuTest") {
SUBCASE("EmptyMenuBottomReject") {
struct ncmenu_options opts{};
opts.flags = NCMENU_OPTIONS_BOTTOM;
opts.flags = NCMENU_OPTION_BOTTOM;
struct ncmenu* ncm = ncmenu_create(n_, &opts);
REQUIRE(nullptr == ncm);
CHECK(0 == notcurses_render(nc_));

@ -30,14 +30,14 @@ TEST_CASE("Reels") {
SUBCASE("InitLinearInfinite") {
ncreel_options r{};
r.flags = NCREEL_OPTIONS_INFINITESCROLL;
r.flags = NCREEL_OPTION_INFINITESCROLL;
struct ncreel* nr = ncreel_create(n_, &r, -1);
REQUIRE(nr);
}
SUBCASE("InitCircular") {
ncreel_options r{};
r.flags = NCREEL_OPTIONS_INFINITESCROLL | NCREEL_OPTIONS_CIRCULAR;
r.flags = NCREEL_OPTION_INFINITESCROLL | NCREEL_OPTION_CIRCULAR;
struct ncreel* nr = ncreel_create(n_, &r, -1);
REQUIRE(nr);
REQUIRE(0 == ncreel_destroy(nr));
@ -46,7 +46,7 @@ TEST_CASE("Reels") {
// circular is not allowed to be true when infinitescroll is false
SUBCASE("FiniteCircleRejected") {
ncreel_options r{};
r.flags = NCREEL_OPTIONS_CIRCULAR;
r.flags = NCREEL_OPTION_CIRCULAR;
struct ncreel* nr = ncreel_create(n_, &r, -1);
REQUIRE(!nr);
}

Loading…
Cancel
Save