There is almost a duplicate for what I'm asking: almost duplicate
But I want to make the rounded corners at the top.
I tried to modify the code looking at the documentation but I'm pretty new to this drawing in Java and I didn't get it to work. :/
So my question is, how would I modify this:
moveTo(0,0);
lineTo(0, radius);
curveTo(0, 0, radius, radius, 0, radius);
lineTo(width, height - radius);
curveTo(width, height, width, height, width - radius, height);
lineTo(0, height);
closePath();
to make the rounded corners be the top corners.
I really appreciate all answers that can help me with this.
Thanks
The key is you want to visualize how the code is drawing the object. The original code starts at the top left corner and draws in a clockwise direction.
First, you need to move your start point, this will be much easier if you start on a corner, not a rounded edge.
Next, you need to modify your draws so that your rounding the edges in the right place.
moveTo(0, height);
lineTo(0, radius);
curveTo(0, 0, 0, 0, radius, 0);
lineTo(width - radius, 0);
curveTo(width, 0, width, 0, width, radius);
lineTo(width, height);
closePath();
So, what I've done here is: