1notcurses_lines(3) notcurses_lines(3)
2
3
4
6 notcurses_lines - operations on lines and boxes
7
9 #include <notcurses/notcurses.h>
10
11 int ncplane_hline_interp(struct ncplane* n, const nccell* c, unsigned
12 len, uint64_t c1, uint64_t c2);
13
14 static inline int ncplane_hline(struct ncplane* n, const nccell* c, un‐
15 signed len);
16
17 int ncplane_vline_interp(struct ncplane* n, const nccell* c, unsigned
18 len, uint64_t c1, uint64_t c2);
19
20 static inline int ncplane_vline(struct ncplane* n, const nccell* c, un‐
21 signed len);
22
23 #define NCBOXMASK_TOP 0x0001
24 #define NCBOXMASK_RIGHT 0x0002
25 #define NCBOXMASK_BOTTOM 0x0004
26 #define NCBOXMASK_LEFT 0x0008
27 #define NCBOXGRAD_TOP 0x0010
28 #define NCBOXGRAD_RIGHT 0x0020
29 #define NCBOXGRAD_BOTTOM 0x0040
30 #define NCBOXGRAD_LEFT 0x0080
31 #define NCBOXCORNER_MASK 0x0300
32 #define NCBOXCORNER_SHIFT 8u
33
34 int ncplane_box(struct ncplane* n, const nccell* ul, const nccell* ur,
35 const nccell* ll, const nccell* lr, const nccell* hline, const nccell*
36 vline, int ystop, int xstop, unsigned ctlword);
37
38 static inline int ncplane_box_sized(struct ncplane* n, const nccell*
39 ul, const nccell* ur, const nccell* ll, const nccell* lr, const nccell*
40 hline, const nccell* vline, int ylen, int xlen, unsigned ctlword);
41
42 static inline int ncplane_perimeter(struct ncplane* n, const nccell*
43 ul, const nccell* ur, const nccell* ll, const nccell* lr, const nccell*
44 hline, const nccell* vline, unsigned ctlword)
45
46 static inline int nccells_load_box(struct ncplane* n, uint16_t styles,
47 uint64_t channels, nccell* ul, nccell* ur, nccell* ll, nccell* lr, nc‐
48 cell* hl, nccell* vl, const char* gclusters);
49
50 static inline int nccells_rounded_box(struct ncplane* n, uint16_t
51 styles, uint64_t channels, nccell* ul, nccell* ur, nccell* ll, nccell*
52 lr, nccell* hl, nccell* vl);
53
54 static inline int ncplane_rounded_box(struct ncplane* n, uint16_t
55 styles, uint64_t channels, int ystop, int xstop, unsigned ctlword);
56
57 static inline int ncplane_rounded_box_sized(struct ncplane* n, uint16_t
58 styles, uint64_t channels, int ylen, int xlen, unsigned ctlword);
59
60 static inline int nccells_double_box(struct ncplane* n, uint16_t
61 styles, uint64_t channels, nccell* ul, nccell* ur, nccell* ll, nccell*
62 lr, nccell* hl, nccell* vl);
63
64 static inline int ncplane_double_box(struct ncplane* n, uint16_t
65 styles, uint64_t channels, int ystop, int xstop, unsigned ctlword);
66
67 static inline int ncplane_double_box_sized(struct ncplane* n, uint16_t
68 styles, uint64_t channels, int ylen, int xlen, unsigned ctlword);
69
70 int ncplane_polyfill_yx(struct ncplane* n, unsigned y, unsigned x, con‐
71 st nccell* c);
72
73 int ncplane_gradient(struct ncplane* n, int y, int x, unsigned ylen,
74 unsigned xlen, const char* egc, uint16_t stylemask, uint64_t ul,
75 uint64_t ur, uint64_t ll, uint64_t lr);
76
77 int ncplane_highgradient2x1(struct ncplane* n, int y, int x, unsigned
78 ylen, unsigned xlen, uint32_t ul, uint32_t ur, uint32_t ll, uint32_t
79 lr);
80
81 int ncplane_format(struct ncplane* n, int y, int x, unsigned ylen, un‐
82 signed xlen, uint16_t stylemask);
83
84 int ncplane_stain(struct ncplane* n, int y, int x, unsigned ylen, un‐
85 signed xlen, uint64_t ul, uint64_t ur, uint64_t ll, uint64_t lr);
86
88 ncplane_polyfill_yx starts at the specified y and x (provide -1 to use
89 the cursor's position in the relevant dimension). The cell at these
90 coordinates is replaced with c. All connected cells having the same
91 content as this original cell are replaced with c, recursively. Two
92 cells are connected if they are vertical or horizontal neighbors of one
93 another.
94
95 ncplane_gradient replaces all glyphs in the specified area with egc,
96 and colors them with the specified gradient. All content within the
97 specified area is destroyed.
98
99 ncplane_gradient2x1 draws a high-definition gradient in the specified
100 area. It will return an error if UTF8 is not being used. The gradient
101 is drawn using the UPPER HALF BLOCK glyph, with two vertical steps and
102 one horizontal step in each cell. Since cells are often about twice as
103 tall as they are wide, this tends to result in very even color differ‐
104 ences. All content within the specified area is destroyed.
105
106 ncplane_format sets the attributes of every cell in the region having
107 its upper-left corner at y and x (provide -1 to use the cursor's posi‐
108 tion in the relevant dimension), and its area defined by ylen and xlen
109 (provide 0 to use all remaining area to the right and below, respec‐
110 tively). Channels and glyphs will be unaffected.
111
112 ncplane_stain works the same way, but sets channels. Standard linear
113 interpolation is applied between the provided corner channels. Glyphs
114 and their attributes will be unaffected.
115
116 Box- and line-drawing is unaffected by a plane's scrolling status.
117
119 ncplane_format, ncplane_stain, ncplane_gradient, ncplane_gradient2x1,
120 and ncplane_polyfill_yx return -1 if any coordinates are outside the
121 plane, and otherwise the number of cells affected.
122
123 ncplane_hline_interp, ncplane_hline, ncplane_vline_interp, and nc‐
124 plane_vline all return the number of glyphs drawn on success, or -1 on
125 failure. Passing a length of 0 is an error.
126
128 notcurses(3), notcurses_cell(3), notcurses_plane(3)
129
131 nick black <nickblack@linux.com>.
132
133
134
135 v3.0.8 notcurses_lines(3)