im8f

package
v0.0.0-...-f0e6d84 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package im8f contains a format for encoding/decoding im8 images.

Index

Constants

View Source
const Magic = "\x69IM8\n"

Magic is the string that appears at the beginning of every im8f encoding.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

Decode reads an image.Image from r in im8f format.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig reads an image.Config from r in im8f format.

func Encode

func Encode(w io.Writer, src image.Image) error

Encode writes src to w in im8f format.

Types

type Decoder

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

Decoder holds the data that is read in im8f format.

func NewDecoder

func NewDecoder() *Decoder

NewDecoder returns an empty Decoder, ready for use. &Decoder{} also works fine for this.

func (*Decoder) Config

func (d *Decoder) Config(r io.Reader) (image.Config, error)

Config reads an image.Config from r in im8f format.

func (*Decoder) Image

func (d *Decoder) Image(r io.Reader) (image.Image, error)

Image reads an image.Image from r in im8f format.

type Encoder

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

Encoder contains all of the data that needs to be written in im8f format.

func NewEncoder

func NewEncoder(src image.Image) *Encoder

NewEncoder creates an Encoder for any image, using im8.Convert.

func NewIm8Encoder

func NewIm8Encoder(img *im8.Im8) *Encoder

NewIm8Encoder creates an Encoder for an Im8.

func (*Encoder) Write

func (e *Encoder) Write(w io.Writer) (int, error)

Write writes the contents of the Encoder to w.

type MagicMismatchError

type MagicMismatchError struct {
	Index int
	Got   byte
}

MagicMismatchError is an error that occurs when the decoded data doesn't match Magic.

func (MagicMismatchError) Error

func (m MagicMismatchError) Error() string

Error returns a string representation of the MagicMismatchError.

Jump to

Keyboard shortcuts

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