ascii

package
v0.0.0-...-162a0df Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCharAttr = CharAttr{}
View Source
var DefaultColorPair = ColorPair{nil, nil}
View Source
var ErrBadCellCoord = errors.New("out of range")
View Source
var ErrBadMircCode = errors.New("bad mirc code")

Functions

func MircColor

func MircColor(n int) (color.Color, error)

func PaletteBg

func PaletteBg(a *ASCII)

func PaletteFg

func PaletteFg(a *ASCII)

func Rasterize

func Rasterize(a *ASCII) (*image.RGBA, error)

Types

type ASCII

type ASCII struct {
	// Cells is indexed via [y][x].
	Cells [][]Cell
}

func NewASCII

func NewASCII(dat string) (*ASCII, error)

func RoundBox

func RoundBox(wh image.Point) *ASCII

func (*ASCII) AnsiBytes

func (a *ASCII) AnsiBytes() []byte

func (*ASCII) Box

func (a *ASCII) Box(r image.Rectangle, c Cell)

func (*ASCII) Bytes

func (a *ASCII) Bytes() []byte

func (*ASCII) ClearText

func (a *ASCII) ClearText()

func (*ASCII) Clip

func (a *ASCII) Clip(r image.Rectangle)

func (*ASCII) Colors

func (a *ASCII) Colors() (ret []ColorExtent)

func (*ASCII) Columns

func (a *ASCII) Columns() (w int)

func (*ASCII) Copy

func (a *ASCII) Copy() *ASCII

func (*ASCII) Flip

func (a *ASCII) Flip()

func (*ASCII) Get

func (a *ASCII) Get(x, y int) *Cell

func (*ASCII) MergePut

func (a *ASCII) MergePut(c Cell, x, y int)

func (*ASCII) Mirror

func (a *ASCII) Mirror()

func (*ASCII) Paste

func (a *ASCII) Paste(aa *ASCII, pt image.Point)

func (*ASCII) Put

func (a *ASCII) Put(c Cell, x, y int) *Cell

func (*ASCII) PutString

func (a *ASCII) PutString(s string, x, y int)

func (*ASCII) PutTrimASCII

func (a *ASCII) PutTrimASCII(aa *ASCII, pt image.Point)

PutTrimASCII puts with transparent spaces up to the first non-space on a row, then uses all overwriting spaces.

func (*ASCII) Rectangle

func (a *ASCII) Rectangle() image.Rectangle

func (*ASCII) Rotate

func (a *ASCII) Rotate(degrees int)

func (*ASCII) Rows

func (a *ASCII) Rows() int

func (*ASCII) Scale

func (a *ASCII) Scale(x, y int)

func (*ASCII) Text

func (a *ASCII) Text() string

type Cell

type Cell struct {
	ColorPair
	Value rune
	CharAttr
}

type CharAttr

type CharAttr struct {
	Italic    bool
	Bold      bool
	Underline bool
}

type ColorExtent

type ColorExtent struct {
	Start  int
	Length int
	ColorPair
	CharAttr
}

type ColorPair

type ColorPair struct {
	Foreground color.Color
	Background color.Color
}

func (ColorPair) AnsiCode

func (c ColorPair) AnsiCode(p *Palette) []byte

func (ColorPair) MircCode

func (c ColorPair) MircCode(p *Palette) []byte

type Palette

type Palette struct {
	color.Palette
	Hues []color.Palette
}

func NewPaletteMIRC

func NewPaletteMIRC() *Palette

type Transform

type Transform func(*ASCII)

Jump to

Keyboard shortcuts

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