cel

package
v0.0.0-...-38e8959 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Unlicense Imports: 10 Imported by: 3

Documentation

Overview

Package cel implements a CEL and CL2 image decoder.

Below follows a pseudo-code description of the CEL file format.

// A CEL file contains of a file header and a sequence of frames.
type CEL struct {
   // Number of frames.
   nframes uint32
   // Offset to each frame.
   frameOffsets [nframes+1]uint32
   // Header and pixel data contents of each frame.
   //
   //    start: frameOffsets[frameNum]
   //    end:   frameOffsets[frameNum+1]
   frames [nframes]Frame
}

// A Frame consists of an optional frame header followed by encoded pixel
// data.
type Frame struct {
   // Optional frame header.
   header []byte
   // Encoded pixel data.
   data []byte
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAll

func DecodeAll(path string, pal color.Palette) ([]image.Image, error)

DecodeAll decodes the given CEL image using colours from the provided palette, and returns the sequential frames.

func DecodeArchive

func DecodeArchive(path string, pal color.Palette) ([][]image.Image, error)

DecodeArchive decodes the given CEL archive using colours from the provided palette, and returns the sequential frames of the embedded CEL images.

func ParsePal

func ParsePal(path string) (color.Palette, error)

ParsePal parses the given PAL file and returns the corresponding palette.

Below follows a pseudo-code description of the PAL file format.

// A PAL file contains a sequence of colour definitions, representing a
// palette.
type PAL [256]Color

// A Color represents a colour specified by red, green and blue intensity
// levels.
type Color struct {
   red, green, blue byte
}

Types

type TransitionTable

type TransitionTable struct {
	// Indices maps from TRN index to palette index.
	Indices [256]uint8
}

A TransitionTable represents a colour transition table.

func ParseTrn

func ParseTrn(path string) (*TransitionTable, error)

ParseTrn parses the given TRN file and returns the corresponding colour transition table.

Below follows a pseudo-code description of the TRN file format.

// A TRN file contains a sequence of colour transitions, representing
// indexes into a palette.
type TRN [256]uint8

func (*TransitionTable) Pal

func (trn *TransitionTable) Pal(src color.Palette) color.Palette

Pal returns a new palette created by resolving colours from the source palette using indices from the colour transition table.

Directories

Path Synopsis
Package config specifies the data required for decoding CEL images.
Package config specifies the data required for decoding CEL images.

Jump to

Keyboard shortcuts

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