pub fn quantize_quadrant(pixels: [impl Into<Pixel>; 4]) -> GlyphExpand description
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.
Doubles both horizontal and vertical resolution over quantize_half_block.
On the bundled pixel backends (retroglyph-software, retroglyph-gl), rendering these
glyphs correctly requires a font that actually declares coverage for the quadrant block
characters: CP437 has no mapping for them. A font built with retroglyph_window‘s
BitmapFont::new (CP437-only) renders every quadrant glyph as a solid block. Supply quadrant
coverage by passing either a primary font or a BitmapFont::with_charset fallback in a
FontChain to those backends’ font() builder method; the glyph then takes the cell’s
foreground color, which a tileset sprite (the other way to draw a non-CP437 shape) does not.
See the 16_subcell_image example for quantize_quadrant in action:
https://main.retroglyph.dev/examples/16_subcell_image/terminal/.
§Examples
use retroglyph_core::symbols::quantize_quadrant;
let black = (0, 0, 0);
let white = (255, 255, 255);
let glyph = quantize_quadrant([black, white, black, black]);
assert_eq!(glyph.ch, '▝'); // top-right quadrantSee quantize_half_block for why this never panics.