Added shadow control.
This commit is contained in:
parent
8f17c02634
commit
70d9e23b0c
22
ui/shadow.go
Normal file
22
ui/shadow.go
Normal file
@ -0,0 +1,22 @@
|
||||
package ui
|
||||
|
||||
import "opslag.de/schobers/geom"
|
||||
|
||||
type shadow struct {
|
||||
Proxy
|
||||
}
|
||||
|
||||
func Shadow(content Control) *shadow {
|
||||
s := &shadow{}
|
||||
s.Content = content
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *shadow) Render(ctx Context) {
|
||||
s.Proxy.Render(ctx)
|
||||
b := s.Bounds()
|
||||
shadow := RGBA(0xBD, 0xBD, 0xBD, 0x2F)
|
||||
ctx.Renderer().FillRectangle(geom.RectF32(b.Min.X, b.Min.Y, b.Max.X, b.Min.Y+3), shadow)
|
||||
ctx.Renderer().FillRectangle(geom.RectF32(b.Min.X, b.Min.Y, b.Max.X, b.Min.Y+2), shadow)
|
||||
ctx.Renderer().FillRectangle(geom.RectF32(b.Min.X, b.Min.Y, b.Max.X, b.Min.Y+1), shadow)
|
||||
}
|
Loading…
Reference in New Issue
Block a user