I need to draw a donut shape using JavaFX's GraphicsContext - a filled circle with a hole in the center, to clarify.
I have been searching and I can't find any examples online.
I think you'd use the fillarc function, but I do not understand it. There are no examples that I could find, and the docs do not help much. (What is arcExtent? All the docs say is that it's the extent of the arc...)
I don't want to fill two overlapping circles, because I want to keep the center transparent while drawing. (I have already drawn stuff underneath, I can't interfere with it)
Here are a couple of sample solutions, one uses shape subtraction for circles, another uses an Arc. Both examples use the scene graph for drawing.
An alternate solution could also use a Path with arc and line segments, but I don't show that here. If you wanted a 3D donut, you could create a Torus.
Here is another example which uses fillArc in a GraphicsContext.
Related: