Expand description
Border, gridline, and partial-block char data shared by widgets and backends.
char data for drawing borders, gridlines, and partial-block glyphs, plus the pixel-to-glyph
matching logic that picks one of those glyphs for a raw pixel block.
Every set here is plain const data with no rendering logic of its own, so a widget crate, a
backend, or a caller drawing its own frame can all reach the same glyphs instead of retyping
Unicode box-drawing literals. crate::symbols::border and crate::symbols::line cover
whole-cell frame/gridline drawing; crate::symbols::block and crate::symbols::bar cover
the partial-block glyphs used for horizontal and vertical fill ramps (progress bars, gauges,
sparklines); crate::symbols::braille covers the 2x4-dot glyphs used for higher-resolution
point/line plotting than a single block cell allows. quantize_half_block,
quantize_quadrant, and quantize_sextant are the one exception: they posterize a block
of raw pixels down to the best-matching glyph from HALF_BLOCKS/
QUADRANTS/SEXTANTS, the actual
matching algorithm alongside the data it searches over.
Modules§
- bar
- Vertical, bottom-anchored eighth-block glyphs (
▁▂▃▄▅▆▇█), for a bar that fills a cell from the bottom edge: the ramp a sparkline, gauge, or meter widget uses for one column’s worth of magnitude. - block
- Horizontal, left-anchored eighth-block glyphs (
█▉▊▋▌▍▎▏). - border
- Whole-cell box-border glyph sets:
PLAIN,ROUNDED,DOUBLE, andTHICK. - braille
- Unicode Braille Patterns (
U+2800..=U+28FF), addressed as a 2-column by 4-row dot grid. - line
- Gridline glyph sets, for drawing dividers that cross or tee into each other rather than an
outer frame:
NORMAL,DOUBLE,THICK.
Structs§
- Border
Set - The six glyphs that make up a single-style box border.
- Glyph
- A posterized pixel block: the best-matching glyph plus its foreground and background colors.
- LineSet
- The seven glyphs needed to draw a gridline that can cross, tee, or run straight through a
cell, as used by table/grid dividers rather than an outer
BorderSetframe.
Constants§
- HALF_
BLOCKS - The Unicode Block Elements glyphs for a 1-wide x 2-tall pixel block, indexed by a 2-bit pattern (bit 0 = top pixel set, bit 1 = bottom pixel set).
- QUADRANTS
- The 16 quadrant block glyphs for a 2x2 pixel block, indexed by a 4-bit pattern in row-major order (bit 0 = top-left, bit 1 = top-right, bit 2 = bottom-left, bit 3 = bottom-right).
- SEXTANTS
- The 64 sextant glyphs for a 2x3 pixel block.
Functions§
- quantize_
half_ block - Posterizes a 1-wide x 2-tall pixel block (
[top, bottom]) to' '/▀/▄/█plus two representative colors. - quantize_
quadrant - Posterizes a 2x2 pixel block (
[top_left, top_right, bottom_left, bottom_right]) to one of the 16 quadrant block glyphs plus two representative colors. - quantize_
sextant - Posterizes a 2-wide x 3-tall pixel block (
[top_left, top_right, mid_left, mid_right, bottom_left, bottom_right]) to one of the 64 sextant glyphs plus two representative colors.
Type Aliases§
- Pixel
- A raw 24-bit RGB pixel sample:
(r, g, b), one byte per channel.