zntg/ui/shadow.go

30 lines
774 B
Go
Raw Normal View History

2018-08-03 06:46:10 +00:00
package ui
import (
"opslag.de/schobers/zntg/allg5"
2018-08-03 06:46:10 +00:00
)
var dropShadowPalette []allg5.Color
2018-08-03 06:46:10 +00:00
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),
2018-08-03 06:46:10 +00:00
}
}
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)
2018-08-03 06:46:10 +00:00
}