Viewport class

A Viewport wraps a parent buffer, translating and clipping drawing operations to a relative local coordinate space within bounds.

Implemented types

Constructors

Viewport(Buffer parent, Rect bounds)
Creates a viewport wrapping parent constrained to bounds.

Properties

bounds Rect
The rectangular bounds within the parent buffer.
final
cells List<Cell>
The flat list of cells representing the 2D grid.
getter/setter pairoverride
hashCode int
The hash code for this object.
no setterinherited
height int
The height of the buffer in rows.
getter/setter pairoverride
parent Buffer
The underlying parent buffer.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
The width of the buffer in columns.
getter/setter pairoverride

Methods

clear() → void
Resets all cells in the buffer to transparent empty cells.
override
fill(Cell cell) → void
Fills the entire buffer with a copy of cell.
override
getCell(int x, int y) Cell?
Gets the cell at (x, y). Returns null if coordinates are out of bounds.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resize(int newWidth, int newHeight) → void
Resizes the buffer to the new dimensions, preserving existing content where it fits.
override
setCell(int x, int y, Cell cell) → void
Sets the cell at (x, y) to cell. Does nothing if coordinates are out of bounds.
override
toString() String
A string representation of this object.
inherited
writeString(int x, int y, String text, Style style) → void
Writes styled text to the buffer starting at (x, y).
override

Operators

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