Documentation
¶
Overview ¶
Package gif renders asciinema cast files to animated GIFs.
Index ¶
Constants ¶
const ( // DefaultAggVersion is the agg release version downloaded when auto-fetching. // The fork (see aggReleaseRepo) ships sixel and Kitty graphics rendering; // pinned here until that support lands in an upstream asciinema/agg release. DefaultAggVersion = "v1.11.2-sixel" )
Variables ¶
var ErrDownload = fmt.Errorf("agg download failed")
ErrDownload indicates that automatic agg download failed.
var ErrValidation = errors.New("gif validation failed")
ErrValidation indicates that a rendered GIF failed validation.
Functions ¶
func CacheDir ¶
func CacheDir() string
CacheDir returns the default cache directory for auto-downloaded agg.
func CachedAggPath ¶
func CachedAggPath() string
CachedAggPath returns the expected path of the cached agg binary.
func DownloadAgg ¶
DownloadAgg downloads the agg binary for the current platform to the cache dir. Returns the path to the downloaded binary.
func MeasureColumnWidthPx ¶
MeasureColumnWidthPx renders two short probe casts that differ only in column count and returns the pixel width agg actually advances per column for the given font configuration. agg lays columns out at a fixed advance plus fixed horizontal padding, so (wideWidth - narrowWidth) / (wideCols - narrowCols) yields the per-column width independent of that padding — and independent of which font agg resolves on the host, which a static formula cannot know.
Types ¶
type Config ¶
type Config struct {
AggPath string
Theme string
Speed float64
Font string
FontSize int
LineHeight float64
LetterSpacing float64
// Select is passed to agg's --select to render only part of the timeline.
// Use it to trim a recording's lead-in (e.g. "0.2.." drops the first 0.2s),
// which is handy for sixel apps that paint a cell-based fallback frame
// before the terminal's sixel-capability handshake completes.
Select string
}
Config controls agg GIF rendering.
func NormalizeConfig ¶
NormalizeConfig fills unset fields with the defaults Render applies, so callers (e.g. the sixel cell-size reports) can mirror the font metrics agg will render with.