.\" Automatically generated by Pandoc 3.1.8 .\" .TH "notcurses_channels" "3" "v3.0.9" "" "" .SH NAME notcurses_channels - operations on notcurses channels .SH SYNOPSIS \f[B]#include \f[R] .IP .EX #define NCCHANNEL_INITIALIZER(r, g, b) \[rs] (((uint32_t)r << 16u) + ((uint32_t)g << 8u) + (b) + NC_BGDEFAULT_MASK) #define NCCHANNELS_INITIALIZER(fr, fg, fb, br, bg, bb) \[rs] ((NCCHANNEL_INITIALIZER(fr, fg, fb) << 32ull) + \[rs] (NCCHANNEL_INITIALIZER(br, bg, bb))) .EE .PP \f[B]uint32_t ncchannel_r(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannel_g(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannel_b(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannel_rgb(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannel_rgb8(uint32_t \f[R]\f[I]channel\f[R]\f[B], uint32_t* restrict \f[R]\f[I]r\f[R]\f[B], uint32_t* restrict \f[R]\f[I]g\f[R]\f[B], uint32_t* restrict \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncchannel_set_rgb8(uint32_t* \f[R]\f[I]channel\f[R]\f[B], unsigned \f[R]\f[I]r\f[R]\f[B], unsigned \f[R]\f[I]g\f[R]\f[B], unsigned \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncchannel_set(uint32_t* \f[R]\f[I]channel\f[R]\f[B], uint32_t \f[R]\f[I]rgb\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannel_alpha(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]int ncchannel_set_alpha(uint32_t* \f[R]\f[I]channel\f[R]\f[B], unsigned \f[R]\f[I]alpha\f[R]\f[B]);\f[R] .PP \f[B]bool ncchannel_default_p(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannel_set_default(uint32_t* \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannels_fg_rgb(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannels_bg_rgb(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_fg_rgb(uint64_t* \f[R]\f[I]channels\f[R]\f[B], uint32_t \f[R]\f[I]rgb\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_bg_rgb(uint64_t* \f[R]\f[I]channels\f[R]\f[B], uint32_t \f[R]\f[I]rgb\f[R]\f[B]);\f[R] .PP \f[B]unsigned ncchannels_fg_alpha(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]unsigned ncchannels_bg_alpha(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_fg_alpha(uint64_t* \f[R]\f[I]channels\f[R]\f[B], int \f[R]\f[I]alpha\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_bg_alpha(uint64_t* \f[R]\f[I]channels\f[R]\f[B], int \f[R]\f[I]alpha\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannels_fg_rgb8(uint64_t \f[R]\f[I]channels\f[R]\f[B], unsigned* \f[R]\f[I]r\f[R]\f[B], unsigned* \f[R]\f[I]g\f[R]\f[B], unsigned* \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]uint32_t ncchannels_bg_rgb8(uint64_t \f[R]\f[I]channels\f[R]\f[B], unsigned* \f[R]\f[I]r\f[R]\f[B], unsigned* \f[R]\f[I]g\f[R]\f[B], unsigned* \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_fg_rgb8(uint64_t* \f[R]\f[I]channels\f[R]\f[B], unsigned \f[R]\f[I]r\f[R]\f[B], unsigned \f[R]\f[I]g\f[R]\f[B], unsigned \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_bg_rgb8(uint64_t* \f[R]\f[I]channels\f[R]\f[B], unsigned \f[R]\f[I]r\f[R]\f[B], unsigned \f[R]\f[I]g\f[R]\f[B], unsigned \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]bool ncchannels_fg_default_p(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]bool ncchannels_bg_default_p(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncchannels_set_fg_default(uint64_t* \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncchannels_set_bg_default(uint64_t* \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncchannels_reverse(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]unsigned ncchannel_palindex(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]bool ncchannel_palindex_p(uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]int ncchannel_set_palindex(uint32_t* \f[R]\f[I]channel\f[R]\f[B], unsigned \f[R]\f[I]idx\f[R]\f[B]);\f[R] .PP \f[B]unsigned ncchannels_fg_palindex(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]unsigned ncchannels_bg_palindex(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_fg_palindex(uint64_t* \f[R]\f[I]channels\f[R]\f[B], unsigned \f[R]\f[I]idx\f[R]\f[B]);\f[R] .PP \f[B]int ncchannels_set_bg_palindex(uint64_t* \f[R]\f[I]channels\f[R]\f[B], unsigned \f[R]\f[I]idx\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncchannels_set_channels(uint64_t* \f[R]\f[I]dst\f[R]\f[B], uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncchannels_channels(uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncchannels_combine(uint32_t \f[R]\f[I]fchan\f[R]\f[B], uint32_t \f[R]\f[I]bchan\f[R]\f[B]);\f[R] .SH DESCRIPTION Channels ought not be manually manipulated. They contain several bits used \[dq]behind the scenes\[dq], and e.g. direct assignment is likely to lead to strange and infrequent failures. To assign one channel pair to another, use \f[B]ncchannels_set_channels\f[R]. To assign a channel to a channel pair\[aq]s foreground, use \f[B]ncchannels_set_fchannel\f[R]. To assign a channel to a channel pair\[aq]s background, use \f[B]ncchannels_set_bchannel\f[R]. .PP \f[B]ncchannel_palindex\f[R] extracts the palette index from a channel. The channel must be palette-indexed, or the return value is meaningless. Verify palette indexing with \f[B]ncchannel_palindex_p\f[R]. A channel can be set to palette indexed mode (and have the index set) with \f[B]ncchannel_set_palindex\f[R]. The index must be less than \f[B]NCPALETTESIZE\f[R]. .PP \f[B]ncchannels_combine\f[R] creates a new channel pair using \f[B]\f[BI]fchan\f[B]\f[R] as the foreground channel and \f[B]\f[BI]bchan\f[B]\f[R] as the background channel. .SH RETURN VALUES Functions returning \f[B]int\f[R] return -1 on failure, or 0 on success. Failure is always due to invalid inputs. Functions returning \f[B]bool\f[R] are predicates, and return the requested value. Functions returning \f[B]unsigned\f[R] forms return the input, modified as requested. .PP \f[B]ncchannels_reverse\f[R] inverts the color components of the two channels, while holding all other elements constant. It\[aq]s the Notcurses approximation to reverse video. .SH SEE ALSO \f[B]notcurses(3)\f[R], \f[B]notcurses_cell(3)\f[R], \f[B]notcurses_plane(3)\f[R], \f[B]notcurses_output(3)\f[R] .SH AUTHORS nick black .