NcChannels_u64

Type Alias NcChannels_u64 

Source
pub type NcChannels_u64 = u64;
Expand description

64 bits containing a foreground and background NcChannel_u32.

It’s recommended to use NcChannels instead.

At render time, both 24-bit NcRgb_u32 values are quantized down to terminal capabilities, if necessary. There’s a clear path to 10-bit support should we one day need it.

§Default Color

The “default color” is best explained by color(3NCURSES) and default_colors(3NCURSES). Ours is the same concept.

Until the “not default color” bit is set, any color you load will be ignored.

§Diagram

~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB║~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB
↑↑↑↑↑↑↑↑↑↑↑↑ foreground ↑↑↑↑↑↑↑↑↑↑↑║↑↑↑↑↑↑↑↑↑↑↑↑ background ↑↑↑↑↑↑↑↑↑↑↑

Detailed info (specially on the context-dependent bits on each NcChannel_u32’s 4th byte):

                            ~foreground channel~
reserved, must be 0                                  ↓bits view↓               ↓hex mask↓
0·······|········|········|········║········|········|········|········  =  8·······|········

NcChannels::FG_DEFAULT_MASK: foreground is NOT "default color"
·1······|········|········|········║········|········|········|········  =  4·······|········

NcChannels::FG_ALPHA_MASK: foreground alpha (2bits)
··11····|········|········|········║········|········|········|········  =  3·······|········

NcChannels::FG_PALETTE: foreground uses palette index
····1···|········|········|········║········|········|········|········  =  ·8······|········

NcChannels::NOBACKGROUND_MASK: glyph is entirely foreground
·····1··|········|········|········║········|········|········|········  =  ·4······|········

reserved, must be 0
······00|········|········|········║········|········|········|········  =  ·3······|········

NcChannels::FG_RGB_MASK: foreground in 3x8 RGB (rrggbb)
········|11111111|11111111|11111111║········|········|········|········  =  ··FFFFFF|········
                            ~background channel~
reserved, must be 0                                  ↓bits view↓               ↓hex mask↓
········|········|········|········║0·······|········|········|········  =  ········|8·······

NcChannels::BGDEFAULT_MASK: background is NOT "default color"
········|········|········|········║·1······|········|········|········  =  ········|4·······

NcChannels::BG_ALPHA_MASK: background alpha (2 bits)
········|········|········|········║··11····|········|········|········  =  ········|3·······

NcChannels::BG_PALETTE: background uses palette index
········|········|········|········║····1···|········|········|········  =  ········|·8······

reserved, must be 0
········|········|········|········║·····000|········|········|········  =  ········|·7······

NcChannels::BG_RGB_MASK: background in 3x8 RGB (rrggbb)
········|········|········|········║········|11111111|11111111|11111111  =  ········|··FFFFFF

type in C: channels (uint64_t)

§NcChannels Mask Flags

Trait Implementations§

Source§

impl<'a> From<&'a NcChannels> for &'a NcChannels_u64

Source§

fn from(s: &'a NcChannels) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut NcChannels> for &'a mut NcChannels_u64

Source§

fn from(s: &'a mut NcChannels) -> Self

Converts to this type from the input type.
Source§

impl From<NcChannels> for NcChannels_u64

Source§

fn from(s: NcChannels) -> Self

Converts to this type from the input type.