github.com/jmigpin/editor@v1.6.0/util/uiutil/widget/rectangle.go (about) 1 package widget 2 3 import ( 4 "image" 5 6 "github.com/jmigpin/editor/util/imageutil" 7 ) 8 9 type Rectangle struct { 10 ENode 11 Size image.Point 12 ctx ImageContext 13 } 14 15 func NewRectangle(ctx ImageContext) *Rectangle { 16 r := &Rectangle{ctx: ctx} 17 return r 18 } 19 func (r *Rectangle) Measure(hint image.Point) image.Point { 20 return r.Size 21 } 22 func (r *Rectangle) Paint() { 23 bg := r.TreeThemePaletteColor("rect") 24 imageutil.FillRectangle(r.ctx.Image(), r.Bounds, bg) 25 }