pub struct BrailleCanvas { /* private fields */ }Expand description
A monochrome canvas with 2x4 sub-cells per cell, using Unicode Braille Patterns.
The densest character-grid raster there is: 8 dots per cell, which on a 100x40 grid is a 200x160 bitmap. The catch is in the name of the trade: all 8 dots share one foreground color, so this draws shapes, not pictures. Ideal for contour lines, a pixel-accurate outline, or a high-resolution minimap silhouette.
Dot addressing goes through retroglyph_core::symbols::braille::DOTS and
retroglyph_core::symbols::braille::glyph rather than a locally re-derived bit table: dot
bit positions follow Braille’s historical numbering (down the left column, then the right,
then the two 8-dot extensions appended underneath), not raster order, and that table already
exists in retroglyph-core.
Implementations§
Source§impl BrailleCanvas
impl BrailleCanvas
Sourcepub fn new(cols: u16, rows: u16) -> Self
pub fn new(cols: u16, rows: u16) -> Self
A canvas covering cols x rows cells, i.e. cols * 2 x rows * 4 plottable points.
Sourcepub fn plot(&mut self, x: i32, y: i32)
pub fn plot(&mut self, x: i32, y: i32)
Sets the dot at (x, y). Out-of-bounds coordinates are ignored; see
HalfBlockCanvas::plot.
Sourcepub fn line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32)
pub fn line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32)
Draws a line between two dot coordinates (Bresenham).
The one drawing primitive worth having built in: contours, outlines, and route overlays are all lines, and hand-rolling Bresenham per caller is exactly the sort of duplication a shared crate exists to prevent.
Trait Implementations§
Source§impl Clone for BrailleCanvas
impl Clone for BrailleCanvas
Source§fn clone(&self) -> BrailleCanvas
fn clone(&self) -> BrailleCanvas
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more