mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-06-28 14:16:24 +02:00
Fix for issue #10. Set transparency level of pixels based on the alpha channel of colors.txt.
This commit is contained in:
@ -113,11 +113,13 @@ func (colors *Colors) BlendColors(span *Span, col color.RGBA, pos int32) color.R
|
||||
if curr == nil {
|
||||
return col
|
||||
}
|
||||
const scale = float32(1) / float32(100)
|
||||
const scale = float32(1) / 100
|
||||
for ; curr != nil; curr = curr.Next {
|
||||
// At least 50% attenuation + 2% extra for each depth meter.
|
||||
factor := float32(min(100, 50+(curr.To-curr.From)*2)) * scale
|
||||
col = BlendColor(colors.Colors[curr.Value], col, factor)
|
||||
c := colors.Colors[curr.Value]
|
||||
// At least alpha channel attenuation + 2% extra for each depth meter.
|
||||
base := (int32(c.A) * 100) / 255
|
||||
factor := float32(min(100, base+(curr.To-curr.From)*2)) * scale
|
||||
col = BlendColor(c, col, factor)
|
||||
}
|
||||
return col
|
||||
}
|
||||
|
Reference in New Issue
Block a user