asciiif

package
v0.0.0-...-29530ea Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGIFAsync

func DecodeGIFAsync(gif *gif.GIF, options ...*convert.Options) (int, <-chan *ASCIIIFrame)

DecodeGIFAsync is an asynchronous version of DecodeGIF. It returns the ASCIIIF's LoopCount immediately and closes the returned channel, after all frames have been converted and sent.

func DecodeGIFStreamed

func DecodeGIFStreamed(gif *gif.GIF, options ...*convert.Options) (frames <-chan *ASCIIIFrame)

DecodeGIFStreamed streams the complete resulting ASCIIIF asynchronously. The returned channel is closed, when all frames have been sent for as many times as specified by the gif's LoopCount. The returned channel may be closed by the receiving side.

func EncodeAll

func EncodeAll(w io.Writer, a *ASCIIIF) error

EncodeAll encodes the given ASCIIIF to json and writes it to w.

Types

type ASCIIIF

type ASCIIIF struct {
	Image [][][]ascii.CharPixel // The successive images.
	Delay []int                 // The successive delay times, one per frame, in 100ths of a second.
	// LoopCount controls the number of times an animation will be
	// restarted during display.
	// A LoopCount of 0 means to loop forever.
	// A LoopCount of -1 means to show each frame only once.
	// Otherwise, the animation is looped LoopCount+1 times.
	LoopCount int
}

ASCIIIF is the ascii-equivalent to a GIF: the ASCII Interchange Format.

func DecodeAll

func DecodeAll(r io.Reader) (*ASCIIIF, error)

DecodeAll decodes an ASCIIIF from the given reader. The reader shall read from a json-encoded ASCIIIF as produced by EncodeALL.

func DecodeGIF

func DecodeGIF(gif *gif.GIF, options ...*convert.Options) *ASCIIIF

DecodeGIF decodes an ASCIIIF from the given GIF and options. The GIF will be decoded using the default converter provided by the image2ascii library. If no options are provided, the convert package's default options will be used.

type ASCIIIFrame

type ASCIIIFrame struct {
	Image [][]ascii.CharPixel
	Delay int
}

ASCIIIFrame represents a single image taken form an ASCIIIF and the delay to the succeeding frame.

Jump to

Keyboard shortcuts

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