image

package
v0.0.0-...-afc20ba Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: BSD-3-Clause Imports: 7 Imported by: 1

Documentation

Overview

Package image implements a MegaSD image decoder and encoder.

The format is defined as 64 by 40 pixels exactly which is split into forty 8 by 8 tiles. Up to three 16 color palettes can be defined and each tile can use only one of these palettes. The first color in each palette is reserved for transparency.

The file is written as 1280 bytes of pixel information; a 4-bit index for each pixel, followed by 40 bytes of palette index, one per tile and finally up to three 32 byte palettes of 16 colors where each color is stored as a packed 16-bit value. There is no compression so the resulting file is either 1352, 1384, or 1416 bytes in size depending on the number of palettes used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

Decode reads a MegaSD image from r and returns it as an image.Image.

func DecodeConfig

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

DecodeConfig returns the color model and dimensions of a MegaSD image without decoding the entire tile.

func Encode

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

Encode writes the Image m to w in MegaSD image format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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