A library for drawing common shapes like: line, circle, rectangle and more.
shape.Line{a,b,...}.Stroke(color, width, gtx)
shape.Circle{c,r}.Stroke(color, width, gtx)
shape.Circle{c,r}.Fill(color, gtx)
shape.Rectangle{a,b}.Stroke(color, width, gtx)
shape.Rectangle{a,b}.Fill(color, gtx)
shape.Triangle{a,b,c}.Stroke(color, width, gtx)
shape.Triangle{a,b,c}.Fill(color, gtx)
shape.Curve{a,b,...}.Stroke(color, width,gtx)
...
func drawLine(gtx *layout.Context) {
red := color.RGBA{255,0,0,255}
s := gtx.Constraints
w, h := float32(s.Width.Max), float32(s.Height.Max)
shape.Line{{0,h/2},{w,h/2}}.Stroke(red, width, gtx)
}
See in example folder for gio application with more examples of shapes.