1notcurses_channels(3) notcurses_channels(3)
2
3
4
6 notcurses_channels - operations on notcurses channels
7
9 #include <notcurses/notcurses.h>
10
11 #define NCCHANNEL_INITIALIZER(r, g, b) \
12 (((uint32_t)r << 16u) + ((uint32_t)g << 8u) + (b) + NC_BGDEFAULT_MASK)
13
14 #define NCCHANNELS_INITIALIZER(fr, fg, fb, br, bg, bb) \
15 ((NCCHANNEL_INITIALIZER(fr, fg, fb) << 32ull) + \
16 (NCCHANNEL_INITIALIZER(br, bg, bb)))
17
18 uint32_t ncchannel_r(uint32_t channel);
19
20 uint32_t ncchannel_g(uint32_t channel);
21
22 uint32_t ncchannel_b(uint32_t channel);
23
24 uint32_t ncchannel_rgb(uint32_t channel);
25
26 uint32_t ncchannel_rgb8(uint32_t channel, uint32_t* restrict r,
27 uint32_t* restrict g, uint32_t* restrict b);
28
29 int ncchannel_set_rgb8(uint32_t* channel, unsigned r, unsigned g, un‐
30 signed b);
31
32 int ncchannel_set(uint32_t* channel, uint32_t rgb);
33
34 uint32_t ncchannel_alpha(uint32_t channel);
35
36 int ncchannel_set_alpha(uint32_t* channel, unsigned alpha);
37
38 bool ncchannel_default_p(uint32_t channel);
39
40 uint32_t ncchannel_set_default(uint32_t* channel);
41
42 uint32_t ncchannels_fg_rgb(uint64_t channels);
43
44 uint32_t ncchannels_bg_rgb(uint64_t channels);
45
46 int ncchannels_set_fg_rgb(uint64_t* channels, uint32_t rgb);
47
48 int ncchannels_set_bg_rgb(uint64_t* channels, uint32_t rgb);
49
50 unsigned ncchannels_fg_alpha(uint64_t channels);
51
52 unsigned ncchannels_bg_alpha(uint64_t channels);
53
54 int ncchannels_set_fg_alpha(uint64_t* channels, int alpha);
55
56 int ncchannels_set_bg_alpha(uint64_t* channels, int alpha);
57
58 uint32_t ncchannels_fg_rgb8(uint64_t channels, unsigned* r, unsigned*
59 g, unsigned* b);
60
61 uint32_t ncchannels_bg_rgb8(uint64_t channels, unsigned* r, unsigned*
62 g, unsigned* b);
63
64 int ncchannels_set_fg_rgb8(uint64_t* channels, unsigned r, unsigned g,
65 unsigned b);
66
67 int ncchannels_set_bg_rgb8(uint64_t* channels, unsigned r, unsigned g,
68 unsigned b);
69
70 bool ncchannels_fg_default_p(uint64_t channels);
71
72 bool ncchannels_bg_default_p(uint64_t channels);
73
74 uint64_t ncchannels_set_fg_default(uint64_t* channels);
75
76 uint64_t ncchannels_set_bg_default(uint64_t* channels);
77
78 uint64_t ncchannels_reverse(uint64_t channels);
79
80 unsigned ncchannel_palindex(uint32_t channel);
81
82 bool ncchannel_palindex_p(uint32_t channel);
83
84 int ncchannel_set_palindex(uint32_t* channel, unsigned idx);
85
86 unsigned ncchannels_fg_palindex(uint64_t channels);
87
88 unsigned ncchannels_bg_palindex(uint64_t channels);
89
90 int ncchannels_set_fg_palindex(uint64_t* channels, unsigned idx);
91
92 int ncchannels_set_bg_palindex(uint64_t* channels, unsigned idx);
93
94 uint64_t ncchannels_set_channels(uint64_t* dst, uint64_t channels);
95
96 uint64_t ncchannels_channels(uint64_t channels);
97
98 uint64_t ncchannels_combine(uint32_t fchan, uint32_t bchan);
99
101 Channels ought not be manually manipulated. They contain several bits
102 used "behind the scenes", and e.g. direct assignment is likely to lead
103 to strange and infrequent failures. To assign one channel pair to an‐
104 other, use ncchannels_set_channels. To assign a channel to a channel
105 pair's foreground, use ncchannels_set_fchannel. To assign a channel to
106 a channel pair's background, use ncchannels_set_bchannel.
107
108 ncchannel_palindex extracts the palette index from a channel. The
109 channel must be palette-indexed, or the return value is meaningless.
110 Verify palette indexing with ncchannel_palindex_p. A channel can be
111 set to palette indexed mode (and have the index set) with ncchan‐
112 nel_set_palindex. The index must be less than NCPALETTESIZE.
113
114 ncchannels_combine creates a new channel pair using fchan as the fore‐
115 ground channel and bchan as the background channel.
116
118 Functions returning int return -1 on failure, or 0 on success. Failure
119 is always due to invalid inputs. Functions returning bool are predi‐
120 cates, and return the requested value. Functions returning unsigned
121 forms return the input, modified as requested.
122
123 ncchannels_reverse inverts the color components of the two channels,
124 while holding all other elements constant. It's the Notcurses approxi‐
125 mation to reverse video.
126
128 notcurses(3), notcurses_cell(3), notcurses_plane(3), notcurses_out‐
129 put(3)
130
132 nick black <nickblack@linux.com>.
133
134
135
136 v3.0.8 notcurses_channels(3)