package ui import ( "image/color" "opslag.de/schobers/geom" ) func Background(content Control, c color.Color) Control { return &background{Proxy: Proxy{Content: content}, Background: c} } type background struct { Proxy Background color.Color } func (b *background) Render(ctx Context) { bounds := b.Proxy.Bounds() if b.Background != nil { ctx.Renderer().FillRectangle(bounds, b.Background) } b.Proxy.Render(ctx) } func Shadow(content Control) *shadow { s := &shadow{} s.Content = content return s } type shadow struct { Proxy } 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) }