Documentation ¶
Overview ¶
ansipixel provides terminal drawing and key reading abilities. fps/fps.go is an example of how to use it.
Index ¶
- Constants
- type AnsiPixels
- func (ap *AnsiPixels) ClearEndOfLine()
- func (ap *AnsiPixels) ClearScreen()
- func (ap *AnsiPixels) DecodeImage(inp io.Reader) (*Image, error)
- func (ap *AnsiPixels) Draw216ColorImage(sx, sy int, img *image.RGBA) error
- func (ap *AnsiPixels) DrawBox(x, y, w, h int, topLeft, topRight, bottomLeft, bottomRight string) error
- func (ap *AnsiPixels) DrawMonoImage(sx, sy int, img *image.Gray, color string) error
- func (ap *AnsiPixels) DrawRoundBox(x, y, w, h int) error
- func (ap *AnsiPixels) DrawSquareBox(x, y, w, h int) error
- func (ap *AnsiPixels) DrawTrueColorImage(sx, sy int, img *image.RGBA) error
- func (ap *AnsiPixels) GetSize() (err error)
- func (ap *AnsiPixels) HideCursor()
- func (ap *AnsiPixels) IsResizeSignal(s os.Signal) bool
- func (ap *AnsiPixels) MoveCursor(x, y int)
- func (ap *AnsiPixels) MoveHorizontally(x int)
- func (ap *AnsiPixels) Open() (err error)
- func (ap *AnsiPixels) ReadCursorPos() (int, int, error)
- func (ap *AnsiPixels) ReadImage(path string) (*Image, error)
- func (ap *AnsiPixels) Restore()
- func (ap *AnsiPixels) ShowCursor()
- func (ap *AnsiPixels) ShowImage(imagesRGBA *Image, colorString string) error
- func (ap *AnsiPixels) SignalChannel()
- func (ap *AnsiPixels) WriteAt(x, y int, msg string, args ...interface{})
- func (ap *AnsiPixels) WriteAtStr(x, y int, msg string)
- func (ap *AnsiPixels) WriteBoxed(y int, msg string, args ...interface{})
- func (ap *AnsiPixels) WriteCentered(y int, msg string, args ...interface{})
- func (ap *AnsiPixels) WriteRight(y int, msg string, args ...interface{})
- type Image
Constants ¶
View Source
const ( RoundTopLeft = "╭" RoundTopRight = "╮" RoundBottomLeft = "╰" RoundBottomRight = "╯" SquareTopLeft = "┌" SquareTopRight = "┐" SquareBottomLeft = "└" SquareBottomRight = "┘" Horizontal = "─" Vertical = "│" TopT = "┬" BottomT = "┴" LeftT = "├" RightT = "┤" MiddleCross = "┼" )
View Source
const ( FullPixel = '█' TopHalfPixel = '▀' BottomHalfPixel = '▄' )
View Source
const BUFSIZE = 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnsiPixels ¶
type AnsiPixels struct { FdIn int Out *bufio.Writer In io.Reader Data []byte W, H int // Width and Height C chan os.Signal // Should image be monochrome, 256 or true color TrueColor bool Color bool // 256 (216) color mode Gray bool // grayscale mode Margin int // Margin around the image (image is smaller by 2*margin) // contains filtered or unexported fields }
func NewAnsiPixels ¶
func NewAnsiPixels() *AnsiPixels
func (*AnsiPixels) ClearEndOfLine ¶
func (ap *AnsiPixels) ClearEndOfLine()
func (*AnsiPixels) ClearScreen ¶
func (ap *AnsiPixels) ClearScreen()
func (*AnsiPixels) DecodeImage ¶ added in v0.11.0
func (ap *AnsiPixels) DecodeImage(inp io.Reader) (*Image, error)
func (*AnsiPixels) Draw216ColorImage ¶ added in v0.12.0
func (ap *AnsiPixels) Draw216ColorImage(sx, sy int, img *image.RGBA) error
func (*AnsiPixels) DrawBox ¶
func (ap *AnsiPixels) DrawBox(x, y, w, h int, topLeft, topRight, bottomLeft, bottomRight string) error
func (*AnsiPixels) DrawMonoImage ¶ added in v0.12.0
func (*AnsiPixels) DrawRoundBox ¶
func (ap *AnsiPixels) DrawRoundBox(x, y, w, h int) error
func (*AnsiPixels) DrawSquareBox ¶
func (ap *AnsiPixels) DrawSquareBox(x, y, w, h int) error
func (*AnsiPixels) DrawTrueColorImage ¶ added in v0.12.0
func (ap *AnsiPixels) DrawTrueColorImage(sx, sy int, img *image.RGBA) error
func (*AnsiPixels) GetSize ¶
func (ap *AnsiPixels) GetSize() (err error)
func (*AnsiPixels) HideCursor ¶
func (ap *AnsiPixels) HideCursor()
func (*AnsiPixels) IsResizeSignal ¶
func (ap *AnsiPixels) IsResizeSignal(s os.Signal) bool
func (*AnsiPixels) MoveCursor ¶
func (ap *AnsiPixels) MoveCursor(x, y int)
func (*AnsiPixels) MoveHorizontally ¶
func (ap *AnsiPixels) MoveHorizontally(x int)
func (*AnsiPixels) Open ¶
func (ap *AnsiPixels) Open() (err error)
func (*AnsiPixels) ReadCursorPos ¶
func (ap *AnsiPixels) ReadCursorPos() (int, int, error)
This also synchronizes the display.
func (*AnsiPixels) ReadImage ¶ added in v0.11.0
func (ap *AnsiPixels) ReadImage(path string) (*Image, error)
func (*AnsiPixels) Restore ¶
func (ap *AnsiPixels) Restore()
func (*AnsiPixels) ShowCursor ¶
func (ap *AnsiPixels) ShowCursor()
func (*AnsiPixels) ShowImage ¶ added in v0.11.0
func (ap *AnsiPixels) ShowImage(imagesRGBA *Image, colorString string) error
Color string is the fallback mono color to use when AnsiPixels.TrueColor is false.
func (*AnsiPixels) SignalChannel ¶
func (ap *AnsiPixels) SignalChannel()
func (*AnsiPixels) WriteAt ¶
func (ap *AnsiPixels) WriteAt(x, y int, msg string, args ...interface{})
func (*AnsiPixels) WriteAtStr ¶
func (ap *AnsiPixels) WriteAtStr(x, y int, msg string)
func (*AnsiPixels) WriteBoxed ¶
func (ap *AnsiPixels) WriteBoxed(y int, msg string, args ...interface{})
func (*AnsiPixels) WriteCentered ¶
func (ap *AnsiPixels) WriteCentered(y int, msg string, args ...interface{})
func (*AnsiPixels) WriteRight ¶ added in v0.14.2
func (ap *AnsiPixels) WriteRight(y int, msg string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.