Type Definition libnotcurses_sys::NcChannels [−][src]
type NcChannels = u64;
Expand description
64 bits containing a foreground and background NcChannel
At render time, both 24-bit NcRgb
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
’s 4th byte):
~foreground channel~
NCALPHA_WIDEASIAN_MASK: part of a wide glyph ↓bits view↓ ↓hex mask↓
1·······|········|········|········║········|········|········|········ = 8·······|········
NCALPHA_FGDEFAULT_MASK: foreground is NOT "default color"
·1······|········|········|········║········|········|········|········ = 4·······|········
NCALPHA_FG_ALPHA_MASK: foreground alpha (2bits)
··11····|········|········|········║········|········|········|········ = 3·······|········
NCALPHA_FG_PALETTE: foreground uses palette index
····1···|········|········|········║········|········|········|········ = ·8······|········
NCALPHA_NOBACKGROUND_MASK: glyph is entirely foreground
·····1··|········|········|········║········|········|········|········ = ·4······|········
reserved, must be 0
······00|········|········|········║········|········|········|········ = ·3······|········
NCALPHA_FG_RGB_MASK: foreground in 3x8 RGB (rrggbb)
········|11111111|11111111|11111111║········|········|········|········ = ··FFFFFF|········
~background channel~
reserved, must be 0 ↓bits view↓ ↓hex mask↓
········|········|········|········║0·······|········|········|········ = ········|8·······
NCALPHA_BGDEFAULT_MASK: background is NOT "default color"
········|········|········|········║·1······|········|········|········ = ········|4·······
NCALPHA_BG_ALPHA_MASK: background alpha (2 bits)
········|········|········|········║··11····|········|········|········ = ········|3·······
NCALPHA_BG_PALETTE: background uses palette index
········|········|········|········║····1···|········|········|········ = ········|·8······
reserved, must be 0
········|········|········|········║·····000|········|········|········ = ········|·7······
NCALPHA_BG_RGB_MASK: background in 3x8 RGB (rrggbb)
········|········|········|········║········|11111111|11111111|11111111 = ········|··FFFFFF
type in C: channels (uint64_t)
NcCell
Mask Flags
Trait Implementations
New NcChannels
, set to black and using the “default color”.
New NcChannels
, expects two separate NcRgb
s for the foreground
and background channels.
New NcChannels
, expects a single NcRgb
for both foreground
and background channels.
fn from_rgb_alpha(
fg_rgb: NcRgb,
fg_alpha: NcAlphaBits,
bg_rgb: NcRgb,
bg_alpha: NcAlphaBits
) -> Self
[src]
fn from_rgb_alpha(
fg_rgb: NcRgb,
fg_alpha: NcAlphaBits,
bg_rgb: NcRgb,
bg_alpha: NcAlphaBits
) -> Self
[src]New NcChannels
, expects two separate NcRgb
& NcAlphaBits
for the
foreground and background channels.
New NcChannels
, expects NcRgb
& NcAlphaBits
for both
channels.
fn from_rgb8(
fg_r: NcComponent,
fg_g: NcComponent,
fg_b: NcComponent,
bg_r: NcComponent,
bg_g: NcComponent,
bg_b: NcComponent
) -> Self
[src]
fn from_rgb8(
fg_r: NcComponent,
fg_g: NcComponent,
fg_b: NcComponent,
bg_r: NcComponent,
bg_g: NcComponent,
bg_b: NcComponent
) -> Self
[src]New NcChannels
, expects three RGB NcComponent
components
for each channel.
New NcChannels
, expects three RGB NcComponent
components for
both the foreground and background channels.
fn from_rgb8_alpha(
fg_r: NcComponent,
fg_g: NcComponent,
fg_b: NcComponent,
fg_alpha: NcAlphaBits,
bg_r: NcComponent,
bg_g: NcComponent,
bg_b: NcComponent,
bg_alpha: NcAlphaBits
) -> Self
[src]
fn from_rgb8_alpha(
fg_r: NcComponent,
fg_g: NcComponent,
fg_b: NcComponent,
fg_alpha: NcAlphaBits,
bg_r: NcComponent,
bg_g: NcComponent,
bg_b: NcComponent,
bg_alpha: NcAlphaBits
) -> Self
[src]New NcChannels
, expects three RGB NcComponent
s and
NcAlphaBits
, for both the foreground and background channels.
fn from_rgb8_alpha_both(
r: NcComponent,
g: NcComponent,
b: NcComponent,
alpha: NcAlphaBits
) -> Self
[src]
fn from_rgb8_alpha_both(
r: NcComponent,
g: NcComponent,
b: NcComponent,
alpha: NcAlphaBits
) -> Self
[src]New NcChannel
, expects three RGB NcComponent
s.
Combines two NcChannel
s into an NcChannels
.
C style function: channels_combine().
Extracts the foreground NcChannel
.
C style function: channels_fchannel().
Extracts the background NcChannel
.
C style function: channels_bchannel().
Sets the foreground NcChannel
.
C style function: channels_set_fchannel().
Sets the background NcChannel
.
C style function: channels_set_bchannel().
Gets the foreground NcAlphaBits
.
C style function: channels_fg_alpha().
Gets the background NcAlphaBits
.
C style function: channels_bg_alpha().
Sets the foreground NcAlphaBits
.
C style function: channels_set_fg_alpha().
Sets the background NcAlphaBits
.
C style function: channels_set_bg_alpha().
Gets the foreground NcRgb
.
C style function: channels_fg_rgb().
Gets the background NcRgb
.
C style function: channels_bg_rgb().
Sets the foreground NcRgb
.
C style function: channels_set_fg_rgb().
Sets the background NcRgb
.
C style function: channels_set_bg_rgb().
Gets the three foreground RGB NcComponent
s (r, g, b).
C style function: channels_fg_rgb8().
Gets the three background RGB NcComponent
s (r, g, b).
C style function: channels_bg_rgb8().
Sets the three foreground RGB NcComponent
s (r, g, b), and
marks the foreground NcChannel
as not using the “default color”.
C style function: channels_set_fg_rgb8().
Sets the three background RGB NcComponent
s (r, g, b), and
marks the background NcChannel
as not using the “default color”.
C style function: channels_set_bg_rgb8().
Gets the foreground red NcComponent
.
(No equivalent C style function)
Gets the foreground green NcComponent
.
(No equivalent C style function)
Gets the foreground blue NcComponent
.
(No equivalent C style function)
Gets the background red NcComponent
.
(No equivalent C style function)
Gets the background green NcComponent
.
(No equivalent C style function)
Gets the background blue NcComponent
.
(No equivalent C style function)
Sets the foreground red NcComponent
, and returns the new NcChannels
.
(No equivalent C style function)
Sets the foreground green NcComponent
, and returns the new NcChannels
.
(No equivalent C style function)
Sets the foreground blue NcComponent
, and returns the new NcChannels
.
(No equivalent C style function)
Sets the background red NcComponent
, and returns the new NcChannels
.
(No equivalent C style function)
Sets the background green NcComponent
, and returns the new NcChannels
.
(No equivalent C style function)
Sets the background blue NcComponent
, and returns the new NcChannels
.
(No equivalent C style function)
Is the background using the “default background color”?
C style function: channels_fg_default_p().
Is the background using the “default background color”?
The “default background color” must generally be used to take advantage of terminal-effected transparency.
C style function: channels_bg_default_p().
Marks the foreground as using its “default color”, and
returns the new NcChannels
.
C style function: channels_set_fg_default().
Marks the background as using its “default color”, and
returns the new NcChannels
.
C style function: channels_set_bg_default().
Marks the foreground as NOT using its “default color”, and
returns the new NcChannels
.
C style function: channels_set_fg_default().
Marks the background as NOT using its “default color”, and
returns the new NcChannels
.
C style function: channels_set_bg_not_default().
Marks both the foreground and background as using its “default color”, and
returns the new NcChannels
.
Marks both the foreground and background as NOT using its “default color”,
and returns the new NcChannels
.
Is the foreground of using an indexed NcPalette color?
C style function: channels_fg_palindex_p().
Is the background of using an indexed NcPalette color?
C style function: channels_bg_palindex_p().
Sets the foreground of an NcChannels
as using an
indexed NcPalette color.
C style function: channels_set_fg_palindex().
Sets the background of an NcChannels
as using an
indexed NcPalette color.
C style function: channels_set_bg_palindex().