diff --git a/NEWS.md b/NEWS.md index 134864985..52b941fd2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ This document attempts to list user-visible changes and any major internal rearrangements of Notcurses. +* 1.7.4 (not yet released) + * All `_rgb_clipped()` functions have been renamed `_rgb8_clipped()`, to + match the changes made in 1.7.2. Sorry, I ought have done this before. + * 1.7.3 (2020-09-19) * API changes pursuant to 2.0 API finalization: * `mbswidth()` has been renamed `ncstrwidth()`. diff --git a/USAGE.md b/USAGE.md index 8aebfd357..b8f75bf01 100644 --- a/USAGE.md +++ b/USAGE.md @@ -1453,8 +1453,8 @@ int ncplane_set_fg_rgb8(struct ncplane* n, int r, int g, int b); int ncplane_set_bg_rgb8(struct ncplane* n, int r, int g, int b); // Same, but clipped to [0..255]. -void ncplane_set_bg_rgb_clipped(struct ncplane* n, int r, int g, int b); -void ncplane_set_fg_rgb_clipped(struct ncplane* n, int r, int g, int b); +void ncplane_set_bg_rgb8_clipped(struct ncplane* n, int r, int g, int b); +void ncplane_set_fg_rgb8_clipped(struct ncplane* n, int r, int g, int b); // Same, but with rgb assembled into a channel (i.e. lower 24 bits). int ncplane_set_fg_rgb(struct ncplane* n, uint32_t channel); @@ -1796,8 +1796,8 @@ cell_set_fg_rgb8(cell* cl, int r, int g, int b){ // Same, but clipped to [0..255]. static inline void -cell_set_fg_rgb_clipped(cell* cl, int r, int g, int b){ - channels_set_fg_rgb_clipped(&cl->channels, r, g, b); +cell_set_fg_rgb8_clipped(cell* cl, int r, int g, int b){ + channels_set_fg_rgb8_clipped(&cl->channels, r, g, b); } // Same, but with an assembled 24-bit RGB value. @@ -1815,8 +1815,8 @@ cell_set_bg_rgb8(cell* cl, int r, int g, int b){ // Same, but clipped to [0..255]. static inline void -cell_set_bg_rgb_clipped(cell* cl, int r, int g, int b){ - channels_set_bg_rgb_clipped(&cl->channels, r, g, b); +cell_set_bg_rgb8_clipped(cell* cl, int r, int g, int b){ + channels_set_bg_rgb8_clipped(&cl->channels, r, g, b); } // Same, but with an assembled 24-bit RGB value. diff --git a/doc/man/man3/notcurses_cell.3.md b/doc/man/man3/notcurses_cell.3.md index 0f19f0ea7..4c61a38dc 100644 --- a/doc/man/man3/notcurses_cell.3.md +++ b/doc/man/man3/notcurses_cell.3.md @@ -102,9 +102,9 @@ typedef struct cell { **int cell_set_bg_rgb8(cell* cl, int r, int g, int b);** -**void cell_set_fg_rgb_clipped(cell* cl, int r, int g, int b);** +**void cell_set_fg_rgb8_clipped(cell* cl, int r, int g, int b);** -**void cell_set_bg_rgb_clipped(cell* cl, int r, int g, int b);** +**void cell_set_bg_rgb8_clipped(cell* cl, int r, int g, int b);** **int cell_set_fg_rgb(cell* c, uint32_t channel);** diff --git a/doc/man/man3/notcurses_plane.3.md b/doc/man/man3/notcurses_plane.3.md index ea12170ac..47f030f9f 100644 --- a/doc/man/man3/notcurses_plane.3.md +++ b/doc/man/man3/notcurses_plane.3.md @@ -110,9 +110,9 @@ notcurses_plane - operations on ncplanes **int ncplane_set_bg_rgb8(struct ncplane* n, int r, int g, int b);** -**void ncplane_set_fg_rgb_clipped(struct ncplane* n, int r, int g, int b);** +**void ncplane_set_fg_rgb8_clipped(struct ncplane* n, int r, int g, int b);** -**void ncplane_set_bg_rgb_clipped(struct ncplane* n, int r, int g, int b);** +**void ncplane_set_bg_rgb8_clipped(struct ncplane* n, int r, int g, int b);** **int ncplane_set_fg_rgb8(struct ncplane* n, uint32_t channel);** diff --git a/include/ncpp/Cell.hh b/include/ncpp/Cell.hh index 276c441a6..88c2e0a8d 100644 --- a/include/ncpp/Cell.hh +++ b/include/ncpp/Cell.hh @@ -164,7 +164,7 @@ namespace ncpp bool set_fg_rgb8 (int r, int g, int b, bool clipped = false) noexcept { if (clipped) { - cell_set_fg_rgb_clipped (&_cell, r, g, b); + cell_set_fg_rgb8_clipped (&_cell, r, g, b); return true; } @@ -189,7 +189,7 @@ namespace ncpp bool set_bg_rgb8 (int r, int g, int b, bool clipped = false) noexcept { if (clipped) { - cell_set_bg_rgb_clipped (&_cell, r, g, b); + cell_set_bg_rgb8_clipped (&_cell, r, g, b); return true; } diff --git a/include/ncpp/Plane.hh b/include/ncpp/Plane.hh index 4563f838a..bf548e685 100644 --- a/include/ncpp/Plane.hh +++ b/include/ncpp/Plane.hh @@ -738,7 +738,7 @@ namespace ncpp bool set_fg_rgb8 (int r, int g, int b, bool clipped = false) const NOEXCEPT_MAYBE { if (clipped) { - ncplane_set_fg_rgb_clipped (plane, r, g, b); + ncplane_set_fg_rgb8_clipped (plane, r, g, b); return true; } @@ -768,7 +768,7 @@ namespace ncpp bool set_bg_rgb8 (int r, int g, int b, bool clipped = false) const NOEXCEPT_MAYBE { if (clipped) { - ncplane_set_fg_rgb_clipped (plane, r, g, b); + ncplane_set_fg_rgb8_clipped (plane, r, g, b); return true; } diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 22f74ce24..85b49534c 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -187,7 +187,7 @@ channel_set_rgb8(uint32_t* channel, int r, int g, int b){ // the default color. Retain the other bits unchanged. r, g, and b will be // clipped to the range [0..255]. static inline void -channel_set_rgb_clipped(unsigned* channel, int r, int g, int b){ +channel_set_rgb8_clipped(unsigned* channel, int r, int g, int b){ if(r >= 256){ r = 255; } @@ -339,9 +339,9 @@ channels_set_fg_rgb8(uint64_t* channels, int r, int g, int b){ // Same, but clips to [0..255]. static inline void -channels_set_fg_rgb_clipped(uint64_t* channels, int r, int g, int b){ +channels_set_fg_rgb8_clipped(uint64_t* channels, int r, int g, int b){ unsigned channel = channels_fchannel(*channels); - channel_set_rgb_clipped(&channel, r, g, b); + channel_set_rgb8_clipped(&channel, r, g, b); *channels = ((uint64_t)channel << 32llu) | (*channels & 0xffffffffllu); } @@ -394,9 +394,9 @@ channels_set_bg_rgb8(uint64_t* channels, int r, int g, int b){ // Same, but clips to [0..255]. static inline void -channels_set_bg_rgb_clipped(uint64_t* channels, int r, int g, int b){ +channels_set_bg_rgb8_clipped(uint64_t* channels, int r, int g, int b){ unsigned channel = channels_bchannel(*channels); - channel_set_rgb_clipped(&channel, r, g, b); + channel_set_rgb8_clipped(&channel, r, g, b); channels_set_bchannel(channels, channel); } @@ -1798,8 +1798,8 @@ cell_set_fg_rgb8(cell* cl, int r, int g, int b){ // Same, but clipped to [0..255]. static inline void -cell_set_fg_rgb_clipped(cell* cl, int r, int g, int b){ - channels_set_fg_rgb_clipped(&cl->channels, r, g, b); +cell_set_fg_rgb8_clipped(cell* cl, int r, int g, int b){ + channels_set_fg_rgb8_clipped(&cl->channels, r, g, b); } // Same, but with an assembled 24-bit RGB value. @@ -1829,8 +1829,8 @@ cell_set_bg_rgb8(cell* cl, int r, int g, int b){ // Same, but clipped to [0..255]. static inline void -cell_set_bg_rgb_clipped(cell* cl, int r, int g, int b){ - channels_set_bg_rgb_clipped(&cl->channels, r, g, b); +cell_set_bg_rgb8_clipped(cell* cl, int r, int g, int b){ + channels_set_bg_rgb8_clipped(&cl->channels, r, g, b); } // Same, but with an assembled 24-bit RGB value. A value over 0xffffff @@ -1964,8 +1964,8 @@ API int ncplane_set_fg_rgb8(struct ncplane* n, int r, int g, int b); API int ncplane_set_bg_rgb8(struct ncplane* n, int r, int g, int b); // Same, but clipped to [0..255]. -API void ncplane_set_bg_rgb_clipped(struct ncplane* n, int r, int g, int b); -API void ncplane_set_fg_rgb_clipped(struct ncplane* n, int r, int g, int b); +API void ncplane_set_bg_rgb8_clipped(struct ncplane* n, int r, int g, int b); +API void ncplane_set_fg_rgb8_clipped(struct ncplane* n, int r, int g, int b); // Same, but with rgb assembled into a channel (i.e. lower 24 bits). API int ncplane_set_fg_rgb(struct ncplane* n, unsigned channel); diff --git a/python/src/notcurses/build_notcurses.py b/python/src/notcurses/build_notcurses.py index 39535d726..992561f2b 100644 --- a/python/src/notcurses/build_notcurses.py +++ b/python/src/notcurses/build_notcurses.py @@ -130,8 +130,8 @@ uint16_t ncplane_attr(const struct ncplane* n); unsigned ncplane_styles(const struct ncplane* n); int ncplane_set_fg_rgb8(struct ncplane* n, int r, int g, int b); int ncplane_set_bg_rgb8(struct ncplane* n, int r, int g, int b); -void ncplane_set_fg_rgb_clipped(struct ncplane* n, int r, int g, int b); -void ncplane_set_bg_rgb_clipped(struct ncplane* n, int r, int g, int b); +void ncplane_set_fg_rgb8_clipped(struct ncplane* n, int r, int g, int b); +void ncplane_set_bg_rgb8_clipped(struct ncplane* n, int r, int g, int b); int ncplane_set_fg_rgb(struct ncplane* n, unsigned channel); int ncplane_set_bg_rgb(struct ncplane* n, unsigned channel); void ncplane_set_fg_default(struct ncplane* n); diff --git a/src/demo/whiteout.c b/src/demo/whiteout.c index 1015c24b0..bde3d543b 100644 --- a/src/demo/whiteout.c +++ b/src/demo/whiteout.c @@ -51,7 +51,7 @@ lighten(struct ncplane* n, cell* c, int distance, int y, int x){ r += rand() % (64 / (2 * distance + 1) + 1); g += rand() % (64 / (2 * distance + 1) + 1); b += rand() % (64 / (2 * distance + 1) + 1); - cell_set_fg_rgb_clipped(c, r, g, b); + cell_set_fg_rgb8_clipped(c, r, g, b); return ncplane_putc_yx(n, y, x, c); } diff --git a/src/demo/xray.c b/src/demo/xray.c index d39f9a590..a0efdbcf2 100644 --- a/src/demo/xray.c +++ b/src/demo/xray.c @@ -34,7 +34,7 @@ make_slider(struct notcurses* nc, int dimy, int dimx){ ncplane_set_bg_alpha(n, CELL_ALPHA_TRANSPARENT); for(int x = 0 ; x < REPS ; ++x){ for(size_t l = 0 ; l < sizeof(leg) / sizeof(*leg) ; ++l){ - ncplane_set_fg_rgb_clipped(n, r + 0x8 * l, g + 0x8 * l, b + 0x8 * l); + ncplane_set_fg_rgb8_clipped(n, r + 0x8 * l, g + 0x8 * l, b + 0x8 * l); if(ncplane_set_bg_rgb8(n, (l + 1) * 0x2, 0x20, (l + 1) * 0x2)){ ncplane_destroy(n); return NULL; diff --git a/src/lib/internal.h b/src/lib/internal.h index fc2ab0c47..78f4d7af3 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -730,16 +730,16 @@ static inline uint32_t calc_gradient_channel(uint32_t ul, uint32_t ur, uint32_t ll, uint32_t lr, int y, int x, int ylen, int xlen){ uint32_t chan = 0; - channel_set_rgb_clipped(&chan, - calc_gradient_component(channel_r(ul), channel_r(ur), - channel_r(ll), channel_r(lr), - y, x, ylen, xlen), - calc_gradient_component(channel_g(ul), channel_g(ur), - channel_g(ll), channel_g(lr), - y, x, ylen, xlen), - calc_gradient_component(channel_b(ul), channel_b(ur), - channel_b(ll), channel_b(lr), - y, x, ylen, xlen)); + channel_set_rgb8_clipped(&chan, + calc_gradient_component(channel_r(ul), channel_r(ur), + channel_r(ll), channel_r(lr), + y, x, ylen, xlen), + calc_gradient_component(channel_g(ul), channel_g(ur), + channel_g(ll), channel_g(lr), + y, x, ylen, xlen), + calc_gradient_component(channel_b(ul), channel_b(ur), + channel_b(ll), channel_b(lr), + y, x, ylen, xlen)); channel_set_alpha(&chan, channel_alpha(ul)); // precondition: all αs are equal return chan; } diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 425da12d1..473a6ba27 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1115,16 +1115,16 @@ void ncplane_set_bg_default(ncplane* n){ channels_set_bg_default(&n->channels); } -void ncplane_set_bg_rgb_clipped(ncplane* n, int r, int g, int b){ - channels_set_bg_rgb_clipped(&n->channels, r, g, b); +void ncplane_set_bg_rgb8_clipped(ncplane* n, int r, int g, int b){ + channels_set_bg_rgb8_clipped(&n->channels, r, g, b); } int ncplane_set_bg_rgb8(ncplane* n, int r, int g, int b){ return channels_set_bg_rgb8(&n->channels, r, g, b); } -void ncplane_set_fg_rgb_clipped(ncplane* n, int r, int g, int b){ - channels_set_fg_rgb_clipped(&n->channels, r, g, b); +void ncplane_set_fg_rgb8_clipped(ncplane* n, int r, int g, int b){ + channels_set_fg_rgb8_clipped(&n->channels, r, g, b); } int ncplane_set_fg_rgb8(ncplane* n, int r, int g, int b){