fix remaining compilation errors
This commit is contained in:
parent
d78344808a
commit
79dfe7b85d
20
apgbpal.go
20
apgbpal.go
@ -30,7 +30,7 @@ func HexByteAt(str string, index int) (byte, error) {
|
|||||||
return byte(big), nil
|
return byte(big), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseRGBA(str string) RGBA, error {
|
func ParseRGBA(str string) (RGBA, error) {
|
||||||
s := strings.TrimSpace(str)
|
s := strings.TrimSpace(str)
|
||||||
s = strings.ToLower(s)
|
s = strings.ToLower(s)
|
||||||
s, _ = strings.CutPrefix(s, "#")
|
s, _ = strings.CutPrefix(s, "#")
|
||||||
@ -83,7 +83,8 @@ func MustParseBGPal(strs []string) BGPal {
|
|||||||
}
|
}
|
||||||
var ret BGPal
|
var ret BGPal
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
ret[i], err := ParseRGBA(strs[i])
|
var err error
|
||||||
|
ret[i], err = ParseRGBA(strs[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("MustParseBGPal can't parse at %d: %v", i, err)
|
log.Fatalf("MustParseBGPal can't parse at %d: %v", i, err)
|
||||||
}
|
}
|
||||||
@ -120,7 +121,8 @@ func MustParseOBJPal(strs []string) OBJPal {
|
|||||||
}
|
}
|
||||||
var ret OBJPal
|
var ret OBJPal
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
ret[i], err := ParseRGBA(strs[i])
|
var err error
|
||||||
|
ret[i], err = ParseRGBA(strs[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("MustParseOBJPal can't parse at %d: %v", i, err)
|
log.Fatalf("MustParseOBJPal can't parse at %d: %v", i, err)
|
||||||
}
|
}
|
||||||
@ -149,16 +151,20 @@ func (a APGBPal) Bytes() [56]byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
f, err := os.OpenFile("test.pal", O_WRONLY|O_CREATE|O_EXCL, 0644)
|
f, err := os.OpenFile(
|
||||||
|
"test.pal",
|
||||||
|
os.O_WRONLY|os.O_CREATE|os.O_EXCL,
|
||||||
|
0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("can't create test.pal: %v", err)
|
log.Fatalf("can't create test.pal: %v", err)
|
||||||
}
|
}
|
||||||
aUpPal := APGBPal{
|
aUpPal := APGBPal{
|
||||||
BG: MustParseBGPal([]string{"ffffff", "ff8484", "943a3a", "000000"}),
|
BG: MustParseBGPal([]string{"ffffff", "ff8484", "943a3a", "000000"}),
|
||||||
OBJ0: MustParseObjPal([]string{"7bff31", "008400", "000000"}),
|
OBJ0: MustParseOBJPal([]string{"7bff31", "008400", "000000"}),
|
||||||
OBJ1: MustParseObjPal([]string{"63a5ff", "0000ff", "000000"}),
|
OBJ1: MustParseOBJPal([]string{"63a5ff", "0000ff", "000000"}),
|
||||||
}
|
}
|
||||||
n, err := f.Write(aUpPal.Bytes()[:])
|
palb := aUpPal.Bytes()
|
||||||
|
n, err := f.Write(palb[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("can't save test.pal: %v", err)
|
log.Fatalf("can't save test.pal: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user