Skip to main content

quantize_sextant

Function quantize_sextant 

Source
pub fn quantize_sextant(pixels: [impl Into<Pixel>; 6]) -> Glyph
Expand description

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.

The highest-fidelity option (doubles vertical resolution again over quantize_quadrant), and the newest/least universally supported: sextant glyphs come from a 2022 Unicode addition and need a font with “Symbols for Legacy Computing” coverage to render as blocks rather than tofu/replacement characters.

Font coverage works the same way as quantize_quadrant’s: CP437 has no mapping for sextant glyphs either, so see that function’s docs for the FontChain setup needed to render them.

See the 16_subcell_image example for quantize_sextant in action: https://main.retroglyph.dev/examples/16_subcell_image/terminal/.

§Examples

use retroglyph_core::symbols::quantize_sextant;

let black = (0, 0, 0);
let white = (255, 255, 255);
let glyph = quantize_sextant([white, black, black, black, black, black]);
assert_eq!(glyph.ch, '🬀'); // top-left sextant only

See quantize_half_block for why this never panics.