canvas

package
v0.0.0-...-c08e9e3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Align

type Align int

Align is the direction of text alignment

const (
	// AlignLeft is left text alignment
	AlignLeft Align = iota
	// AlignCenter is center text alignment
	AlignCenter
	// AlignRight is right text alignment
	AlignRight
)

type Box

type Box struct {
	X       int
	Y       int
	W       int
	H       int
	Bg      tcell.Color
	Fg      tcell.Color
	Rev     bool
	Content *Content
	// contains filtered or unexported fields
}

Box is a drawable rectangular area

func (*Box) AlignCenter

func (b *Box) AlignCenter() *Box

AlignCenter sets the content alignment to center for box

func (*Box) AlignLeft

func (b *Box) AlignLeft() *Box

AlignLeft sets the content alignment to left for box

func (*Box) AlignRight

func (b *Box) AlignRight() *Box

AlignRight sets the content alignment to right for box

func (*Box) Background

func (b *Box) Background(bg tcell.Color) *Box

Background sets the background for box

func (*Box) Draw

func (b *Box) Draw()

Draw draws the box on canvas screen

func (*Box) Foreground

func (b *Box) Foreground(fg tcell.Color) *Box

Foreground sets the foreground for box

func (*Box) Pad

func (b *Box) Pad(pad int) *Box

Pad sets the content left and right padding for box

func (*Box) PadLeft

func (b *Box) PadLeft(pad int) *Box

PadLeft sets the content left padding for box

func (*Box) PadRight

func (b *Box) PadRight(pad int) *Box

PadRight sets the content right padding for box

func (*Box) Reverse

func (b *Box) Reverse(on bool) *Box

Reverse reverses the background and foreground for point

func (*Box) Text

func (b *Box) Text(text string) *Box

Text sets the text for box

type Canvas

type Canvas struct {
	Screen tcell.Screen
}

Canvas is a wrapper for drawing on tcell.Screen

func (*Canvas) NewBox

func (c *Canvas) NewBox(x, y, w, h int) *Box

NewBox creates a box that can be drawn

func (*Canvas) NewPoint

func (c *Canvas) NewPoint(x, y int) *Point

NewPoint creates a point that can be drawn

type Content

type Content struct {
	Text  string
	Align Align
	Pad   *Pad
}

Content is the content of a box

type Pad

type Pad struct {
	Left  int
	Right int
}

Pad is the padding for text in box

type Point

type Point struct {
	X    int
	Y    int
	Bg   tcell.Color
	Fg   tcell.Color
	Rev  bool
	Rune rune
	// contains filtered or unexported fields
}

Point is the smallest drawable point

func (*Point) Background

func (p *Point) Background(bg tcell.Color) *Point

Background sets the background for point

func (*Point) Char

func (p *Point) Char(char rune) *Point

Char sets the rune for point

func (*Point) Draw

func (p *Point) Draw()

Draw draws the point on canvas screen

func (*Point) Foreground

func (p *Point) Foreground(fg tcell.Color) *Point

Foreground sets the foreground for point

func (*Point) Reverse

func (p *Point) Reverse(on bool) *Point

Reverse reverses the background and foreground for point

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳