func makeBall(b ball) Ball { img := canvas.Box(ballSize, ballSize, image.NewUniform(b.col), 1, image.Black) p := b.p.point().Sub(image.Pt(ballSize/2, ballSize/2)) item := canvas.NewImage(img, true, p) window.AddItem(item) window.Raise(item, nil, false) return Ball{item} }
func makeRect(r image.Rectangle, col color.Color) { img := canvas.Box(r.Dx(), r.Dy(), image.NewUniform(col), 1, image.Black) item := canvas.NewImage(img, opaqueColor(col), r.Min) window.AddItem(canvas.Draggable(item)) }