8

I have a List<PathElement> that I would like to be able to either add to the scenegraph, or draw to canvas. The first is easy, as I can just create a Path node and add it to the scene. The second requires mapping from PathElement's to calls on GraphicsContext. For most things this is pretty straightforward except for ArcTo and GraphicsContext.arcTo which are parameterized differently.

ArcTo accepts the following ArcTo(double radiusX, double radiusY, double xAxisRotation, double x, double y, boolean largeArcFlag, boolean sweepFlag)

Whereas GraphicsContext.arcTo accepts arcTo(double x1, double y1, double x2, double y2, double radius). Additionally, GraphicsContext has arc which accepts arc(double centerX, double centerY, double radiusX, double radiusY, double startAngle, double length).

How can an ArcTobe drawn on a canvas using the methods available in GraphicsContext?

hudsonb
  • 2,214
  • 19
  • 20
  • The guy wrote a translator. I don't know if it works https://stackoverflow.com/questions/28043935/javafx-how-can-a-path-be-painted-on-a-graphicscontext. Look at the comments of Jewelsea's answer. – SedJ601 Dec 15 '17 at 16:36

1 Answers1

0

Hope this link of example will help you out.

Working with Canvas | JavaFx 2

Pradeep Rajput
  • 724
  • 7
  • 11