zrle

package
v0.0.0-...-53445cd Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TileWidth is the expected, standard width of a tile
	TileWidth int = 64
	// TileHeight is the expected, standard height of a tile
	TileHeight = 64
)

Variables

This section is empty.

Functions

func CalcRuns

func CalcRuns(buffer io.Reader, maxVal int) (int, int)

CalcRuns calculates the length of a single-pixel run, in bytes

func TilesToPixels

func TilesToPixels(width int, height int, tiles []Tile) [][]CPixel

TilesToPixels converts a grid of tiles to CPIXEL data

Types

type CPixel

type CPixel []byte

CPixel defines the structure of a CPIXEL

type PackedPaletteEncoding

type PackedPaletteEncoding struct{}

func (PackedPaletteEncoding) Read

func (PackedPaletteEncoding) Read(buf io.Reader, t *Tile) (int, error)

func (PackedPaletteEncoding) String

func (PackedPaletteEncoding) String() string

func (PackedPaletteEncoding) SubType

func (PackedPaletteEncoding) SubType() SubType

type PrleEncoding

type PrleEncoding struct{}

func (PrleEncoding) Read

func (PrleEncoding) Read(buf io.Reader, t *Tile) (int, error)

func (PrleEncoding) String

func (PrleEncoding) String() string

func (PrleEncoding) SubType

func (PrleEncoding) SubType() SubType

type RawEncoding

type RawEncoding struct{}

func (RawEncoding) Read

func (RawEncoding) Read(buf io.Reader, t *Tile) (bytesRead int, err error)

func (RawEncoding) String

func (RawEncoding) String() string

func (RawEncoding) SubType

func (RawEncoding) SubType() SubType

type RleEncoding

type RleEncoding struct{}

func (RleEncoding) Read

func (RleEncoding) Read(buf io.Reader, t *Tile) (int, error)

func (RleEncoding) String

func (RleEncoding) String() string

func (RleEncoding) SubType

func (RleEncoding) SubType() SubType

type SolidEncoding

type SolidEncoding struct{}

func (SolidEncoding) Read

func (SolidEncoding) Read(buf io.Reader, t *Tile) (int, error)

func (SolidEncoding) String

func (SolidEncoding) String() string

func (SolidEncoding) SubType

func (SolidEncoding) SubType() SubType

type SubType

type SubType uint8

SubType defines the structure of a ZLRE sub-encoding type

type Subencoding

type Subencoding interface {
	SubType() SubType
	Read(buf io.Reader, t *Tile) (int, error)
	String() string
}

Subencoding defines a subencoding structure

func GetSubencoding

func GetSubencoding(b byte) (encoding Subencoding, err error)

GetSubencoding returns the sub-encoding of a ZRLE data stream

type Tile

type Tile struct {
	X, Y, Width, Height, BytesPerCPixel, SubType int
	Pixels                                       []CPixel
}

Tile defines a tile

func CreateTiles

func CreateTiles(width int, height int) (tiles []Tile)

CreateTiles creates a grid of tiles based on a width and height

func (Tile) String

func (t Tile) String() string

func (Tile) ToPixelGrid

func (t Tile) ToPixelGrid() [][]CPixel

ToPixelGrid converts a tile into a CPIXEL grid

type TileConfig

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

TileConfig defines the underlying structure of all tiles

type ZlibStream

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

func (*ZlibStream) Read

func (z *ZlibStream) Read(p []byte) (n int, e error)

func (*ZlibStream) Write

func (z *ZlibStream) Write(p []byte) (n int, e error)

Jump to

Keyboard shortcuts

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