Raxol.Core.Box (Raxol v2.6.0)

View Source

Box drawing utilities for Raxol.Core.Buffer.

Provides functions to draw boxes and fill areas on buffers.

Summary

Functions

draw_box(buffer, x, y, width, height, border_style \\ :single)

Draw a box border on the buffer.

Parameters

  • buffer: The buffer to draw on
  • x: Left edge x coordinate
  • y: Top edge y coordinate
  • width: Box width (including borders)
  • height: Box height (including borders)
  • border_style: One of :single, :double, :rounded, :heavy, :dashed

Example

buffer = Buffer.create_blank_buffer(40, 10)
buffer = Box.draw_box(buffer, 0, 0, 40, 10, :double)

draw_horizontal_line(buffer, x, y, length, char \\ "─", style \\ %{})

Draw a horizontal line.

draw_vertical_line(buffer, x, y, length, char \\ "│", style \\ %{})

Draw a vertical line.

fill_area(buffer, x, y, width, height, char, style \\ %{})

Fill a rectangular area with a character.

Parameters

  • buffer: The buffer to fill
  • x: Left edge x coordinate
  • y: Top edge y coordinate
  • width: Area width
  • height: Area height
  • char: Character to fill with
  • style: Style map for the fill character

Example

buffer = Box.fill_area(buffer, 1, 1, 10, 5, " ", %{bg_color: :blue})