1
0
forked from MTSR/mapserver

alpha color values

This commit is contained in:
NatureFreshMilk 2019-02-27 16:24:53 +01:00
parent 8631d71429
commit b9abb429ad
2 changed files with 20 additions and 6 deletions

View File

@ -61,15 +61,20 @@ func (m *ColorMapping) LoadBytes(buffer []byte) (int, error) {
return 0, err
}
c := color.RGBA{uint8(r), uint8(g), uint8(b), 0xFF}
a := int64(255)
if len(parts) >= 5 {
//with alpha
a, err = strconv.ParseInt(parts[4], 10, 32)
if err != nil {
return 0, err
}
}
c := color.RGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
m.colors[parts[0]] = &c
count++
}
if len(parts) >= 5 {
//with alpha
}
}
return count, nil

View File

@ -16,4 +16,13 @@ func TestNewMapping(t *testing.T) {
panic("no color")
}
c = m.GetColor("default:river_water_flowing")
if c == nil {
panic("no color")
}
if c.A != 128 {
panic("wrong alpha")
}
}