Bato-Bair Tsyrenov
Bato-Bair Tsyrenov

Reputation: 1194

How to clear Path in JavaFX GraphicsContext?

I am drawing a complex path to render a 3D image from scratch. It is the task and use of 3D engines is not allowed.

I am using:

GraphicsContext gc = getGraphicsContext2D();
gc.clearRect(x, y, w, h);
gc.appendSVGPath(svg);
gc.stroke();

svg is a very long string that contains svg graphic.

What I have noticed is that the value of gc.path.pointTypes.length keeps increasing by > 400k each time graphics are rendered and that slows down simulation with each loop.

How can I clear the path of GraphicsContext?

ps: It is package-private, no access.

Upvotes: 1

Views: 1185

Answers (1)

Related Questions