Source the palette name from data

This commit is contained in:
2020-06-01 01:24:44 +01:00
parent c1268e8d57
commit 3866ee07a8
8 changed files with 35 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/binary"
"fmt"
"image"
"image/color"
"io"
"io/ioutil"
"log"
@@ -12,7 +13,6 @@ import (
"strings"
"code.ur.gs/lupine/ordoor/internal/data/rle"
"code.ur.gs/lupine/ordoor/internal/palettes"
)
type SpriteHeader struct {
@@ -53,12 +53,12 @@ type Sprite struct {
Data []byte
}
func (s *Sprite) ToImage() *image.Paletted {
func (s *Sprite) ToImage(palette color.Palette) *image.Paletted {
return &image.Paletted{
Pix: s.Data,
Stride: int(s.Width),
Rect: image.Rect(0, 0, int(s.Width), int(s.Height)),
Palette: palettes.DefaultPalette(),
Palette: palette,
}
}