gif

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAnimationComplete signifies that the animation should not continue.
	ErrAnimationComplete = errors.New("Animation is complete")
)

Functions

func IsAnimated

func IsAnimated(g *gif.GIF) bool

IsAnimated checks if the GIF should be animated.

Types

type Helper

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

Helper simplifies interacting with an animated GIF.

func HelperFromReader

func HelperFromReader(r io.Reader) (helper Helper, err error)

HelperFromReader cretes a new GIF helper from a Reader.

func NewHelper

func NewHelper(g *gif.GIF) (helper Helper, err error)

NewHelper constructs a helper for managing animated GIFs.

func (*Helper) At added in v0.4.2

func (h *Helper) At(x, y int) color.Color

At returns the color of the pixel at (x, y) at the current state of the animation. In other words, the pixel that results from layering all GIF frames up to the current frame on top of each other.

func (*Helper) Bounds added in v0.4.2

func (h *Helper) Bounds() image.Rectangle

Bounds returns the bounds of the background/first frame of the GIF.

func (*Helper) ColorModel added in v0.4.2

func (h *Helper) ColorModel() color.Model

ColorModel returns the color model of the image representing the current state of the animation.

func (*Helper) CurrentImage added in v0.4.2

func (h *Helper) CurrentImage() image.Image

CurrentImage is the image representing the current state of the animation.

func (Helper) Delay

func (h Helper) Delay() time.Duration

Delay returns the delay of the current frame.

func (*Helper) NextFrame

func (h *Helper) NextFrame() error

NextFrame moves along to the next frame and generates a new current image.

It can return ErrAnimationComplete if the animation is complete and a new image does not need to be generated.

Jump to

Keyboard shortcuts

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