spr

package
v0.0.0-...-49ddc05 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package spr implements decoding of Dark Omen's .SPR sprite files.

The method used in this decoder is based off the method from the Dark Omen Wiki at http://wiki.dark-omen.org/do/DO/Updated_Sprite_Format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder reads and decodes a sprite from an input stream.

func NewDecoder

func NewDecoder(r io.ReaderAt) *Decoder

NewDecoder returns a new decoder that reads from r.

func (*Decoder) Decode

func (d *Decoder) Decode() (*Sprite, error)

Decode reads the encoded sprite information from its input and returns a new Sprite containing decoded information and frames.

type Frame

type Frame struct {
	// Type provides information about how to interpret the frame image.
	Type FrameType
	// Image is the decoded frame data converted into a non-alpha-premultiplied
	// 32-bit color image.
	Image *image.NRGBA
}

A Frame contains an in-memory representation of the image.

type FrameType

type FrameType uint8

FrameType provides information about how to interpret the frame image.

const (
	// FrameTypeRepeat indicates this frame is a repeat of a previous frame.
	FrameTypeRepeat FrameType = iota
	// FrameTypeFlipHorizontally indicates this frame should be flipped
	// horizontally.
	FrameTypeFlipHorizontally
	// FrameTypeFlipVertically indicates this frame should be flipped
	// vertically.
	FrameTypeFlipVertically
	// FrameTypeFlipHorizontallyAndVertically indicates this frame should be
	// flipped horizontally and vertically.
	FrameTypeFlipHorizontallyAndVertically
	// FrameTypeNormal indicates this is a normal frame.
	FrameTypeNormal
	// FrameTypeEmpty indicates the frame is empty.
	// There is no frame or palette data associated with this frame.
	// The frame's width and height are 0.
	FrameTypeEmpty
)

type Sprite

type Sprite struct {
	Frames []*Frame
	// contains filtered or unexported fields
}

A Sprite is made up of a list of frames.

Jump to

Keyboard shortcuts

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