backend

package
v0.0.0-...-ec835ab Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MethodNotImplementedError = errors.New("Not implemented")

MethodNotImplementedError is an error returned if method is not implemented

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Effect(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)
	Fit(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)
	Flat(ctx context.Context, background *image.ImageFile, options *Options) ([]byte, error)
	Flip(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)
	Resize(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)
	Rotate(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)
	String() string
	Thumbnail(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)
}

Engine is an interface to define an image engine

type Gifsicle

type Gifsicle struct {
	Path string
}

Gifsicle is the gifsicle backend.

func (*Gifsicle) Effect

func (b *Gifsicle) Effect(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)

Effect implements Backend.

func (*Gifsicle) Fit

func (b *Gifsicle) Fit(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)

Fit implements Backend.

func (*Gifsicle) Flat

func (b *Gifsicle) Flat(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)

Flat implements Backend.

func (*Gifsicle) Flip

func (b *Gifsicle) Flip(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)

Flip implements Backend.

func (*Gifsicle) Resize

func (b *Gifsicle) Resize(ctx context.Context, imgfile *image.ImageFile, opts *Options) ([]byte, error)

Resize implements Backend.

func (*Gifsicle) Rotate

func (b *Gifsicle) Rotate(ctx context.Context, img *image.ImageFile, options *Options) ([]byte, error)

Rotate implements Backend.

func (*Gifsicle) String

func (b *Gifsicle) String() string

func (*Gifsicle) Thumbnail

func (b *Gifsicle) Thumbnail(ctx context.Context, imgfile *image.ImageFile, opts *Options) ([]byte, error)

Thumbnail implements Backend.

type GoImage

type GoImage struct{}

func (*GoImage) Effect

func (e *GoImage) Effect(ctx context.Context, img *imagefile.ImageFile, options *Options) ([]byte, error)

func (*GoImage) Fit

func (e *GoImage) Fit(ctx context.Context, img *imagefile.ImageFile, options *Options) ([]byte, error)

func (*GoImage) Flat

func (e *GoImage) Flat(ctx context.Context, backgroundFile *imagefile.ImageFile, options *Options) ([]byte, error)

func (*GoImage) Flip

func (e *GoImage) Flip(ctx context.Context, img *imagefile.ImageFile, options *Options) ([]byte, error)

func (*GoImage) Resize

func (e *GoImage) Resize(ctx context.Context, img *imagefile.ImageFile, options *Options) ([]byte, error)

func (*GoImage) Rotate

func (e *GoImage) Rotate(ctx context.Context, img *imagefile.ImageFile, options *Options) ([]byte, error)

func (*GoImage) String

func (e *GoImage) String() string

func (*GoImage) Thumbnail

func (e *GoImage) Thumbnail(ctx context.Context, img *imagefile.ImageFile, options *Options) ([]byte, error)

type Options

type Options struct {
	Color    string
	Degree   int
	Filter   string
	Format   imaging.Format
	Height   int
	Images   []image.ImageFile
	Position string
	Quality  int
	Stick    string
	Upscale  bool
	Width    int
}

Options is the engine options

func (Options) String

func (o Options) String() string

Jump to

Keyboard shortcuts

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