rename _rgb_clipped functions rgb8_clipped

This commit is contained in:
nick black 2020-09-19 21:55:01 -04:00
parent 4459efa216
commit 607c03edc4
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
12 changed files with 47 additions and 43 deletions

View File

@ -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()`.

View File

@ -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.

View File

@ -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);**

View File

@ -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);**

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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){