CHANNELS_RGB_ -> NCCHANNELS_

pull/1920/head
nick black 3 years ago
parent 75cee68631
commit bc4f2a3626
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -111,10 +111,11 @@ endif()
# don't cache these, or installing them requires clearing the cache to be found.
# this is going to be true for anything lacking pkg-config/CMake support.
# unigbrk.h was introduced in libunistring 0.9.4, 2010-02-14.
unset(HAVE_UNISTRING_H CACHE)
check_include_file("uniwbrk.h" HAVE_UNISTRING_H)
check_include_file("unigbrk.h" HAVE_UNISTRING_H)
if(NOT "${HAVE_UNISTRING_H}")
message(FATAL_ERROR "Couldn't find uniwbrk.h from GNU libunistring")
message(FATAL_ERROR "Couldn't find unigbrk.h from GNU libunistring")
endif()
find_library(unistring unistring REQUIRED)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libunistring)

@ -17,6 +17,9 @@ rearrangements of Notcurses.
* `ncmenu`s can now be used with any plane, not just the standard plane.
* Added `ncchannels_reverse()`, which reverses the color aspects of the
two channels, while keeping other elements constant.
* `CHANNELS_RGB_INITIALIZER` and `CHANNEL_RGB_INITIALIZER` have been renamed
`NCCHANNELS_INITIALIZER` and `NCCHANNEL_INITIALIZER`. The former two are
now deprecated, and will be removed for ABI3.
* 2.3.8 (2021-07-04)
* Marked all capability functions `__attribute__ ((pure))`. If you were

@ -118,37 +118,39 @@ API int notcurses_ucs32_to_utf8(const char32_t* ucs32, unsigned ucs32count,
#define NCALPHA_BLEND 0x10000000ull
#define NCALPHA_OPAQUE 0x00000000ull
// we support palette-indexed color up to 8 bits.
#define NCPALETTESIZE 256
// Does this glyph completely obscure the background? If so, there's no need
// to emit a background when rasterizing, a small optimization. These are
// also used to track regions into which we must not cellblit.
#define CELL_NOBACKGROUND_MASK 0x8700000000000000ull
#define NC_NOBACKGROUND_MASK 0x8700000000000000ull
// if this bit is set, we are *not* using the default background color
#define CELL_BGDEFAULT_MASK 0x0000000040000000ull
#define NC_BGDEFAULT_MASK 0x0000000040000000ull
// if this bit is set, we are *not* using the default foreground color
#define CELL_FGDEFAULT_MASK (CELL_BGDEFAULT_MASK << 32u)
#define NC_FGDEFAULT_MASK (NC_BGDEFAULT_MASK << 32u)
// extract these bits to get the background RGB value
#define CELL_BG_RGB_MASK 0x0000000000ffffffull
#define NC_BG_RGB_MASK 0x0000000000ffffffull
// extract these bits to get the foreground RGB value
#define CELL_FG_RGB_MASK (CELL_BG_RGB_MASK << 32u)
// if this bit *and* CELL_BGDEFAULT_MASK are set, we're using a
#define NC_FG_RGB_MASK (NC_BG_RGB_MASK << 32u)
// if this bit *and* NC_BGDEFAULT_MASK are set, we're using a
// palette-indexed background color
#define CELL_BG_PALETTE 0x0000000008000000ull
#define NCPALETTESIZE 256
// if this bit *and* CELL_FGDEFAULT_MASK are set, we're using a
#define NC_BG_PALETTE 0x0000000008000000ull
// if this bit *and* NC_FGDEFAULT_MASK are set, we're using a
// palette-indexed foreground color
#define CELL_FG_PALETTE (CELL_BG_PALETTE << 32u)
#define NC_FG_PALETTE (NC_BG_PALETTE << 32u)
// extract these bits to get the background alpha mask
#define CELL_BG_ALPHA_MASK 0x30000000ull
#define NC_BG_ALPHA_MASK 0x30000000ull
// extract these bits to get the foreground alpha mask
#define CELL_FG_ALPHA_MASK (CELL_BG_ALPHA_MASK << 32u)
#define NC_FG_ALPHA_MASK (NC_BG_ALPHA_MASK << 32u)
// initialize a 64-bit channel pair with specified RGB fg/bg
#define CHANNELS_RGB_INITIALIZER(fr, fg, fb, br, bg, bb) \
#define NCCHANNELS_INITIALIZER(fr, fg, fb, br, bg, bb) \
(((((uint64_t)(fr) << 16u) + ((uint64_t)(fg) << 8u) + (uint64_t)(fb)) << 32ull) + \
(((br) << 16u) + ((bg) << 8u) + (bb)) + CELL_BGDEFAULT_MASK + CELL_FGDEFAULT_MASK)
(((br) << 16u) + ((bg) << 8u) + (bb)) + NC_BGDEFAULT_MASK + NC_FGDEFAULT_MASK)
#define CHANNEL_RGB_INITIALIZER(r, g, b) \
(((uint32_t)r << 16u) + ((uint32_t)g << 8u) + (b) + CELL_BGDEFAULT_MASK)
#define NCCHANNEL_INITIALIZER(r, g, b) \
(((uint32_t)r << 16u) + ((uint32_t)g << 8u) + (b) + NC_BGDEFAULT_MASK)
// These lowest-level functions manipulate a 64-bit channel encoding directly.
// Users will typically manipulate ncplane and nccell channels through those
@ -175,7 +177,7 @@ ncchannel_b(uint32_t channel){
// Extract the 2-bit alpha component from a 32-bit channel.
static inline unsigned
ncchannel_alpha(unsigned channel){
return channel & CELL_BG_ALPHA_MASK;
return channel & NC_BG_ALPHA_MASK;
}
// Extract the three 8-bit R/G/B components from a 32-bit channel.
@ -199,7 +201,7 @@ ncchannel_set_rgb8(uint32_t* channel, int r, int g, int b){
return -1;
}
unsigned c = (r << 16u) | (g << 8u) | b;
*channel = (*channel & ~CELL_BG_RGB_MASK) | CELL_BGDEFAULT_MASK | c;
*channel = (*channel & ~NC_BG_RGB_MASK) | NC_BGDEFAULT_MASK | c;
return 0;
}
@ -227,7 +229,7 @@ ncchannel_set_rgb8_clipped(unsigned* channel, int r, int g, int b){
b = 0;
}
unsigned c = (r << 16u) | (g << 8u) | b;
*channel = (*channel & ~CELL_BG_RGB_MASK) | CELL_BGDEFAULT_MASK | c;
*channel = (*channel & ~NC_BG_RGB_MASK) | NC_BGDEFAULT_MASK | c;
}
// Same, but provide an assembled, packed 24 bits of rgb.
@ -236,7 +238,7 @@ ncchannel_set(unsigned* channel, unsigned rgb){
if(rgb > 0xffffffu){
return -1;
}
*channel = (*channel & ~CELL_BG_RGB_MASK) | CELL_BGDEFAULT_MASK | rgb;
*channel = (*channel & ~NC_BG_RGB_MASK) | NC_BGDEFAULT_MASK | rgb;
return 0;
}
@ -248,12 +250,12 @@ ncchannel_palindex(uint32_t channel){
// Set the 2-bit alpha component of the 32-bit channel.
static inline int
ncchannel_set_alpha(unsigned* channel, unsigned alpha){
if(alpha & ~CELL_BG_ALPHA_MASK){
if(alpha & ~NC_BG_ALPHA_MASK){
return -1;
}
*channel = alpha | (*channel & ~CELL_BG_ALPHA_MASK);
*channel = alpha | (*channel & ~NC_BG_ALPHA_MASK);
if(alpha != NCALPHA_OPAQUE){
*channel |= CELL_BGDEFAULT_MASK;
*channel |= NC_BGDEFAULT_MASK;
}
return 0;
}
@ -263,8 +265,8 @@ ncchannel_set_palindex(uint32_t* channel, int idx){
if(idx < 0 || idx >= NCPALETTESIZE){
return -1;
}
*channel |= CELL_BGDEFAULT_MASK;
*channel |= CELL_BG_PALETTE;
*channel |= NC_BGDEFAULT_MASK;
*channel |= NC_BG_PALETTE;
ncchannel_set_alpha(channel, NCALPHA_OPAQUE);
*channel &= 0xff000000ull;
*channel |= idx;
@ -274,19 +276,19 @@ ncchannel_set_palindex(uint32_t* channel, int idx){
// Is this ncchannel using the "default color" rather than RGB/palette-indexed?
static inline bool
ncchannel_default_p(unsigned channel){
return !(channel & CELL_BGDEFAULT_MASK);
return !(channel & NC_BGDEFAULT_MASK);
}
// Is this channel using palette-indexed color rather than RGB?
static inline bool
ncchannel_palindex_p(unsigned channel){
return !ncchannel_default_p(channel) && (channel & CELL_BG_PALETTE);
return !ncchannel_default_p(channel) && (channel & NC_BG_PALETTE);
}
// Mark the channel as using its default color, which also marks it opaque.
static inline unsigned
ncchannel_set_default(unsigned* channel){
return *channel &= ~(CELL_BGDEFAULT_MASK | NCALPHA_HIGHCONTRAST);
return *channel &= ~(NC_BGDEFAULT_MASK | NCALPHA_HIGHCONTRAST);
}
// Extract the 32-bit background channel from a channel pair.
@ -307,8 +309,8 @@ static inline uint64_t
ncchannels_reverse(uint64_t channels){
const uint64_t raw = ((uint64_t)ncchannels_bchannel(channels) << 32u) +
ncchannels_fchannel(channels);
const uint64_t statemask = (CELL_NOBACKGROUND_MASK | CELL_FG_ALPHA_MASK |
CELL_BG_ALPHA_MASK | (CELL_NOBACKGROUND_MASK >> 32u));
const uint64_t statemask = (NC_NOBACKGROUND_MASK | NC_FG_ALPHA_MASK |
NC_BG_ALPHA_MASK | (NC_NOBACKGROUND_MASK >> 32u));
uint64_t ret = raw & ~statemask;
ret |= channels & statemask;
return ret;
@ -347,13 +349,13 @@ ncchannels_bg_palindex(uint64_t channels){
// Extract 24 bits of foreground RGB from 'channels', shifted to LSBs.
static inline unsigned
ncchannels_fg_rgb(uint64_t channels){
return ncchannels_fchannel(channels) & CELL_BG_RGB_MASK;
return ncchannels_fchannel(channels) & NC_BG_RGB_MASK;
}
// Extract 24 bits of background RGB from 'channels', shifted to LSBs.
static inline unsigned
ncchannels_bg_rgb(uint64_t channels){
return ncchannels_bchannel(channels) & CELL_BG_RGB_MASK;
return ncchannels_bchannel(channels) & NC_BG_RGB_MASK;
}
// Extract 2 bits of foreground alpha from 'channels', shifted to LSBs.
@ -646,15 +648,14 @@ typedef struct nccell {
uint64_t channels; // + 8B == 16B
} nccell;
#define CELL_TRIVIAL_INITIALIZER { .gcluster = 0, .gcluster_backstop = 0, .width = 0, .stylemask = 0, .channels = 0, }
// do *not* load invalid EGCs using these macros! there is no way for us to
// protect against such misuse here. problems *will* ensue. similarly, do not
// set channel flags other than colors/alpha. we assign non-printing glyphs
// a width of 1 to match utf8_egc_len()'s behavior for whitespace/NUL.
#define CELL_CHAR_INITIALIZER(c) { .gcluster = (htole(c)), .gcluster_backstop = 0,\
.width = (uint8_t)((wcwidth(c) < 0 || !c) ? 1 : wcwidth(c)), .stylemask = 0, .channels = 0, }
#define CELL_INITIALIZER(c, s, chan) { .gcluster = (htole(c)), .gcluster_backstop = 0,\
.width = (uint8_t)((wcwidth(c) < 0 || !c) ? 1 : wcwidth(c)), .stylemask = (s), .channels = (chan), }
#define CELL_CHAR_INITIALIZER(c) CELL_INITIALIZER(c, 0, 0)
#define CELL_TRIVIAL_INITIALIZER CELL_CHAR_INITIALIZER(0)
static inline void
nccell_init(nccell* c){
@ -683,13 +684,14 @@ API int nccell_duplicate(struct ncplane* n, nccell* targ, const nccell* c);
// Release resources held by the nccell 'c'.
API void nccell_release(struct ncplane* n, nccell* c);
// if you want reverse video, try ncchannels_reverse(). if you want blink, try
// ncplane_pulse(). if you want protection, put things on a different plane.
#define NCSTYLE_MASK 0xffffu
#define NCSTYLE_ITALIC 0x0020u
#define NCSTYLE_UNDERLINE 0x0010u
#define NCSTYLE_UNDERCURL 0x0008u
#define NCSTYLE_BOLD 0x0004u
#define NCSTYLE_STRUCK 0x0002u
#define NCSTYLE_BLINK 0x0001u
#define NCSTYLE_ITALIC 0x0010u
#define NCSTYLE_UNDERLINE 0x0008u
#define NCSTYLE_UNDERCURL 0x0004u
#define NCSTYLE_BOLD 0x0002u
#define NCSTYLE_STRUCK 0x0001u
#define NCSTYLE_NONE 0
// Set the specified style bits for the nccell 'c', whether they're actively
@ -4398,11 +4400,14 @@ API void notcurses_debug_caps(const struct notcurses* nc, FILE* debugfp)
#define CELL_ALPHA_TRANSPARENT NCALPHA_TRANSPARENT
#define CELL_ALPHA_BLEND NCALPHA_BLEND
#define CELL_ALPHA_OPAQUE NCALPHA_OPAQUE
#define NCSTYLE_PROTECT 0x0001u
#define NCSTYLE_STANDOUT 0x0080u
#define NCSTYLE_REVERSE 0x0020u
#define NCSTYLE_INVIS 0x0002u
#define NCSTYLE_DIM 0x0008u
#define NCSTYLE_PROTECT 0
#define NCSTYLE_STANDOUT 0
#define NCSTYLE_REVERSE 0
#define NCSTYLE_INVIS 0
#define NCSTYLE_DIM 0
#define NCSTYLE_BLINK 0
#define CHANNELS_RGB_INITIALIZER NCCHANNELS_INITIALIZER
#define CHANNEL_RGB_INITIALIZER NCCHANNEL_INITIALIZER
#undef ALLOC
#undef API

@ -266,7 +266,7 @@ make_pbars(struct ncplane* column, struct ncprogbar** left, struct ncprogbar** r
if(leftp == NULL){
return -1;
}
ncplane_set_base(leftp, " ", 0, CHANNELS_RGB_INITIALIZER(0xdd, 0xdd, 0xdd, 0x1b, 0x1b, 0x1b));
ncplane_set_base(leftp, " ", 0, NCCHANNELS_INITIALIZER(0xdd, 0xdd, 0xdd, 0x1b, 0x1b, 0x1b));
ncprogbar_options popts = { };
ncchannel_set_rgb8(&popts.brchannel, 0, 0, 0);
ncchannel_set_rgb8(&popts.blchannel, 0, 0xff, 0);
@ -281,7 +281,7 @@ make_pbars(struct ncplane* column, struct ncprogbar** left, struct ncprogbar** r
if(rightp == NULL){
return -1;
}
ncplane_set_base(rightp, " ", 0, CHANNELS_RGB_INITIALIZER(0xdd, 0xdd, 0xdd, 0x1b, 0x1b, 0x1b));
ncplane_set_base(rightp, " ", 0, NCCHANNELS_INITIALIZER(0xdd, 0xdd, 0xdd, 0x1b, 0x1b, 0x1b));
popts.flags = NCPROGBAR_OPTION_RETROGRADE;
*right = ncprogbar_create(rightp, &popts);
if(*right == NULL){

@ -217,7 +217,7 @@ ext_demos(struct notcurses* nc, const char* spec){
// set the standard plane's base character to an opaque black, but don't
// erase the plane (we let one demo bleed through to the next, an effect
// we exploit in a few transitions).
uint64_t stdc = CHANNELS_RGB_INITIALIZER(0, 0, 0, 0, 0, 0);
uint64_t stdc = NCCHANNELS_INITIALIZER(0, 0, 0, 0, 0, 0);
ncplane_set_base(n, "", 0, stdc);
hud_schedule(demos[idx].name);

@ -343,12 +343,12 @@ hud_refresh(struct ncplane* n){
if(nccells_rounded_box(n, NCSTYLE_NONE, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
return -1;
}
ul.channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
ur.channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
ll.channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
lr.channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
hl.channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
vl.channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
ul.channels = NCCHANNELS_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
ur.channels = NCCHANNELS_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
ll.channels = NCCHANNELS_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
lr.channels = NCCHANNELS_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
hl.channels = NCCHANNELS_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
vl.channels = NCCHANNELS_INITIALIZER(0xf0, 0xc0, 0xc0, 0, 0, 0);
nccell_set_bg_alpha(&ul, NCALPHA_BLEND);
nccell_set_bg_alpha(&ur, NCALPHA_BLEND);
nccell_set_bg_alpha(&ll, NCALPHA_BLEND);

@ -3471,7 +3471,7 @@ mojiplane(struct ncplane* title, int y, int rows, const char* summary){
if(n == NULL){
return NULL;
}
uint64_t channels = CHANNELS_RGB_INITIALIZER(0xf0, 0xa0, 0xf0, 0x10, 0x10, 0x60);
uint64_t channels = NCCHANNELS_INITIALIZER(0xf0, 0xa0, 0xf0, 0x10, 0x10, 0x60);
if(ncplane_perimeter_rounded(n, 0, channels, NCBOXMASK_RIGHT) < 0){
ncplane_destroy(n);
return NULL;

@ -68,13 +68,13 @@ multiselector_demo(struct ncplane* n, struct ncplane* under, int y){
.maxdisplay = 8,
.title = "multi-item selector",
.items = mselect_items,
.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0xe0, 0x20, 0, 0),
.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0),
.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0),
.titlechannels = CHANNELS_RGB_INITIALIZER(0x80, 0x80, 0xff, 0, 0, 0x20),
.boxchannels = NCCHANNELS_INITIALIZER(0x20, 0xe0, 0xe0, 0x20, 0, 0),
.opchannels = NCCHANNELS_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0),
.descchannels = NCCHANNELS_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
.footchannels = NCCHANNELS_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0),
.titlechannels = NCCHANNELS_INITIALIZER(0x80, 0x80, 0xff, 0, 0, 0x20),
};
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x40, 0, 0, 0x40, 0);
uint64_t bgchannels = NCCHANNELS_INITIALIZER(0, 0x40, 0, 0, 0x40, 0);
ncchannels_set_fg_alpha(&bgchannels, NCALPHA_BLEND);
ncchannels_set_bg_alpha(&bgchannels, NCALPHA_BLEND);
struct ncplane_options nopts = {
@ -105,13 +105,13 @@ selector_demo(struct ncplane* n, struct ncplane* under, int dimx, int y){
.items = select_items,
.defidx = 4,
.maxdisplay = 3,
.boxchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x20, 0x40, 0x20, 0x20, 0x20),
.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0),
.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0),
.titlechannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20),
.boxchannels = NCCHANNELS_INITIALIZER(0xe0, 0x20, 0x40, 0x20, 0x20, 0x20),
.opchannels = NCCHANNELS_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0),
.descchannels = NCCHANNELS_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
.footchannels = NCCHANNELS_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0),
.titlechannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20),
};
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0, 0x40, 0, 0, 0x40);
uint64_t bgchannels = NCCHANNELS_INITIALIZER(0, 0, 0x40, 0, 0, 0x40);
ncchannels_set_fg_alpha(&bgchannels, NCALPHA_BLEND);
ncchannels_set_bg_alpha(&bgchannels, NCALPHA_BLEND);
struct ncplane_options nopts = {

@ -157,30 +157,30 @@ unicodedumper(struct ncplane* n, tinfo* ti, const char* indent){
*/
// the symbols for legacy computing
ncplane_cursor_move_yx(n, y - 2, 0);
uint32_t ul = CHANNEL_RGB_INITIALIZER(0x30, 0x30, 0x30);
uint32_t lr = CHANNEL_RGB_INITIALIZER(0x80, 0x80, 0x80);
uint32_t ul = NCCHANNEL_INITIALIZER(0x30, 0x30, 0x30);
uint32_t lr = NCCHANNEL_INITIALIZER(0x80, 0x80, 0x80);
ncplane_stain(n, y - 1, 70, ul, lr, ul, lr);
// the braille
ncplane_cursor_move_yx(n, y - 6, 0);
ul = CHANNEL_RGB_INITIALIZER(0x2f, 0x25, 0x24);
lr = CHANNEL_RGB_INITIALIZER(0x74, 0x25, 0x2f);
ul = NCCHANNEL_INITIALIZER(0x2f, 0x25, 0x24);
lr = NCCHANNEL_INITIALIZER(0x74, 0x25, 0x2f);
ncplane_stain(n, y - 3, 65, ul, lr, ul, lr);
// the sextants
ncplane_cursor_move_yx(n, y - 10, 27);
lr = CHANNEL_RGB_INITIALIZER(0x7B, 0x68, 0xEE);
ul = CHANNEL_RGB_INITIALIZER(0x19, 0x19, 0x70);
lr = NCCHANNEL_INITIALIZER(0x7B, 0x68, 0xEE);
ul = NCCHANNEL_INITIALIZER(0x19, 0x19, 0x70);
ncplane_stain(n, y - 9, 57, lr, ul, lr, ul);
// the boxes + quadrants
ncplane_cursor_move_yx(n, y - 10, 0);
ncplane_stain(n, y - 7, 70, lr, ul, lr, ul);
// the horizontal eighths
ul = CHANNEL_RGB_INITIALIZER(0x60, 0x7d, 0x3b);
lr = CHANNEL_RGB_INITIALIZER(0x02, 0x8a, 0x0f);
ul = NCCHANNEL_INITIALIZER(0x60, 0x7d, 0x3b);
lr = NCCHANNEL_INITIALIZER(0x02, 0x8a, 0x0f);
ncplane_cursor_move_yx(n, y - 10, 67);
ncplane_stain(n, y - 3, 70, lr, ul, lr, ul);
// the capabilities
ul = CHANNEL_RGB_INITIALIZER(0x1B, 0xb8, 0x8E);
lr = CHANNEL_RGB_INITIALIZER(0x19, 0x19, 0x70);
ul = NCCHANNEL_INITIALIZER(0x1B, 0xb8, 0x8E);
lr = NCCHANNEL_INITIALIZER(0x19, 0x19, 0x70);
ncplane_cursor_move_yx(n, y - 15, 0);
ncplane_stain(n, y - 11, 70, lr, ul, lr, ul);

@ -48,9 +48,9 @@ generalerp(unsigned rsum, unsigned gsum, unsigned bsum, int count){
assert(0 == bsum);
return 0;
}
return CHANNEL_RGB_INITIALIZER((rsum + (count - 1)) / count,
(gsum + (count - 1)) / count,
(bsum + (count - 1)) / count);
return NCCHANNEL_INITIALIZER((rsum + (count - 1)) / count,
(gsum + (count - 1)) / count,
(bsum + (count - 1)) / count);
}
static inline unsigned

@ -40,7 +40,7 @@ struct ncvisual_details;
// Was this glyph drawn as part of an ncvisual? If so, we need to honor
// blitter stacking rather than the standard trichannel solver.
#define CELL_BLITTERSTACK_MASK CELL_NOBACKGROUND_MASK
#define NC_BLITTERSTACK_MASK NC_NOBACKGROUND_MASK
// we can't define multipart ncvisual here, because OIIO requires C++ syntax,
// and we can't go throwing C++ syntax into this header. so it goes.
@ -1224,7 +1224,7 @@ box_corner_needs(unsigned ctlword){
// solid or shaded block, or certain emoji).
static inline bool
cell_nobackground_p(const nccell* c){
return (c->channels & CELL_NOBACKGROUND_MASK) == CELL_NOBACKGROUND_MASK;
return (c->channels & NC_NOBACKGROUND_MASK) == NC_NOBACKGROUND_MASK;
}
// Returns a number 0 <= n <= 15 representing the four quadrants, and which (if
@ -1249,7 +1249,7 @@ cell_set_blitquadrants(nccell* c, unsigned tl, unsigned tr, unsigned bl, unsigne
(tr ? 0x0400000000000000ull : 0) |
(bl ? 0x0200000000000000ull : 0) |
(br ? 0x0100000000000000ull : 0);
c->channels = ((c->channels & ~CELL_BLITTERSTACK_MASK) | newval);
c->channels = ((c->channels & ~NC_BLITTERSTACK_MASK) | newval);
}
// Destroy a plane and all its bound descendants.
@ -1265,8 +1265,8 @@ cell_bchannel(const nccell* cl){
// and background channel representations.
static inline uint32_t
channel_common(uint32_t channel){
return channel & (CELL_BGDEFAULT_MASK | CELL_BG_RGB_MASK |
CELL_BG_PALETTE | CELL_BG_ALPHA_MASK);
return channel & (NC_BGDEFAULT_MASK | NC_BG_RGB_MASK |
NC_BG_PALETTE | NC_BG_ALPHA_MASK);
}
// Extract those elements of the background channel which may be freely swapped
@ -1319,7 +1319,7 @@ channels_blend(unsigned c1, unsigned c2, unsigned* blends){
if(ncchannel_default_p(c2)){
ncchannel_set_default(&c1);
}else{
ncchannel_set(&c1, c2 & CELL_BG_RGB_MASK);
ncchannel_set(&c1, c2 & NC_BG_RGB_MASK);
}
ncchannel_set_alpha(&c1, ncchannel_alpha(c2));
}else if(!c2default && !ncchannel_default_p(c1)){
@ -1415,7 +1415,7 @@ is_control_egc(const unsigned char* egc, int bytes){
// lowest level of cell+pool setup. if the EGC changes the output to RTL, it
// must be suffixed with a LTR-forcing character by now. The four bits of
// CELL_BLITTERSTACK_MASK ought already be initialized. If gcluster is four
// NC_BLITTERSTACK_MASK ought already be initialized. If gcluster is four
// bytes or fewer, this function cannot fail.
static inline int
pool_blit_direct(egcpool* pool, nccell* c, const char* gcluster, int bytes, int cols){
@ -1445,7 +1445,7 @@ pool_blit_direct(egcpool* pool, nccell* c, const char* gcluster, int bytes, int
static inline int
pool_load_direct(egcpool* pool, nccell* c, const char* gcluster, int bytes, int cols){
char* rtl = NULL;
c->channels &= ~CELL_NOBACKGROUND_MASK;
c->channels &= ~NC_NOBACKGROUND_MASK;
if(bytes >= 0){
rtl = egc_rtl(gcluster, &bytes); // checks for RTL and adds U+200E if so
}

@ -1353,8 +1353,8 @@ int ncplane_set_fg_palindex(ncplane* n, int idx){
if(idx < 0 || idx >= NCPALETTESIZE){
return -1;
}
n->channels |= CELL_FGDEFAULT_MASK;
n->channels |= CELL_FG_PALETTE;
n->channels |= NC_FGDEFAULT_MASK;
n->channels |= NC_FG_PALETTE;
ncchannels_set_fg_alpha(&n->channels, NCALPHA_OPAQUE);
n->stylemask &= 0xffff00ff;
n->stylemask |= (idx << 8u);
@ -1365,8 +1365,8 @@ int ncplane_set_bg_palindex(ncplane* n, int idx){
if(idx < 0 || idx >= NCPALETTESIZE){
return -1;
}
n->channels |= CELL_BGDEFAULT_MASK;
n->channels |= CELL_BG_PALETTE;
n->channels |= NC_BGDEFAULT_MASK;
n->channels |= NC_BG_PALETTE;
ncchannels_set_bg_alpha(&n->channels, NCALPHA_OPAQUE);
n->stylemask &= 0xffffff00;
n->stylemask |= idx;

@ -8,10 +8,10 @@ static int
gradientA(struct notcurses* nc){
int dimy, dimx;
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
uint64_t ul = CHANNELS_RGB_INITIALIZER(0, 0, 0, 0xff, 0xff, 0xff);
uint64_t ur = CHANNELS_RGB_INITIALIZER(0, 0xff, 0xff, 0xff, 0, 0);
uint64_t ll = CHANNELS_RGB_INITIALIZER(0xff, 0, 0, 0, 0xff, 0xff);
uint64_t lr = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
uint64_t ul = NCCHANNELS_INITIALIZER(0, 0, 0, 0xff, 0xff, 0xff);
uint64_t ur = NCCHANNELS_INITIALIZER(0, 0xff, 0xff, 0xff, 0, 0);
uint64_t ll = NCCHANNELS_INITIALIZER(0xff, 0, 0, 0, 0xff, 0xff);
uint64_t lr = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
if(ncplane_gradient(stdn, "A", NCSTYLE_NONE, ul, ur, ll, lr, dimy - 1, dimx - 1) <= 0){
return -1;
}
@ -26,10 +26,10 @@ static int
gradStriations(struct notcurses* nc){
int dimy, dimx;
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
uint64_t ul = CHANNELS_RGB_INITIALIZER(0, 0, 0, 0xff, 0xff, 0xff);
uint64_t ur = CHANNELS_RGB_INITIALIZER(0, 0xff, 0xff, 0xff, 0, 0);
uint64_t ll = CHANNELS_RGB_INITIALIZER(0xff, 0, 0, 0, 0xff, 0xff);
uint64_t lr = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
uint64_t ul = NCCHANNELS_INITIALIZER(0, 0, 0, 0xff, 0xff, 0xff);
uint64_t ur = NCCHANNELS_INITIALIZER(0, 0xff, 0xff, 0xff, 0, 0);
uint64_t ll = NCCHANNELS_INITIALIZER(0xff, 0, 0, 0, 0xff, 0xff);
uint64_t lr = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
if(ncplane_gradient(stdn, "", NCSTYLE_NONE, ul, ur, ll, lr, dimy - 1, dimx - 1) <= 0){
return -1;
}
@ -51,10 +51,10 @@ static int
gradHigh(struct notcurses* nc){
int dimy, dimx;
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
uint64_t ul = CHANNEL_RGB_INITIALIZER(0, 0, 0);
uint64_t ur = CHANNEL_RGB_INITIALIZER(0, 0xff, 0xff);
uint64_t ll = CHANNEL_RGB_INITIALIZER(0xff, 0, 0);
uint64_t lr = CHANNEL_RGB_INITIALIZER(0xff, 0xff, 0xff);
uint64_t ul = NCCHANNEL_INITIALIZER(0, 0, 0);
uint64_t ur = NCCHANNEL_INITIALIZER(0, 0xff, 0xff);
uint64_t ll = NCCHANNEL_INITIALIZER(0xff, 0, 0);
uint64_t lr = NCCHANNEL_INITIALIZER(0xff, 0xff, 0xff);
if(ncplane_highgradient(stdn, ul, ur, ll, lr, dimy - 1, dimx - 1) <= 0){
return -1;
}

@ -80,12 +80,12 @@ int main(void){
sopts.title = "this is truly an awfully long example of a MULTISELECTOR title";
sopts.secondary = "pick one (you will die regardless)";
sopts.footer = "press q to exit (there is sartrev(\"no exit\"))";
sopts.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0xe0, 0x20, 0, 0);
sopts.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0);
sopts.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0);
sopts.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0);
sopts.titlechannels = CHANNELS_RGB_INITIALIZER(0x20, 0xff, 0xff, 0, 0, 0x20);
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x20, 0, 0, 0x20, 0);
sopts.boxchannels = NCCHANNELS_INITIALIZER(0x20, 0xe0, 0xe0, 0x20, 0, 0);
sopts.opchannels = NCCHANNELS_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0);
sopts.descchannels = NCCHANNELS_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0);
sopts.footchannels = NCCHANNELS_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0);
sopts.titlechannels = NCCHANNELS_INITIALIZER(0x20, 0xff, 0xff, 0, 0, 0x20);
uint64_t bgchannels = NCCHANNELS_INITIALIZER(0, 0x20, 0, 0, 0x20, 0);
ncchannels_set_fg_alpha(&bgchannels, NCALPHA_BLEND);
ncchannels_set_bg_alpha(&bgchannels, NCALPHA_BLEND);
struct ncplane* n = notcurses_stdplane(nc);

@ -84,7 +84,7 @@ int main(int argc, char **argv){
totalcols, totalb, wcswidth(wbuf, used), realcols);
ncdirect_cursor_yx(n, &y, &x);
// throw up a background color for invisible glyphs
uint64_t chan = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0x80, 0);
uint64_t chan = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0x80, 0);
int expy, expx;
int misses = 0;
int scrolls = 0;

@ -12,7 +12,7 @@ handle(struct notcurses* nc, const char *fn){
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
for(int y = 0 ; y < dimy ; y += 15){
for(int x = 0 ; x < dimx ; x += 15){
uint64_t channels = CHANNELS_RGB_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
uint64_t channels = NCCHANNELS_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
ncplane_set_base(stdn, "a", 0, channels);
struct ncvisual_options vopts = {
.y = y,
@ -27,7 +27,7 @@ handle(struct notcurses* nc, const char *fn){
}
notcurses_render(nc);
sleep(1);
channels = CHANNELS_RGB_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
channels = NCCHANNELS_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
ncplane_set_base(stdn, "a", 0, channels);
notcurses_render(nc);
sleep(1);

@ -71,12 +71,12 @@ int main(void){
sopts.secondary = "pick one (you will die regardless)";
sopts.footer = "press q to exit (there is no exit)";
sopts.defidx = 1;
sopts.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0x40, 0x20, 0x20, 0x20);
sopts.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0);
sopts.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0);
sopts.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0);
sopts.titlechannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20);
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x20, 0, 0, 0x20, 0);
sopts.boxchannels = NCCHANNELS_INITIALIZER(0x20, 0xe0, 0x40, 0x20, 0x20, 0x20);
sopts.opchannels = NCCHANNELS_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0);
sopts.descchannels = NCCHANNELS_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0);
sopts.footchannels = NCCHANNELS_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0);
sopts.titlechannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20);
uint64_t bgchannels = NCCHANNELS_INITIALIZER(0, 0x20, 0, 0, 0x20, 0);
ncchannels_set_fg_alpha(&bgchannels, NCALPHA_BLEND);
ncchannels_set_bg_alpha(&bgchannels, NCALPHA_BLEND);
struct ncplane* n = notcurses_stdplane(nc);

@ -61,7 +61,7 @@ handle(struct notcurses* nc, const char* fn){
ncvisual_destroy(ncv);
return -1;
}
uint64_t channels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
uint64_t channels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
ncplane_set_base(t, " ", 0, channels);
notcurses_render(nc);
clock_nanosleep(CLOCK_MONOTONIC, 0, &ds, NULL);

@ -73,16 +73,16 @@ int main(int argc, char** argv){
};
struct ncplane* ncp = ncplane_create(stdp, &popts);
struct nctabbed_options topts = {
.hdrchan = CHANNELS_RGB_INITIALIZER(255, 0, 0, 60, 60, 60),
.selchan = CHANNELS_RGB_INITIALIZER(0, 255, 0, 0, 0, 0),
.sepchan = CHANNELS_RGB_INITIALIZER(255, 255, 255, 100, 100, 100),
.hdrchan = NCCHANNELS_INITIALIZER(255, 0, 0, 60, 60, 60),
.selchan = NCCHANNELS_INITIALIZER(0, 255, 0, 0, 0, 0),
.sepchan = NCCHANNELS_INITIALIZER(255, 255, 255, 100, 100, 100),
.separator = " || ",
.flags = bottom ? NCTABBED_OPTION_BOTTOM : 0
};
struct nctabbed* nct = nctabbed_create(ncp, &topts);
struct nctab* t_; // stupid unused result warnings
(void) t_;
ncplane_set_base(nctabbed_content_plane(nct), " ", 0, CHANNELS_RGB_INITIALIZER(255, 255, 255, 15, 60, 15));
ncplane_set_base(nctabbed_content_plane(nct), " ", 0, NCCHANNELS_INITIALIZER(255, 255, 255, 15, 60, 15));
REDRAW();
t_ = nctabbed_add(nct, NULL, NULL, tabcbfn, "Tab #1", NULL);
REDRAW();

@ -183,7 +183,7 @@ textplane(struct notcurses* nc){
.name = "text",
};
struct ncplane* n = ncplane_create(stdn, &nopts);
uint64_t channels = CHANNELS_RGB_INITIALIZER(0, 0, 0, 0x22, 0x22, 0x22);
uint64_t channels = NCCHANNELS_INITIALIZER(0, 0, 0, 0x22, 0x22, 0x22);
/*ncchannels_set_fg_alpha(&channels, NCALPHA_TRANSPARENT);
ncchannels_set_bg_alpha(&channels, NCALPHA_TRANSPARENT);*/
if(n){

@ -409,10 +409,10 @@ tree_ui(struct notcurses* nc, struct nctree* tree){
static int
ncdup_paint(struct ncplane* n){
uint32_t tl = CHANNEL_RGB_INITIALIZER(0, 0, 0);
uint32_t tr = CHANNEL_RGB_INITIALIZER(0x88, 0x88, 0x88);
uint32_t bl = CHANNEL_RGB_INITIALIZER(0x88, 0x88, 0x88);
uint32_t br = CHANNEL_RGB_INITIALIZER(0xff, 0xff, 0xff);
uint32_t tl = NCCHANNEL_INITIALIZER(0, 0, 0);
uint32_t tr = NCCHANNEL_INITIALIZER(0x88, 0x88, 0x88);
uint32_t bl = NCCHANNEL_INITIALIZER(0x88, 0x88, 0x88);
uint32_t br = NCCHANNEL_INITIALIZER(0xff, 0xff, 0xff);
return ncplane_highgradient_sized(n, tl, tr, bl, br,
ncplane_dim_y(n), ncplane_dim_x(n));
}

@ -54,7 +54,7 @@ auto main() -> int {
auto nn = std::make_shared<Plane>(1, 2, 1, 16);
nn->set_fg_rgb8(0xc0, 0x80, 0xc0);
nn->set_bg_rgb8(0x20, 0x00, 0x20);
nn->set_base("", 0, CHANNELS_RGB_INITIALIZER(0xc0, 0x80, 0xc0, 0x20, 0, 0x20));
nn->set_base("", 0, NCCHANNELS_INITIALIZER(0xc0, 0x80, 0xc0, 0x20, 0, 0x20));
nn->putstr("AB");
n->set_fg_rgb8(0x80, 0xc0, 0x80);

@ -89,7 +89,7 @@ TEST_CASE("Ncpp"
NotCurses nc{ nopts };
{
auto n = nc.get_stdplane();
uint64_t chan = CHANNELS_RGB_INITIALIZER(0x22, 0xdd, 0x44, 0, 0, 0);
uint64_t chan = NCCHANNELS_INITIALIZER(0x22, 0xdd, 0x44, 0, 0, 0);
n->set_base(" ", 0, chan);
REQUIRE(n);
// FIXME load it into visual, erase plane, render visual, check for equivalence...

@ -267,7 +267,7 @@ TEST_CASE("Bitmaps") {
auto bigp = ncplane_create(n_, &nopts);
REQUIRE(bigp);
vopts.n = bigp;
uint64_t white = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
uint64_t white = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
ncplane_set_base(bigp, "x", 0, white);
CHECK(vopts.n == ncvisual_render(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));

@ -64,7 +64,7 @@ TEST_CASE("Direct") {
}
SUBCASE("BoxDefault") {
uint64_t chans = CHANNELS_RGB_INITIALIZER(255, 0, 255, 0, 0, 0);
uint64_t chans = NCCHANNELS_INITIALIZER(255, 0, 255, 0, 0, 0);
ncchannels_set_bg_default(&chans);
ncdirect_set_bg_rgb8(nc_, 0x88, 0x88, 0x88);
printf("test background\n");

@ -1010,7 +1010,7 @@ TEST_CASE("Plane") {
nopts.cols = 4;
auto n = ncplane_create(n_, &nopts);
REQUIRE(nullptr != n);
uint64_t channels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0xff, 0, 0xff);
uint64_t channels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0xff, 0, 0xff);
int y, x;
ncplane_yx(n, &y, &x);
CHECK(y == 2);
@ -1049,7 +1049,7 @@ TEST_CASE("Plane") {
auto n = ncplane_create(n_, &nopts);
REQUIRE(nullptr != n);
CHECK(false == ncplane_set_scrolling(n, true));
uint64_t channels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0xff, 0, 0xff);
uint64_t channels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0xff, 0, 0xff);
int y, x;
CHECK(1 == ncplane_set_base(n, " ", 0, channels));
CHECK(0 == notcurses_render(nc_));

@ -153,11 +153,11 @@ TEST_CASE("Plot") {
};
auto ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp);
ncplane_set_base(ncp, " ", 0, CHANNELS_RGB_INITIALIZER(0x80, 0, 0, 0, 0, 0x80));
ncplane_set_base(ncp, " ", 0, NCCHANNELS_INITIALIZER(0x80, 0, 0, 0, 0, 0x80));
ncplot_options popts;
memset(&popts, 0, sizeof(popts));
popts.maxchannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0, 0, 0);
popts.maxchannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0, 0, 0);
ncchannels_set_bg_alpha(&popts.minchannels, NCALPHA_BLEND);
ncchannels_set_fg_alpha(&popts.minchannels, NCALPHA_BLEND);
popts.gridtype = NCBLIT_BRAILLE;
@ -187,8 +187,8 @@ TEST_CASE("Plot") {
REQUIRE(ncp);
ncplot_options popts;
memset(&popts, 0, sizeof(popts));
popts.maxchannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0, 0, 0);
popts.maxchannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0, 0, 0);
ncchannels_set_bg_alpha(&popts.minchannels, NCALPHA_BLEND);
ncchannels_set_fg_alpha(&popts.minchannels, NCALPHA_BLEND);
popts.gridtype = NCBLIT_2x2;
@ -214,8 +214,8 @@ TEST_CASE("Plot") {
REQUIRE(ncp);
ncplot_options popts;
memset(&popts, 0, sizeof(popts));
popts.maxchannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0, 0, 0);
popts.maxchannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0, 0, 0);
ncchannels_set_bg_alpha(&popts.minchannels, NCALPHA_BLEND);
ncchannels_set_fg_alpha(&popts.minchannels, NCALPHA_BLEND);
popts.gridtype = NCBLIT_8x1;
@ -238,8 +238,8 @@ TEST_CASE("Plot") {
REQUIRE(ncp);
ncplot_options popts;
memset(&popts, 0, sizeof(popts));
popts.maxchannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0, 0, 0);
popts.maxchannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0, 0, 0);
ncchannels_set_bg_alpha(&popts.minchannels, NCALPHA_BLEND);
ncchannels_set_fg_alpha(&popts.minchannels, NCALPHA_BLEND);
popts.gridtype = NCBLIT_3x2;
@ -265,8 +265,8 @@ TEST_CASE("Plot") {
REQUIRE(ncp);
ncplot_options popts;
memset(&popts, 0, sizeof(popts));
popts.maxchannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0, 0, 0);
popts.maxchannels = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
popts.minchannels = NCCHANNELS_INITIALIZER(0, 0xff, 0, 0, 0, 0);
ncchannels_set_bg_alpha(&popts.minchannels, NCALPHA_BLEND);
ncchannels_set_fg_alpha(&popts.minchannels, NCALPHA_BLEND);
popts.gridtype = NCBLIT_BRAILLE;

@ -26,7 +26,7 @@ TEST_CASE("Readers") {
.margin_b = 0, .margin_r = 0,
};
auto ncp = ncplane_create(notcurses_stdplane(nc_), &nopts);
uint64_t echannels = CHANNELS_RGB_INITIALIZER(0xff, 0x44, 0xff, 0, 0, 0);
uint64_t echannels = NCCHANNELS_INITIALIZER(0xff, 0x44, 0xff, 0, 0, 0);
ncplane_set_base(ncp, notcurses_canutf8(nc_) ? strdup("") : strdup("x"),
0, echannels);
auto nr = ncreader_create(ncp, &opts);

@ -68,8 +68,8 @@ TEST_CASE("ReelGaps") {
SUBCASE("ReelsGapping") {
ncreel_options r{};
r.bordermask = 0xf;
r.tabletchan = CHANNELS_RGB_INITIALIZER(0, 0xb0, 0xb0, 0, 0, 0);
r.focusedchan = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
r.tabletchan = NCCHANNELS_INITIALIZER(0, 0xb0, 0xb0, 0, 0, 0);
r.focusedchan = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0, 0, 0);
struct ncreel* nr = ncreel_create(n_, &r);
REQUIRE(nr);
CHECK_EQ(0, ncreel_redraw(nr));

@ -183,7 +183,7 @@ TEST_CASE("Rotate") {
CHECK(pxdimx == width);
CHECK(pxdimy == height);
for(int i = 0 ; i < height * width / 2 ; ++i){
if(rgbaret[i] & CELL_BG_RGB_MASK){
if(rgbaret[i] & NC_BG_RGB_MASK){
CHECK(htole(rgbaret[i]) == htole(rgba[i]));
}
}
@ -195,10 +195,10 @@ TEST_CASE("Rotate") {
char* c = notcurses_at_yx(nc_, 0, x, &stylemask, &channels);
REQUIRE(c);
CHECK(0 == strcmp(c, " "));
if(ncchannels_fg_rgb(channels) & CELL_BG_RGB_MASK){
if(ncchannels_fg_rgb(channels) & NC_BG_RGB_MASK){
CHECK(0xffccbb == ncchannels_fg_rgb(channels));
}
if(ncchannels_bg_rgb(channels) & CELL_BG_RGB_MASK){
if(ncchannels_bg_rgb(channels) & NC_BG_RGB_MASK){
CHECK(0xffccbb == ncchannels_bg_rgb(channels));
}
free(c);
@ -243,7 +243,7 @@ TEST_CASE("Rotate") {
CHECK(pxdimy == height);
CHECK(pxdimx == width);
for(int i = 0 ; i < height * width / 2 ; ++i){
if(rgbaret[i] & CELL_BG_RGB_MASK){
if(rgbaret[i] & NC_BG_RGB_MASK){
CHECK(htole(rgbaret[i]) == htole(rgba[i]));
}
}
@ -255,10 +255,10 @@ TEST_CASE("Rotate") {
char* c = notcurses_at_yx(nc_, 0, x, &stylemask, &channels);
REQUIRE(c);
CHECK(0 == strcmp(c, " "));
if(ncchannels_fg_rgb(channels) & CELL_BG_RGB_MASK){
if(ncchannels_fg_rgb(channels) & NC_BG_RGB_MASK){
CHECK(0xffccbb == ncchannels_fg_rgb(channels));
}
if(ncchannels_bg_rgb(channels) & CELL_BG_RGB_MASK){
if(ncchannels_bg_rgb(channels) & NC_BG_RGB_MASK){
CHECK(0xffccbb == ncchannels_bg_rgb(channels));
}
free(c);

@ -201,7 +201,7 @@ TEST_CASE("Sixels") {
};
auto blockerplane = ncplane_create(newn, &nopts);
REQUIRE(nullptr != blockerplane);
uint64_t chan = CHANNELS_RGB_INITIALIZER(0, 0, 0, 0, 0, 0);
uint64_t chan = NCCHANNELS_INITIALIZER(0, 0, 0, 0, 0, 0);
CHECK(1 == ncplane_set_base(blockerplane, " ", 0, chan));
CHECK(0 == notcurses_render(nc_));
CHECK(1 == ncplane_set_base(n_, "%", 0, 0));

@ -32,9 +32,9 @@ TEST_CASE("Tabbed") {
SUBCASE("Create") {
struct nctabbed_options opts = {
.selchan = CHANNELS_RGB_INITIALIZER(0, 255, 0, 70, 70, 70),
.hdrchan = CHANNELS_RGB_INITIALIZER(255, 0, 0, 60, 60, 60),
.sepchan = CHANNELS_RGB_INITIALIZER(0, 0, 255, 60, 60, 60),
.selchan = NCCHANNELS_INITIALIZER(0, 255, 0, 70, 70, 70),
.hdrchan = NCCHANNELS_INITIALIZER(255, 0, 0, 60, 60, 60),
.sepchan = NCCHANNELS_INITIALIZER(0, 0, 255, 60, 60, 60),
.separator = const_cast<char*>("-separator-"),
.flags = NCTABBED_OPTION_BOTTOM
};
@ -379,9 +379,9 @@ TEST_CASE("Tabbed") {
auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr);
REQUIRE(nullptr != nt);
uint64_t hdrchan = CHANNELS_RGB_INITIALIZER(255, 127, 63, 31, 15, 7);
uint64_t selchan = CHANNELS_RGB_INITIALIZER(127, 63, 31, 15, 7, 3);
uint64_t sepchan = CHANNELS_RGB_INITIALIZER(63, 31, 15, 7, 3, 1);
uint64_t hdrchan = NCCHANNELS_INITIALIZER(255, 127, 63, 31, 15, 7);
uint64_t selchan = NCCHANNELS_INITIALIZER(127, 63, 31, 15, 7, 3);
uint64_t sepchan = NCCHANNELS_INITIALIZER(63, 31, 15, 7, 3, 1);
nctabbed_set_hdrchan(nt, hdrchan);
nctabbed_set_selchan(nt, selchan);
nctabbed_set_sepchan(nt, sepchan);

@ -10,9 +10,9 @@ void StainBoard(int dimy, int dimx){
green = (l / 2) * 0x20;
const int c1 = level_ % 2 ? high : low;
const int c2 = level_ % 2 ? low : high;
uint64_t tl = CHANNELS_RGB_INITIALIZER(c1, green, c2, c1, green, c2);
uint64_t tr = CHANNELS_RGB_INITIALIZER(c2, green, c1, c2, green, c1);
uint64_t bl = CHANNELS_RGB_INITIALIZER(c2, green, c1, c2, green, c1);
uint64_t br = CHANNELS_RGB_INITIALIZER(c1, green, c2, c1, green, c2);
uint64_t tl = NCCHANNELS_INITIALIZER(c1, green, c2, c1, green, c2);
uint64_t tr = NCCHANNELS_INITIALIZER(c2, green, c1, c2, green, c1);
uint64_t bl = NCCHANNELS_INITIALIZER(c2, green, c1, c2, green, c1);
uint64_t br = NCCHANNELS_INITIALIZER(c1, green, c2, c1, green, c2);
board_->stain(dimy - 2, dimx - 2, tl, tr, bl, br);
}

Loading…
Cancel
Save