d2dat

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 2 Imported by: 3

Documentation

Overview

Package d2dat contains the logic for loading and processing DAT files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(data []byte) (d2interface.Palette, error)

Load loads a DAT file.

Types

type DATColor

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

DATColor represents a single color in a DAT file.

func (*DATColor) A

func (c *DATColor) A() uint8

A gets the alpha component

func (*DATColor) B

func (c *DATColor) B() uint8

B gets the blue component

func (*DATColor) BGRA

func (c *DATColor) BGRA() uint32

BGRA gets the combination of the color components (0xBBGGRRAA)

func (*DATColor) G

func (c *DATColor) G() uint8

G gets the green component

func (*DATColor) R

func (c *DATColor) R() uint8

R gets the red component

func (*DATColor) RGBA

func (c *DATColor) RGBA() uint32

RGBA gets the combination of the color components (0xRRGGBBAA)

func (*DATColor) SetBGRA

func (c *DATColor) SetBGRA(bgra uint32)

SetBGRA sets the color components using the given BGRA form

func (*DATColor) SetRGBA

func (c *DATColor) SetRGBA(rgba uint32)

SetRGBA sets the color components using the given RGBA form

type DATPalette

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

DATPalette represents a 256 color palette.

func New

func New() *DATPalette

New creates a new dat palette

func (*DATPalette) GetColor

func (p *DATPalette) GetColor(idx int) (d2interface.Color, error)

GetColor returns a color by index

func (*DATPalette) GetColors

func (p *DATPalette) GetColors() [numColors]d2interface.Color

GetColors returns the slice of colors in the palette

func (*DATPalette) Marshal

func (p *DATPalette) Marshal() []byte

Marshal encodes data palette back into byte slice

func (*DATPalette) NumColors

func (p *DATPalette) NumColors() int

NumColors returns the number of colors in the palette

Jump to

Keyboard shortcuts

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