pcx

package
v0.0.0-...-77c44f5 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePalette

func DecodePalette(r io.Reader) (color.Palette, error)

func DefaultPalette

func DefaultPalette() color.Palette

DefaultPalette is a palette used for tile decoding.

func Encode

func Encode(img *Image) []byte

func PlaceholderPalette

func PlaceholderPalette() color.Palette

PlaceholderPalette is a placeholder palette used by PCX sprite decoder for different materials. It is set mostly to allow encoding PCX images directly to a pair of PNG images. Engine doesn't use this palette and instead sets its own palette based on the object's materials.

Types

type Image

type Image struct {
	image.Image
	ImageMeta
	// Material stores a color multiplier as a paletted image. Indexes in the palette are usually interpreted as materials.
	// Palette index value 0 indicates no material, meaning that color can be read from NRGBA directly.
	// All other palette indexes are moved by +1, comparing to the ones passed expected by the engine.
	Material *image.Paletted
}

func Decode

func Decode(r io.Reader, typ byte) (*Image, error)

type ImageMeta

type ImageMeta struct {
	Type  byte        `json:"type,omitempty"`
	Point image.Point `json:"point"`
}

func DecodeHeader

func DecodeHeader(r io.Reader, typ byte) (*ImageMeta, image.Point, error)

Jump to

Keyboard shortcuts

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