OpenTuiBindings class

Main OpenTUI bindings class that wraps the generated FFI bindings with our existing API and error handling.

Constructors

OpenTuiBindings()
Creates a OpenTuiBindings.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addToHitGrid(Pointer<RendererHandle> renderer, int x, int y, int width, int height, int id) → void
Registers a rectangular region in OpenTUI's low-level hit grid.
bufferClear(Pointer<OptimizedBufferHandle> buffer, Color bg) → void
Clears every cell of buffer to the bg color. Throws FFIException on failure.
bufferDrawBox(Pointer<OptimizedBufferHandle> buffer, int x, int y, int width, int height, BoxOptions options, Color borderColor, Color backgroundColor) → void
Draws a width×height box at (x,y) into buffer using the border glyphs, packed flags, and optional title from options, with borderColor and backgroundColor. Defaults to single-line border chars when options does not supply all 11. Throws FFIException on failure.
bufferDrawText(Pointer<OptimizedBufferHandle> buffer, String text, int x, int y, Color fg, Color? bg, int attributes) → void
Draws UTF-8 text at (x,y) into buffer with fg/bg colors and packed attributes. A null bg is passed as a null pointer (transparent). Throws FFIException on failure.
bufferDrawTextBuffer(Pointer<OptimizedBufferHandle> buffer, Pointer<TextBufferHandle> textBuffer, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight, bool hasClipRect) → void
Renders textBuffer into buffer at (x,y). When hasClipRect is true, only the (clipX,clipY,clipWidth,clipHeight) region is drawn. Throws FFIException on failure.
bufferFillRect(Pointer<OptimizedBufferHandle> buffer, int x, int y, int width, int height, Color bg) → void
Fills the width×height rectangle at (x,y) in buffer with the bg color. Throws FFIException on failure.
bufferGetAttributesPtr(Pointer<OptimizedBufferHandle> buffer) Pointer<Uint8>
Returns a pointer to buffer's per-cell packed attributes array. Throws FFIException on a null result.
bufferGetBgPtr(Pointer<OptimizedBufferHandle> buffer) Pointer<Float>
Returns a pointer to buffer's background-color (RGBA float) array. Throws FFIException on a null result.
bufferGetCharPtr(Pointer<OptimizedBufferHandle> buffer) Pointer<Uint32>
Returns a pointer to buffer's character-code cell array. Throws FFIException on a null result.
bufferGetFgPtr(Pointer<OptimizedBufferHandle> buffer) Pointer<Float>
Returns a pointer to buffer's foreground-color (RGBA float) array. Throws FFIException on a null result.
bufferResize(Pointer<OptimizedBufferHandle> buffer, int width, int height) → void
Resizes buffer to width×height cells. Throws FFIException on failure.
bufferSetCellWithAlphaBlending(Pointer<OptimizedBufferHandle> buffer, int x, int y, int charCode, Color fg, Color bg, int attributes) → void
Sets the cell at (x,y) in buffer to charCode with fg/bg colors and packed attributes, alpha-blending against existing content. Throws FFIException on failure.
checkHit(Pointer<RendererHandle> renderer, int x, int y) int
Queries OpenTUI's low-level hit grid at the specified coordinates.
clearTerminal(Pointer<RendererHandle> renderer) → void
Clears the terminal driven by renderer. Throws FFIException on failure.
createRenderer(int width, int height, {bool testing = false}) Pointer<RendererHandle>
Creates a native renderer of width×height and returns its handle. Throws FFIException on invalid dimensions or a null result.
createTextBuffer(int length, int widthMethod) Pointer<TextBufferHandle>
Creates a text buffer with capacity length using width method widthMethod, and returns its handle. Throws FFIException on failure.
destroyRenderer(Pointer<RendererHandle> renderer, {bool useAlternateScreen = false, int splitHeight = 0}) → void
Destroys renderer, optionally restoring the main screen and reserving splitHeight rows. Throws FFIException on failure.
destroyTextBuffer(Pointer<TextBufferHandle> textBuffer) → void
Destroys textBuffer and frees its native memory. Throws FFIException on failure.
disableKittyKeyboard(Pointer<RendererHandle> renderer) → void
Disables the Kitty keyboard protocol for renderer. Throws FFIException on failure.
disableMouse(Pointer<RendererHandle> renderer) → void
Disables mouse reporting for renderer. Throws FFIException on failure.
drawFrameBuffer(Pointer<OptimizedBufferHandle> target, int destX, int destY, Pointer<OptimizedBufferHandle> frameBuffer, int sourceX, int sourceY, int sourceWidth, int sourceHeight) → void
Composites the (sourceX,sourceY,sourceWidth,sourceHeight) region of frameBuffer onto target at (destX,destY). Throws FFIException on failure.
dumpBuffers(Pointer<RendererHandle> renderer, int timestamp) → void
Dumps renderer's buffers for debugging, tagged with timestamp. Throws FFIException on failure.
dumpHitGrid(Pointer<RendererHandle> renderer) → void
Dumps renderer's hit grid for debugging. Throws FFIException on failure.
dumpStdoutBuffer(Pointer<RendererHandle> renderer, int timestamp) → void
Dumps renderer's pending stdout buffer for debugging, tagged with timestamp. Throws FFIException on failure.
enableKittyKeyboard(Pointer<RendererHandle> renderer, int flags) → void
Enables the Kitty keyboard protocol for renderer with the given progressive-enhancement flags. Throws FFIException on failure.
enableMouse(Pointer<RendererHandle> renderer, bool enableMovement) → void
Enables mouse reporting for renderer, including motion events when enableMovement is true. Throws FFIException on failure.
getBufferHeight(Pointer<OptimizedBufferHandle> buffer) int
Returns the height of buffer in cells. Throws FFIException on failure.
getBufferWidth(Pointer<OptimizedBufferHandle> buffer) int
Returns the width of buffer in cells. Throws FFIException on failure.
getCurrentBuffer(Pointer<RendererHandle> renderer) Pointer<OptimizedBufferHandle>
Returns renderer's current (front) buffer handle. Throws FFIException on a null result.
getNextBuffer(Pointer<RendererHandle> renderer) Pointer<OptimizedBufferHandle>
Returns renderer's next (back) buffer handle for drawing. Throws FFIException on a null result.
getTerminalCapabilities(Pointer<RendererHandle> renderer, Pointer<CapabilitiesHandle> caps) → void
Fills caps with the terminal capabilities detected for renderer. Throws FFIException on failure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
processCapabilityResponse(Pointer<RendererHandle> renderer, String response) → void
Parses a terminal capability query response into renderer's detected capabilities. Throws FFIException on failure.
render(Pointer<RendererHandle> renderer, bool force) → void
Renders renderer's current frame to the terminal, redrawing everything when force is true. Throws FFIException on failure.
resizeRenderer(Pointer<RendererHandle> renderer, int width, int height) → void
Resizes renderer and its buffers to width×height. Throws FFIException on failure.
setBackgroundColor(Pointer<RendererHandle> renderer, Color color) → void
Sets renderer's clear/background color. Throws FFIException on failure.
setCursorColor(Pointer<RendererHandle> renderer, Color color) → void
Sets renderer's cursor color. Throws FFIException on failure.
setCursorPosition(Pointer<RendererHandle> renderer, int x, int y, bool visible) → void
Moves renderer's terminal cursor to (x,y) and sets its visible state. Throws FFIException on failure.
setCursorStyle(Pointer<RendererHandle> renderer, String style, bool blinking) → void
Sets renderer's cursor shape to style with optional blinking. Throws FFIException on failure.
setDebugOverlay(Pointer<RendererHandle> renderer, bool enabled, int corner) → void
Toggles renderer's debug overlay via enabled and positions it at the given corner. Throws FFIException on failure.
setupTerminal(Pointer<RendererHandle> renderer, bool useAlternateScreen) → void
Prepares the terminal for renderer, switching to the alternate screen when useAlternateScreen is true. Throws FFIException on failure.
textBufferFinalizeLineInfo(Pointer<TextBufferHandle> textBuffer) → void
Finalizes textBuffer's line-start/width metadata after writes. Throws FFIException on failure.
textBufferGetAttributesPtr(Pointer<TextBufferHandle> textBuffer) Pointer<Uint16>
Returns a pointer to textBuffer's per-cell packed attributes array. Throws FFIException on failure.
textBufferGetBgPtr(Pointer<TextBufferHandle> textBuffer) Pointer<Float>
Returns a pointer to textBuffer's background-color (RGBA float) array. Throws FFIException on failure.
textBufferGetCharPtr(Pointer<TextBufferHandle> textBuffer) Pointer<Uint32>
Returns a pointer to textBuffer's character-code cell array. Throws FFIException on failure.
textBufferGetFgPtr(Pointer<TextBufferHandle> textBuffer) Pointer<Float>
Returns a pointer to textBuffer's foreground-color (RGBA float) array. Throws FFIException on failure.
textBufferGetLength(Pointer<TextBufferHandle> textBuffer) int
Returns the number of cells stored in textBuffer. Throws FFIException on failure.
textBufferGetLineCount(Pointer<TextBufferHandle> textBuffer) int
Returns the number of lines in textBuffer. Throws FFIException on failure.
textBufferGetLineStartsPtr(Pointer<TextBufferHandle> textBuffer) Pointer<Uint32>
Returns a pointer to textBuffer's per-line start offsets. Throws FFIException on failure.
textBufferGetLineWidthsPtr(Pointer<TextBufferHandle> textBuffer) Pointer<Uint32>
Returns a pointer to textBuffer's per-line cell widths. Throws FFIException on failure.
textBufferReset(Pointer<TextBufferHandle> textBuffer) → void
Clears all content from textBuffer, resetting it to empty. Throws FFIException on failure.
textBufferResetSelection(Pointer<TextBufferHandle> textBuffer) → void
Clears any active selection highlight in textBuffer. Throws FFIException on failure.
textBufferSetCell(Pointer<TextBufferHandle> textBuffer, int index, int charCode, Color fg, Color bg, int attributes) → void
Sets the cell at index in textBuffer to charCode with fg/bg colors and packed attributes. Throws FFIException on failure.
textBufferSetSelection(Pointer<TextBufferHandle> textBuffer, int start, int end, Color bgColor, Color fgColor) → void
Highlights cells start..end in textBuffer using bgColor/fgColor. Throws FFIException on failure.
textBufferWriteChunk(Pointer<TextBufferHandle> textBuffer, String text, Color fg, Color bg, int attributes) int
Appends UTF-8 text to textBuffer with fg/bg colors and packed attributes, returning the native write result. Throws FFIException on failure.
textBufferWriteUtf8Chunk(Pointer<TextBufferHandle> textBuffer, Pointer<Uint8> textBytes, int textLen, Color fg, Color bg, int attributes) int
Appends textLen caller-owned persistent UTF-8 textBytes to textBuffer with fg/bg colors and packed attributes, returning the native write result. Throws FFIException on failure.
toString() String
A string representation of this object.
inherited
updateMemoryStats(Pointer<RendererHandle> renderer, int heapUsed, int heapTotal, int arrayBuffers) → void
Updates renderer's debug-overlay memory stats with heapUsed, heapTotal, and arrayBuffers. Throws FFIException on failure.
updateStats(Pointer<RendererHandle> renderer, double time, int fps, double frameCallbackTime) → void
Updates renderer's debug-overlay frame stats with time, fps, and frameCallbackTime. Throws FFIException on failure.

Operators

operator ==(Object other) bool
The equality operator.
inherited