Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appending circle shape to Path2D

So, to append a rectangle to a Path, you can do this

    Path2D rect = new Path2D.Double();
    rect.append(new Rectangle(10, 10, 100, 10), true);

What I want to do is something like this:

    Path2D circ = new Path2D.Double();
    circ.append(new Circle(... params) true);

Is there a way to do this? Thanks.

like image 687
nick Avatar asked Oct 24 '25 03:10

nick


1 Answers

You would use an Ellipse2D and give it symmetric parameters.

e.g..,

circ.append(new Ellipse2D.Double(x, y, w, h), true); // where w == h

To see all the classes that inherit from java.awt.Shape please check out its API.

like image 152
Hovercraft Full Of Eels Avatar answered Oct 27 '25 04:10

Hovercraft Full Of Eels



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!