Go to the source code of this file.
|
void | ncplane_greyscale (ncplane *n) |
|
int | ncplane_polyfill_yx (ncplane *n, int ystart, int xstart, const nccell *c) |
|
bool | check_gradient_args (uint64_t ul, uint64_t ur, uint64_t bl, uint64_t br) |
|
int | ncplane_gradient2x1 (ncplane *n, int y, int x, unsigned ylen, unsigned xlen, uint32_t ul, uint32_t ur, uint32_t ll, uint32_t lr) |
|
int | ncplane_highgradient_sized (ncplane *n, uint32_t ul, uint32_t ur, uint32_t ll, uint32_t lr, int ylen, int xlen) |
|
int | ncplane_gradient (ncplane *n, int y, int x, unsigned ylen, unsigned xlen, const char *egc, uint16_t stylemask, uint64_t ul, uint64_t ur, uint64_t bl, uint64_t br) |
|
int | ncplane_stain (ncplane *n, int y, int x, unsigned ylen, unsigned xlen, uint64_t tl, uint64_t tr, uint64_t bl, uint64_t br) |
|
int | ncplane_format (ncplane *n, int y, int x, unsigned ylen, unsigned xlen, uint16_t stylemask) |
|
int | ncplane_rotate_cw (ncplane *n) |
|
int | ncplane_rotate_ccw (ncplane *n) |
|
int | ncplane_qrcode (ncplane *n, unsigned *ymax, unsigned *xmax, const void *data, size_t len) |
|
◆ check_gradient_args()
bool check_gradient_args |
( |
uint64_t |
ul, |
|
|
uint64_t |
ur, |
|
|
uint64_t |
bl, |
|
|
uint64_t |
br |
|
) |
| |
Definition at line 150 of file fill.c.
150 {
151 if(check_gradient_channel_args(ncchannels_fchannel(
ul), ncchannels_fchannel(
ur),
152 ncchannels_fchannel(bl), ncchannels_fchannel(br))){
153 return true;
154 }
155 if(check_gradient_channel_args(ncchannels_bchannel(
ul), ncchannels_bchannel(
ur),
156 ncchannels_bchannel(bl), ncchannels_bchannel(br))){
157 return true;
158 }
159 return false;
160}
API int API int API int uint64_t ul
API int API int API int uint64_t uint64_t ur
◆ ncplane_format()
int ncplane_format |
( |
ncplane * |
n, |
|
|
int |
y, |
|
|
int |
x, |
|
|
unsigned |
ylen, |
|
|
unsigned |
xlen, |
|
|
uint16_t |
stylemask |
|
) |
| |
Definition at line 296 of file fill.c.
297 {
298 unsigned ystart, xstart;
299 if(check_geometry_args(
n,
y,
x, &
ylen, &
xlen, &ystart, &xstart)){
300 return -1;
301 }
302 int total = 0;
303 for(
unsigned yy = ystart ; yy < ystart +
ylen ; ++yy){
304 for(
unsigned xx = xstart ; xx < xstart +
xlen ; ++xx){
305 nccell* targc = ncplane_cell_ref_yx(
n, yy, xx);
307 ++total;
308 }
309 }
310 return total;
311}
API int API int API int uint64_t uint64_t uint64_t uint64_t unsigned unsigned xlen
API int API int API int uint64_t uint64_t uint64_t uint64_t unsigned ylen
◆ ncplane_gradient()
int ncplane_gradient |
( |
ncplane * |
n, |
|
|
int |
y, |
|
|
int |
x, |
|
|
unsigned |
ylen, |
|
|
unsigned |
xlen, |
|
|
const char * |
egc, |
|
|
uint16_t |
stylemask, |
|
|
uint64_t |
ul, |
|
|
uint64_t |
ur, |
|
|
uint64_t |
bl, |
|
|
uint64_t |
br |
|
) |
| |
Definition at line 227 of file fill.c.
229 {
231 return -1;
232 }
233 unsigned ystart, xstart;
234 if(check_geometry_args(
n,
y,
x, &
ylen, &
xlen, &ystart, &xstart)){
235 return -1;
236 }
239 if(
ul !=
ur ||
ur != br || br != bl){
240 logerror(
"channel variation in 1x1 area");
241 return -1;
242 }
243 }else{
244 if(
ul != bl ||
ur != br){
245 logerror(
"vertical channel variation in single row");
246 return -1;
247 }
248 }
250 if(
ul !=
ur || bl != br){
251 logerror(
"horizontal channel variation in single column");
252 return -1;
253 }
254 }
255 int total = 0;
256 for(
unsigned yy = ystart ; yy < ystart +
ylen ; ++yy){
257 for(
unsigned xx = xstart ; xx < xstart +
xlen ; ++xx){
258 nccell* targc = ncplane_cell_ref_yx(
n, yy, xx);
261 return -1;
262 }
264 calc_gradient_channels(&targc->
channels,
ul,
ur, bl, br,
265 yy - ystart, xx - xstart,
ylen,
xlen);
266 ++total;
267 }
268 }
269 return total;
270}
bool check_gradient_args(uint64_t ul, uint64_t ur, uint64_t bl, uint64_t br)
#define logerror(fmt,...)
int nccell_load(ncplane *n, nccell *c, const char *gcluster)
◆ ncplane_gradient2x1()
int ncplane_gradient2x1 |
( |
ncplane * |
n, |
|
|
int |
y, |
|
|
int |
x, |
|
|
unsigned |
ylen, |
|
|
unsigned |
xlen, |
|
|
uint32_t |
ul, |
|
|
uint32_t |
ur, |
|
|
uint32_t |
ll, |
|
|
uint32_t |
lr |
|
) |
| |
Definition at line 179 of file fill.c.
180 {
182 logerror(
"highdef gradients require utf8");
183 return -1;
184 }
185 if(check_gradient_channel_args(
ul,
ur,
ll,
lr)){
186 return -1;
187 }
188 unsigned ystart, xstart;
189 if(check_geometry_args(
n,
y,
x, &
ylen, &
xlen, &ystart, &xstart)){
190 return -1;
191 }
194 logerror(
"horizontal channel variation in single column");
195 return -1;
196 }
197 }
198 int total = 0;
199 for(
unsigned yy = ystart ; yy < ystart +
ylen ; ++yy){
200 for(
unsigned xx = xstart ; xx < xstart +
xlen ; ++xx){
201 nccell* targc = ncplane_cell_ref_yx(
n, yy, xx);
203 if(pool_blit_direct(&
n->pool, targc,
"▀", strlen(
"▀"), 1) <= 0){
204 return -1;
205 }
206 calc_highgradient(targc,
ul,
ur,
ll,
lr, yy - ystart, xx - xstart,
ylen * 2,
xlen);
207 ++total;
208 }
209 }
210 return total;
211}
API int API int API int uint64_t uint64_t uint64_t uint64_t lr
API int API int API int uint64_t uint64_t uint64_t ll
notcurses * ncplane_notcurses(const ncplane *n)
◆ ncplane_greyscale()
void ncplane_greyscale |
( |
ncplane * |
n | ) |
|
Definition at line 3 of file fill.c.
3 {
4 for(
unsigned y = 0 ;
y <
n->leny ; ++
y){
5 for(
unsigned x = 0 ;
x <
n->lenx ; ++
x){
8 nccell_fg_rgb8(
c, &
r, &g, &b);
9 int gy = rgb_greyscale(
r, g, b);
10 nccell_set_fg_rgb8(
c, gy, gy, gy);
11 nccell_bg_rgb8(
c, &
r, &g, &b);
12 gy = rgb_greyscale(
r, g, b);
13 nccell_set_bg_rgb8(
c, gy, gy, gy);
14 }
15 }
16}
◆ ncplane_highgradient_sized()
int ncplane_highgradient_sized |
( |
ncplane * |
n, |
|
|
uint32_t |
ul, |
|
|
uint32_t |
ur, |
|
|
uint32_t |
ll, |
|
|
uint32_t |
lr, |
|
|
int |
ylen, |
|
|
int |
xlen |
|
) |
| |
Definition at line 214 of file fill.c.
215 {
217 return -1;
218 }
220
221
222 return ncplane_gradient(
n, -1, -1,
ylen,
xlen,
" ", 0,
ul,
ur,
ll,
lr);
223 }
225}
int ncplane_gradient2x1(ncplane *n, int y, int x, unsigned ylen, unsigned xlen, uint32_t ul, uint32_t ur, uint32_t ll, uint32_t lr)
int ncplane_gradient(ncplane *n, int y, int x, unsigned ylen, unsigned xlen, const char *egc, uint16_t stylemask, uint64_t ul, uint64_t ur, uint64_t bl, uint64_t br)
const notcurses * ncplane_notcurses_const(const ncplane *n)
◆ ncplane_polyfill_yx()
int ncplane_polyfill_yx |
( |
ncplane * |
n, |
|
|
int |
ystart, |
|
|
int |
xstart, |
|
|
const nccell * |
c |
|
) |
| |
Definition at line 80 of file fill.c.
80 {
81 if(ystart < 0){
82 if(ystart != -1){
84 return -1;
85 }
87 }
89 if(xstart < 0){
90 if(xstart != -1){
92 return -1;
93 }
95 }
97 if(
y >=
n->leny ||
x >=
n->lenx){
98 logerror(
"invalid start: %u/%u (%u/%u)",
y,
x,
n->leny,
n->lenx);
99 return -1;
100 }
101 const nccell* cur = &
n->fb[nfbcellidx(
n,
y,
x)];
104
105 if(strcmp(fillegc, targ) == 0){
106 return 0;
107 }
108 int ret = -1;
109
110
111 char* targcopy = strdup(targ);
112 if(targcopy){
113 ret = ncplane_polyfill_inner(
n,
y,
x,
c, targcopy);
115 }
116 return ret;
117}
const char * nccell_extended_gcluster(const ncplane *n, const nccell *c)
◆ ncplane_qrcode()
int ncplane_qrcode |
( |
ncplane * |
n, |
|
|
unsigned * |
ymax, |
|
|
unsigned * |
xmax, |
|
|
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
Definition at line 651 of file fill.c.
651 {
653 (void)ymax;
654 (void)xmax;
655 (void)data;
657 return -1;
658}
API int API int const nccell unsigned len
◆ ncplane_rotate_ccw()
int ncplane_rotate_ccw |
( |
ncplane * |
n | ) |
|
Definition at line 515 of file fill.c.
515 {
518 return -1;
519 }
520 unsigned dimy, dimx, targdimy, targdimx;
523 int x = (int)dimx - 2;
525
526
527 for(unsigned targy = 0 ; targy < targdimy ; ++targy){
529 for(unsigned targx = 0 ; targx < targdimx ; targx += 2){
530 if(rotate_2x1_ccw(
n, newp,
y,
x, targy, targx)){
532 return -1;
533 }
535 }
537 }
538 int ret = rotate_merge(
n, newp);
540 return ret;
541}
int ncplane_destroy(ncplane *ncp)
void ncplane_dim_yx(const ncplane *n, unsigned *rows, unsigned *cols)
◆ ncplane_rotate_cw()
int ncplane_rotate_cw |
( |
ncplane * |
n | ) |
|
Definition at line 484 of file fill.c.
484 {
487 return -1;
488 }
489 unsigned dimy, dimx;
491 int centy, centx;
493
494
495
496
497
498 int targx, targy = 0;
499 for(
unsigned x = 0 ;
x < dimx ;
x += 2){
500 targx = 0;
501 for(
int y = (
int)dimy - 1 ;
y >= 0 ; --
y){
502 if(rotate_2x1_cw(
n, newp,
y,
x, targy, targx)){
504 return -1;
505 }
506 targx += 2;
507 }
508 ++targy;
509 }
510 int ret = rotate_merge(
n, newp);
512 return ret;
513}
void ncplane_center_abs(const ncplane *n, int *RESTRICT y, int *RESTRICT x)
◆ ncplane_stain()
int ncplane_stain |
( |
ncplane * |
n, |
|
|
int |
y, |
|
|
int |
x, |
|
|
unsigned |
ylen, |
|
|
unsigned |
xlen, |
|
|
uint64_t |
tl, |
|
|
uint64_t |
tr, |
|
|
uint64_t |
bl, |
|
|
uint64_t |
br |
|
) |
| |
Definition at line 272 of file fill.c.
273 {
274
276 return -1;
277 }
278 unsigned ystart, xstart;
279 if(check_geometry_args(
n,
y,
x, &
ylen, &
xlen, &ystart, &xstart)){
280 return -1;
281 }
282 int total = 0;
283 for(
unsigned yy = ystart ; yy < ystart +
ylen ; ++yy){
284 for(
unsigned xx = xstart ; xx < xstart +
xlen ; ++xx){
285 nccell* targc = ncplane_cell_ref_yx(
n, yy, xx);
287 calc_gradient_channels(&targc->
channels, tl, tr, bl, br,
288 yy - ystart, xx - xstart,
ylen,
xlen);
289 }
290 ++total;
291 }
292 }
293 return total;
294}