wijjit.elements.display.chart_utils.BrailleCanvas
- class wijjit.elements.display.chart_utils.BrailleCanvas(width, height)[source]
A canvas for drawing using braille characters.
Each character cell represents a 2x4 grid of dots, providing higher resolution plotting within terminal constraints.
- Parameters:
- Variables:
Examples
Create a canvas and plot points:
>>> canvas = BrailleCanvas(20, 5) >>> canvas.set_pixel(0, 0) # Top-left dot >>> canvas.set_pixel(39, 19) # Bottom-right dot >>> lines = canvas.to_lines()
Methods
__init__(width, height)clear()Clear the canvas.
draw_line(x0, y0, x1, y1)Draw a line between two points using Bresenham's algorithm.
fill_below(x, y)Fill all pixels below the given point to the bottom.
get_pixel(x, y)Check if a pixel is set.
set_pixel(x, y)Set a pixel (dot) at the given coordinates.
to_lines()Convert the canvas to a list of braille character strings.
unset_pixel(x, y)Unset a pixel (dot) at the given coordinates.
- set_pixel(x, y)[source]
Set a pixel (dot) at the given coordinates.
- Parameters:
- Return type:
None
Notes
Coordinates outside the canvas bounds are silently ignored.