Documentation ¶
Overview ¶
Package rle contains support for Run-Length Encoding of level chunks.
Index ¶
Constants ¶
const NullColor = 0xFFFF
Variables ¶
This section is empty.
Functions ¶
func Alphabetize ¶
Alphabetize converts a palette index value into a single character for Visualize to display.
It supports up to 36 palette indexes before it will wrap back around and begin reusing symbols.
Types ¶
type Grid ¶
type Grid [][]*uint64
Grid is a 2D array of nullable integers to store a flat bitmap of a chunk.
func NewGrid ¶
NewGrid will return an initialized 2D grid of equal dimensions of the given size.
The grid is indexed in [Y][X] notation, or: by row first and then column.
func (Grid) Compress ¶
Compress the grid into a byte stream of RLE compressed data.
The compressed format is a stream of:
- A Uvarint for the palette index (0-255) or 0xffff (65535) for null. - A Uvarint for how many pixels to repeat that color.
func (Grid) Decompress ¶
Decompress the RLE byte stream back into a populated 2D grid.