forked from MTSR/mapserver
alpha color values
This commit is contained in:
parent
8631d71429
commit
b9abb429ad
@ -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}
|
||||
m.colors[parts[0]] = &c
|
||||
count++
|
||||
}
|
||||
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++
|
||||
}
|
||||
}
|
||||
|
||||
return count, nil
|
||||
|
@ -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")
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user