cellium_buffer (cellium v0.1.0)

View Source

Shared logic for managing a virtual terminal buffer (shadow buffer). Operates on a Map where keys are {X, Y} and values are {Char, Fg, Bg}. Supports nested clipping to restrict drawing to specific rectangular areas.

Summary

Functions

Clears the clipping area on the buffer.

Returns a new empty buffer.

Gets a cell from the buffer. Returns space if empty.

Gets an entire row from 0 to Width-1.

Gets a segment of a row starting at StartX with specific length.

Puts a string into the buffer starting at X, Y, respecting clip if set.

Sets a single cell in the buffer, respecting clip if set.

Sets a rectangular clipping area on the buffer. If a clip already exists, it intersects the new area with the existing one.

Functions

clear_clip(Buffer)

Clears the clipping area on the buffer.

empty()

Returns a new empty buffer.

get_cell(X, Y, Buffer)

Gets a cell from the buffer. Returns space if empty.

get_row(Y, Width, Buffer)

Gets an entire row from 0 to Width-1.

get_row(StartX, Y, Length, Buffer)

Gets a segment of a row starting at StartX with specific length.

put_string(X, Y, Fg, Bg, Str, Buffer)

Puts a string into the buffer starting at X, Y, respecting clip if set.

set_cell(X, Y, Char, Fg, Bg, Buffer)

Sets a single cell in the buffer, respecting clip if set.

set_clip(X, Y, W, H, Buffer)

Sets a rectangular clipping area on the buffer. If a clip already exists, it intersects the new area with the existing one.