Documentation ¶
Overview ¶
Backend agnostic drawing interface and utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferSurface ¶
type BufferSurface struct {
// contains filtered or unexported fields
}
BufferSurface is a dumpable in memory implementation of the Surface interface.
func NewBufferSurface ¶
func NewBufferSurface(size geometry.Size) BufferSurface
NewBufferSurface returns a new BufferSurface with the given bounds.
func (BufferSurface) Dump ¶
func (bs BufferSurface) Dump(w io.Writer) error
Dump the layer to the given io writer
func (BufferSurface) Get ¶
func (bs BufferSurface) Get(v2 geometry.Vec2D) Cell
Get implements the Surface interface.
func (BufferSurface) Set ¶
func (bs BufferSurface) Set(v2 geometry.Vec2D, cell Cell)
Set implements the Surface interface.
func (BufferSurface) Size ¶
func (bs BufferSurface) Size() geometry.Size
Bounds implements the Surface interface.
type CellStyle ¶
type CellStyle struct { Foreground colors.Color Background colors.Color Bold, Blink, Reverse, Underline, Dim, Italic, StrikeThrough bool }
CellStyle define the style of a single terminal Cell.
type Drawer ¶
type Drawer interface {
Draw(Surface)
}
Drawer define an object that can draw on a Surface.
type DrawerFunc ¶
type DrawerFunc func(Surface)
DrawerFunc define a function that implements the Drawer interface.
func (DrawerFunc) Draw ¶
func (fn DrawerFunc) Draw(c Surface)
Draw implements the Drawable interface.
type SubSurface ¶
type SubSurface struct {
// contains filtered or unexported fields
}
SubSurface define a bounded wrapper around a Surface type. Every cells sets/gets from this SubSurface is relative to the origin of the SubSurface bounds.
func NewSubSurface ¶
func NewSubSurface(s Surface, bounds geometry.Rectangle) SubSurface
NewSubSurface returns a new SubSurface object that wraps the given Surface and use the given geometry.Rectangle as bounds.
func (SubSurface) Get ¶
func (ss SubSurface) Get(v2 geometry.Vec2D) Cell
Get implements the Surface interface.
func (SubSurface) Set ¶
func (ss SubSurface) Set(v2 geometry.Vec2D, cell Cell)
Set implements the Surface interface.
func (SubSurface) Size ¶
func (ss SubSurface) Size() geometry.Size
Size implements the geometry.Sized interface.
type Surface ¶
type Surface interface { geometry.Sized // Get returns the cell at the given position. // If the position is out of bound, a Cell with default value // is returned. Get(geometry.Vec2D) Cell // Set sets the cell at the given position. // If the position is out of bounds, the cell is dropped. Set(geometry.Vec2D, Cell) }
Surface define a bounded drawing surface.