zntg/ui/shadow.go
2018-09-22 16:31:09 +02:00

30 lines
774 B
Go

package ui
import (
"opslag.de/schobers/zntg/allg5"
)
var dropShadowPalette []allg5.Color
func initDropShadowPalette() {
if nil != dropShadowPalette {
return
}
dropShadowPalette = []allg5.Color{
allg5.NewColorAlpha(0, 0, 0, 0x0f),
allg5.NewColorAlpha(0, 0, 0, 0x07),
allg5.NewColorAlpha(0, 0, 0, 0x03),
}
}
func DropShadow(x1, y1, x2, y2 float32) {
initDropShadowPalette()
allg5.DrawLine(x1, y2+1, x2+1, y2+1, dropShadowPalette[0], 1)
allg5.DrawLine(x2+1, y1, x2+1, y2, dropShadowPalette[0], 1)
allg5.DrawLine(x1, y2+2, x2+2, y2+2, dropShadowPalette[1], 1)
allg5.DrawLine(x2+2, y1, x2+2, y2+1, dropShadowPalette[1], 1)
allg5.DrawLine(x1+1, y2+3, x2+2, y2+3, dropShadowPalette[2], 1)
allg5.DrawLine(x2+3, y1+1, x2+3, y2+2, dropShadowPalette[2], 1)
}