fixed transparency issue
This commit is contained in:
parent
0f5e1f4c0a
commit
1bcae21244
|
@ -55,6 +55,9 @@ func (i *Image) Decode(rd *bufio.Reader, palette *PaletteSection) error {
|
|||
if red == 0xff && blue == 0xff {
|
||||
alpha = 0x00
|
||||
}
|
||||
if red == 0x00 && blue == 0x00 && green == 0xff {
|
||||
alpha = 0x00
|
||||
}
|
||||
col := &color.RGBA{
|
||||
red, green, blue,
|
||||
alpha,
|
||||
|
@ -75,6 +78,10 @@ func (i *Image) Decode(rd *bufio.Reader, palette *PaletteSection) error {
|
|||
rgb[0], rgb[1], rgb[2],
|
||||
alpha,
|
||||
}
|
||||
|
||||
if rgb[0] == 0x00 && rgb[1] == 0xff && rgb[2] == 0x00 {
|
||||
alpha = 0x00
|
||||
}
|
||||
if rgb[0] == 0xff && rgb[2] == 0xff {
|
||||
alpha = 0x00
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 577 KiB After Width: | Height: | Size: 580 KiB |
|
@ -157,9 +157,16 @@ func (n *Reader) decodePalette() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
alpha := uint8(0xff)
|
||||
if rgb[0] == 0x00 && rgb[1] == 0xff && rgb[2] == 0x00 {
|
||||
alpha = 0x00
|
||||
}
|
||||
if rgb[0] == 0xff && rgb[2] == 0xff {
|
||||
alpha = 0x00
|
||||
}
|
||||
cp.Palette[i] = &color.RGBA{
|
||||
rgb[0], rgb[1], rgb[2],
|
||||
0xff,
|
||||
alpha,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue