gif

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 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")
	// ErrNotAnimated signifies that the animation cannot be created, possibly
	// due one or less available animation frames.
	ErrNotAnimated = errors.New("GIF isn't animated")
)

Functions

func IsAnimated

func IsAnimated(g *gif.GIF) bool

IsAnimated checks if the GIF should be animated.

Types

type Frame added in v0.4.5

type Frame struct {
	image.Image
	// contains filtered or unexported fields
}

Frame is a helper struct to group together GIF frame info, which is stored in 3 separate slices by the standard library.

type Helper

type Helper struct {
	// Frames is the group of frames composing the GIF.
	Frames []Frame
	// 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