encoding

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Colors

type Colors color.Palette

Colors are a palette of Colors

func (Colors) MarshalJSON

func (cs Colors) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaler for the Colors type

Each color is stored as a string, consisting of 4 dexadecimal values (RGBA)

func (*Colors) UnmarshalJSON

func (cs *Colors) UnmarshalJSON(bs []byte) error

UnmarshalJSON is a custom unmarshaler for the Colors type

type Sprite

type Sprite struct {
	Size   int      `json:"size"`
	Pixels []string `json:"pixels"`
}

Sprite is the JSON representation of a Pixie sprite

func NewSprite

func NewSprite(img *image.Paletted) (s Sprite)

NewSprite creates a Sprite from a paletted image Sprites are encoded with a size (NxN) and an array of strings, where each string is a row of pixels, and each pixel is a 2 character hex value

func (Sprite) Image

func (s Sprite) Image() (img *image.Paletted, err error)

Image decodes this sprite as a paletted image

Jump to

Keyboard shortcuts

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