func CurveRectangle(gc draw2d.GraphicContext, x0, y0,
	rectWidth, rectHeight float64, stroke, fill color.Color) {
	radius := (rectWidth + rectHeight) / 4

	x1 := x0 + rectWidth
	y1 := y0 + rectHeight
	if rectWidth/2 < radius {
		if rectHeight/2 < radius {
			gc.MoveTo(x0, (y0+y1)/2)
			gc.CubicCurveTo(x0, y0, x0, y0, (x0+x1)/2, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, (y0+y1)/2)
			gc.CubicCurveTo(x1, y1, x1, y1, (x1+x0)/2, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, (y0+y1)/2)
		} else {
			gc.MoveTo(x0, y0+radius)
			gc.CubicCurveTo(x0, y0, x0, y0, (x0+x1)/2, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, y0+radius)
			gc.LineTo(x1, y1-radius)
			gc.CubicCurveTo(x1, y1, x1, y1, (x1+x0)/2, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, y1-radius)
		}
	} else {
		if rectHeight/2 < radius {
			gc.MoveTo(x0, (y0+y1)/2)
			gc.CubicCurveTo(x0, y0, x0, y0, x0+radius, y0)
			gc.LineTo(x1-radius, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, (y0+y1)/2)
			gc.CubicCurveTo(x1, y1, x1, y1, x1-radius, y1)
			gc.LineTo(x0+radius, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, (y0+y1)/2)
		} else {
			gc.MoveTo(x0, y0+radius)
			gc.CubicCurveTo(x0, y0, x0, y0, x0+radius, y0)
			gc.LineTo(x1-radius, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, y0+radius)
			gc.LineTo(x1, y1-radius)
			gc.CubicCurveTo(x1, y1, x1, y1, x1-radius, y1)
			gc.LineTo(x0+radius, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, y1-radius)
		}
	}
	gc.Close()
	gc.SetStrokeColor(stroke)
	gc.SetFillColor(fill)
	gc.SetLineWidth(10.0)
	gc.FillStroke()
}
func CurveRectangle(gc draw2d.GraphicContext, x0, y0,
	rectWidth, rectHeight float64, stroke, fill color.Color) {
	radius := (rectWidth + rectHeight) / 4

	x1 := x0 + rectWidth
	y1 := y0 + rectHeight
	if rectWidth/2 < radius {
		if rectHeight/2 < radius {
			gc.MoveTo(x0, (y0+y1)/2)
			gc.CubicCurveTo(x0, y0, x0, y0, (x0+x1)/2, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, (y0+y1)/2)
			gc.CubicCurveTo(x1, y1, x1, y1, (x1+x0)/2, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, (y0+y1)/2)
		} else {
			gc.MoveTo(x0, y0+radius)
			gc.CubicCurveTo(x0, y0, x0, y0, (x0+x1)/2, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, y0+radius)
			gc.LineTo(x1, y1-radius)
			gc.CubicCurveTo(x1, y1, x1, y1, (x1+x0)/2, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, y1-radius)
		}
	} else {
		if rectHeight/2 < radius {
			gc.MoveTo(x0, (y0+y1)/2)
			gc.CubicCurveTo(x0, y0, x0, y0, x0+radius, y0)
			gc.LineTo(x1-radius, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, (y0+y1)/2)
			gc.CubicCurveTo(x1, y1, x1, y1, x1-radius, y1)
			gc.LineTo(x0+radius, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, (y0+y1)/2)
		} else {
			gc.MoveTo(x0, y0+radius)
			gc.CubicCurveTo(x0, y0, x0, y0, x0+radius, y0)
			gc.LineTo(x1-radius, y0)
			gc.CubicCurveTo(x1, y0, x1, y0, x1, y0+radius)
			gc.LineTo(x1, y1-radius)
			gc.CubicCurveTo(x1, y1, x1, y1, x1-radius, y1)
			gc.LineTo(x0+radius, y1)
			gc.CubicCurveTo(x0, y1, x0, y1, x0, y1-radius)
		}
	}
	gc.Close()
	gc.SetStrokeColor(stroke)
	gc.SetFillColor(fill)
	gc.SetLineWidth(10.0)
	gc.FillStroke()
}
func CurveRectangle ( gc draw2d . GraphicContext , x0 , y0 , rectWidth , rectHeight float64 , stroke , fill color . Color ) { radius := ( rectWidth + rectHeight ) / 4 x1 := x0 + rectWidth y1 := y0 + rectHeight if rectWidth / 2 < radius { if rectHeight / 2 < radius { gc . MoveTo ( x0 , ( y0 + y1 ) / 2 ) gc . CubicCurveTo ( x0 , y0 , x0 , y0 , ( x0 + x1 ) / 2 , y0 ) gc . CubicCurveTo ( x1 , y0 , x1 , y0 , x1 , ( y0 + y1 ) / 2 ) gc . CubicCurveTo ( x1 , y1 , x1 , y1 , ( x1 + x0 ) / 2 , y1 ) gc . CubicCurveTo ( x0 , y1 , x0 , y1 , x0 , ( y0 + y1 ) / 2 ) } else { gc . MoveTo ( x0 , y0 + radius ) gc . CubicCurveTo ( x0 , y0 , x0 , y0 , ( x0 + x1 ) / 2 , y0 ) gc . CubicCurveTo ( x1 , y0 , x1 , y0 , x1 , y0 + radius ) gc . LineTo ( x1 , y1 - radius ) gc . CubicCurveTo ( x1 , y1 , x1 , y1 , ( x1 + x0 ) / 2 , y1 ) gc . CubicCurveTo ( x0 , y1 , x0 , y1 , x0 , y1 - radius ) } } else { if rectHeight / 2 < radius { gc . MoveTo ( x0 , ( y0 + y1 ) / 2 ) gc . CubicCurveTo ( x0 , y0 , x0 , y0 , x0 + radius , y0 ) gc . LineTo ( x1 - radius , y0 ) gc . CubicCurveTo ( x1 , y0 , x1 , y0 , x1 , ( y0 + y1 ) / 2 ) gc . CubicCurveTo ( x1 , y1 , x1 , y1 , x1 - radius , y1 ) gc . LineTo ( x0 + radius , y1 ) gc . CubicCurveTo ( x0 , y1 , x0 , y1 , x0 , ( y0 + y1 ) / 2 ) } else { gc . MoveTo ( x0 , y0 + radius ) gc . CubicCurveTo ( x0 , y0 , x0 , y0 , x0 + radius , y0 ) gc . LineTo ( x1 - radius , y0 ) gc . CubicCurveTo ( x1 , y0 , x1 , y0 , x1 , y0 + radius ) gc . LineTo ( x1 , y1 - radius ) gc . CubicCurveTo ( x1 , y1 , x1 , y1 , x1 - radius , y1 ) gc . LineTo ( x0 + radius , y1 ) gc . CubicCurveTo ( x0 , y1 , x0 , y1 , x0 , y1 - radius ) } } gc . Close ( ) gc . SetStrokeColor ( stroke ) gc . SetFillColor ( fill ) gc . SetLineWidth ( 10.0 ) gc . FillStroke ( ) }
// CurveRectangle draws a rectangle with bezier curves (not rounded rectangle).
CurveRectangle draws a rectangle with bezier curves ( not rounded rectangle ) .