OptimizedBuffer
TheOptimizedBuffer class (also known as FrameBuffer) provides low-level access to terminal rendering. It manages a grid of cells, each containing a character, foreground color, background color, and text attributes.
Creating Buffers
function
Properties
number
Buffer width in cells
number
Buffer height in cells
WidthMethod
Character width calculation method used by this buffer
boolean
Whether alpha blending is enabled
Pointer
Native pointer to the underlying buffer (for advanced use)
object
Direct access to raw buffer data
Drawing Methods
function
Clear the entire buffer with a background color
RGBA
Background color. Default:
RGBA.fromValues(0, 0, 0, 1)function
function
Set a single cell with alpha blendingSame parameters as
setCell, but blends colors using alpha channel.function
function
Fill a rectangular area with a background color
function
function
Draw a grid with custom column/row offsets
Compositing
function
function
Draw a TextBufferView
function
Draw an EditorView
Image Rendering
function
Draw pixel data with supersampling
function
Draw grayscale intensity data
function
Draw grayscale data with supersampling for smoother rendering
Clipping and Opacity
function
Push a clipping rectangle onto the stack
function
Pop the top clipping rectangle from the stack
function
Remove all clipping rectangles
function
Push an opacity value onto the stack (multiplies with existing opacity)
number
required
Opacity value between 0.0 and 1.0
function
Pop the top opacity value from the stack
function
Get the current effective opacity
function
Clear the opacity stack
Utilities
function
Resize the buffer (clears content)
function
Enable or disable alpha blending
function
Get the buffer’s native identifier
function
Get the resolved character data as UTF-8 bytes
boolean
Whether to add newlines between rows. Default:
falsefunction
Extract buffer content as styled text spansReturns an array of lines, each containing spans with text, colors, and attributes.
function
Destroy the buffer and free native resources