encode

package
v0.0.0-...-4a453a3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Formats = map[string]Format{
	"ansi":   &AnsiDisplay{},
	"gif":    GIFFormat{},
	"jpg":    JPGFormat{},
	"png":    PNGFormat{},
	"rgb24":  RGB24Format{},
	"rgba32": RGBA32Format{},
}

Functions

This section is empty.

Types

type AnsiDisplay

type AnsiDisplay struct {
	// contains filtered or unexported fields
}

func (AnsiDisplay) Encode

func (f AnsiDisplay) Encode(w io.Writer, img image.Image) error

func (*AnsiDisplay) EncodeAnimation

func (f *AnsiDisplay) EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error

func (AnsiDisplay) Extensions

func (f AnsiDisplay) Extensions() []string

type Format

type Format interface {
	// Extensions returns all file extensions excluding '.' that this format is
	// commonly encoded into.
	Extensions() []string

	// Encode encodes a single image to the specfied io.Writer.
	Encode(w io.Writer, img image.Image) error

	// EncodeAnimation encodes a series of successive images to the specified
	// io.Writer.
	//
	// The function should consume all images from the stream until it closes.
	// The interval parameter is the time between two images.
	EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error
}

func DetectFormat

func DetectFormat(filename string) (Format, bool)

type GIFFormat

type GIFFormat struct{}

func (GIFFormat) Encode

func (f GIFFormat) Encode(w io.Writer, img image.Image) error

func (GIFFormat) EncodeAnimation

func (f GIFFormat) EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error

func (GIFFormat) Extensions

func (f GIFFormat) Extensions() []string

type JPGFormat

type JPGFormat struct{}

func (JPGFormat) Encode

func (f JPGFormat) Encode(w io.Writer, img image.Image) error

func (JPGFormat) EncodeAnimation

func (f JPGFormat) EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error

func (JPGFormat) Extensions

func (f JPGFormat) Extensions() []string

type PNGFormat

type PNGFormat struct{}

func (PNGFormat) Encode

func (f PNGFormat) Encode(w io.Writer, img image.Image) error

func (PNGFormat) EncodeAnimation

func (f PNGFormat) EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error

func (PNGFormat) Extensions

func (f PNGFormat) Extensions() []string

type RGB24Format

type RGB24Format struct{}

func (RGB24Format) Encode

func (f RGB24Format) Encode(w io.Writer, img image.Image) error

func (RGB24Format) EncodeAnimation

func (f RGB24Format) EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error

func (RGB24Format) Extensions

func (f RGB24Format) Extensions() []string

type RGBA32Format

type RGBA32Format struct{}

func (RGBA32Format) Encode

func (f RGBA32Format) Encode(w io.Writer, img image.Image) error

func (RGBA32Format) EncodeAnimation

func (f RGBA32Format) EncodeAnimation(w io.Writer, stream <-chan image.Image, interval time.Duration) error

func (RGBA32Format) Extensions

func (f RGBA32Format) Extensions() []string

Jump to

Keyboard shortcuts

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