gif

package
v0.0.0-...-fce8f66 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gif provides GIF imageserver/image.Encoder|Processor and imageserver.Handler implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct{}

Encoder is a GIF imageserver/image.Encoder implementation.

func (*Encoder) Change

func (enc *Encoder) Change(params imageserver.Params) bool

Change implements imageserver/image.Encoder.

func (*Encoder) Encode

func (enc *Encoder) Encode(w io.Writer, nim image.Image, params imageserver.Params) error

Encode implements imageserver/image.Encoder.

type FallbackHandler

type FallbackHandler struct {
	*Handler
	Fallback imageserver.Handler
}

FallbackHandler is a imageserver.Handler implementation that allows to switch between a Handler of this package, or a fallback Handler.

If the Image format and the "format" param are equal to "gif", the Handler of this package is used. Otherwise, the fallback Handler is used.

func (*FallbackHandler) Handle

Handle implements imageserver.Handler.

type Handler

type Handler struct {
	Processor Processor
}

Handler is a GIF imageserver.Handler implementation.

Steps:

  • decode the GIF image
  • processes the GIF image with a Processor from this package
  • encode the image to GIF

If there is nothing to do, Handler does not decode the GIF image or call the Processor.

func (*Handler) Handle

func (hdr *Handler) Handle(im *imageserver.Image, params imageserver.Params) (*imageserver.Image, error)

Handle implements imageserver.Handler.

type Processor

type Processor interface {
	Process(*gif.GIF, imageserver.Params) (*gif.GIF, error)
	imageserver_image.Changer
}

Processor processes a GIF image.

type ProcessorFunc

type ProcessorFunc func(*gif.GIF, imageserver.Params) (*gif.GIF, error)

ProcessorFunc is a Processor func.

func (ProcessorFunc) Change

func (f ProcessorFunc) Change(params imageserver.Params) bool

Change implements Processor.

func (ProcessorFunc) Process

func (f ProcessorFunc) Process(g *gif.GIF, params imageserver.Params) (*gif.GIF, error)

Process implements Processor.

type SimpleProcessor

type SimpleProcessor struct {
	imageserver_image.Processor
}

SimpleProcessor is a Processor implementation that processes each frames with the sub imageserver/image.Processor.

func (*SimpleProcessor) Process

func (prc *SimpleProcessor) Process(g *gif.GIF, params imageserver.Params) (*gif.GIF, error)

Process implements Processor.

Jump to

Keyboard shortcuts

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