decoder

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPool

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

func NewBufferPool

func NewBufferPool() *BufferPool

func (*BufferPool) Get

func (b *BufferPool) Get() []byte

func (*BufferPool) Put

func (b *BufferPool) Put(buf []byte)

type Decoder

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

Decoder stores information to decode picture

func NewDecoder

func NewDecoder(r io.Reader, options *Options) (d *Decoder, err error)

func (*Decoder) Decode

func (d *Decoder) Decode() (image.Image, error)

Decode picture from reader

func (*Decoder) GetFeatures

func (d *Decoder) GetFeatures() utils.BitstreamFeatures

GetFeatures return information about picture: width, height ...

type DefaultImageFactory

type DefaultImageFactory struct{}

func (*DefaultImageFactory) Get

func (d *DefaultImageFactory) Get(width, height int) *image.NRGBA

type ImageFactory

type ImageFactory interface {
	Get(width, height int) *image.NRGBA
}

type ImagePool

type ImagePool struct {
	Count int64
	// contains filtered or unexported fields
}

func NewImagePool

func NewImagePool() *ImagePool

func (*ImagePool) Get

func (n *ImagePool) Get(width, height int) *image.NRGBA

func (*ImagePool) Put

func (n *ImagePool) Put(img *image.NRGBA)

type Options

type Options struct {
	BypassFiltering        bool
	NoFancyUpsampling      bool
	Crop                   image.Rectangle
	Scale                  image.Rectangle
	UseThreads             bool
	Flip                   bool
	DitheringStrength      int
	AlphaDitheringStrength int

	// if nil, DefaultImageFactory will be used.  If non-nil, decode will return an image that must be put back into the pool
	// when you're done with it
	ImageFactory ImageFactory
	// if nil, a default buffer will be used.  If non-nil, decode will use this buffer to store data from the reader.
	// The idea is that this buffer be reused, so either pass this back in next time you call decode, or put it back into
	// a pool when you're done with it.
	Buffer []byte
}

Options specifies webp decoding parameters

func (*Options) GetConfig

func (o *Options) GetConfig() (*C.WebPDecoderConfig, error)

GetConfig build WebPDecoderConfig for libwebp

Jump to

Keyboard shortcuts

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