canvas

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package canvas defines the canvas that the widgets draw on.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

Canvas is where a widget draws its output for display on the terminal.

func New

func New(ar image.Rectangle) (*Canvas, error)

New returns a new Canvas with a buffer for the provided area.

func (*Canvas) Apply

func (c *Canvas) Apply(t terminalapi.Terminal) error

Apply applies the canvas to the corresponding area of the terminal. Guarantees to stay within limits of the area the canvas was created with.

func (*Canvas) Area

func (c *Canvas) Area() image.Rectangle

Area returns the area of the 2-D canvas.

func (*Canvas) Cell

func (c *Canvas) Cell(p image.Point) (*cell.Cell, error)

Cell returns a copy of the specified cell.

func (*Canvas) Clear

func (c *Canvas) Clear() error

Clear clears all the content on the canvas.

func (*Canvas) CopyTo

func (c *Canvas) CopyTo(dst *Canvas) error

CopyTo copies the content of this canvas onto the destination canvas. This canvas can have an offset when compared to the destination canvas, i.e. the area of this canvas doesn't have to be zero-based.

func (*Canvas) SetAreaCellOpts

func (c *Canvas) SetAreaCellOpts(cellArea image.Rectangle, opts ...cell.Option) error

SetAreaCellOpts is like SetCellOpts, but sets the specified options on all the cells within the provided area.

func (*Canvas) SetAreaCells

func (c *Canvas) SetAreaCells(cellArea image.Rectangle, r rune, opts ...cell.Option) error

SetAreaCells is like SetCell, but sets the specified rune and options on all the cells within the provided area. This method is idempotent.

func (*Canvas) SetCell

func (c *Canvas) SetCell(p image.Point, r rune, opts ...cell.Option) (int, error)

SetCell sets the rune of the specified cell on the canvas. Returns the number of cells the rune occupies, wide runes can occupy multiple cells when printed on the terminal. See http://www.unicode.org/reports/tr11/. Use the options to specify which attributes to modify, if an attribute option isn't specified, the attribute retains its previous value.

func (*Canvas) SetCellOpts

func (c *Canvas) SetCellOpts(p image.Point, opts ...cell.Option) error

SetCellOpts sets options on the specified cell of the canvas without modifying the content of the cell. Sets the default cell options if no options are provided. This method is idempotent.

func (*Canvas) Size

func (c *Canvas) Size() image.Point

Size returns the size of the 2-D canvas.

Directories

Path Synopsis
Package braille provides a canvas that uses braille characters.
Package braille provides a canvas that uses braille characters.
testbraille
Package testbraille provides helpers for tests that use the braille package.
Package testbraille provides helpers for tests that use the braille package.
Package testcanvas provides helpers for tests that use the canvas package.
Package testcanvas provides helpers for tests that use the canvas package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL