decoder

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package decoder provides functionality of decoding compressed images such as PNG and GIF.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder decodes compressed images, such as PNGs and GIFs

func New

func New(imageFactory ImageFactory) *Decoder

New creates a Decoder instance which can be used many times for image decoding.

func (*Decoder) Decode

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

Decode decodes compressed image such as PNG or GIF and creates a new *image.Image object filled with colors from decompressed image.

func (*Decoder) DecodeFile

func (d *Decoder) DecodeFile(fileName string) (*image.Image, error)

DecodeFile decodes compressed file such as PNG or GIF and creates a new *image.Image object filled with colors from decompressed file.

type ImageFactory

type ImageFactory interface {
	NewImage(width, height int) *image.Image
}

ImageFactory creates a new image with given dimensions.

*glfw.OpenGL instance can be used as an ImageFactory implementation.

type Reader

type Reader interface {
	Read(p []byte) (n int, err error)
}

Reader is the equivalent of io.Reader

Jump to

Keyboard shortcuts

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