ttyrec2gif

package module
v0.0.0-...-6c32732 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 16 Imported by: 1

README

ttyrec2gif

This repo only takes @sugyan's ttyrec2gif code and exposes it as a package.

Thanks To

@sugyan

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

Types

type GifGenerator

type GifGenerator struct {
	Speed      float64
	Col        int
	Row        int
	NoLoop     bool
	ScreenInfo *ScreenInfo
}

GifGenerator type

func NewGifGenerator

func NewGifGenerator() *GifGenerator

NewGifGenerator returns GifGenerator instance

func (*GifGenerator) Capture

func (g *GifGenerator) Capture(state *terminal.State) (paletted *image.Paletted, err error)

Capture draws virtual terminal and return paletted image

func (*GifGenerator) Generate

func (g *GifGenerator) Generate(input string, output string) (err error)

Generate writes to outFile an animated GIF

func (*GifGenerator) TtyPlay

func (g *GifGenerator) TtyPlay(input string, term Terminal, capture func(int32) error) (err error)

TtyPlay reads ttyrecord file and play

type ScreenInfo

type ScreenInfo struct {
	Width         int
	Height        int
	Chars         []rune
	Fcolors       []terminal.Color
	Bcolors       []terminal.Color
	CursorX       int
	CursorY       int
	CursorVisible bool
	// contains filtered or unexported fields
}

ScreenInfo type

func NewScreenInfo

func NewScreenInfo() *ScreenInfo

NewScreenInfo returns ScreenInfo instance

func (*ScreenInfo) GetRedrawRange

func (s *ScreenInfo) GetRedrawRange(width int, height int, state *terminal.State) (left int, top int, right int, bottom int)

GetRedrawRange returns redraw range.

type Terminal

type Terminal interface {
	Write([]byte) (int, error)
}

Terminal interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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