JavaFX screenshot SVG

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
Locked
Fred.M
Posts: 2
Joined: Sat Mar 26, 2016 10:26 am
antibot: No, of course not.

JavaFX screenshot SVG

Post by Fred.M » Sat Mar 26, 2016 10:37 am

Hi,

Is there any possibility to generate a screenshot from javaFX into an SVG picture format ?
May be using intermediate graphic conversions, or by using FX Canvas or by using FXGraphics2D.
Thanks in advance for any help.

Fred

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: JavaFX screenshot SVG

Post by david.gilbert » Wed Mar 30, 2016 6:34 am

Sadly the JavaFX scene graph can't be rendered to an arbitrary graphics target the way that a Swing UI can. Someone asked for the feature a long time ago, but it doesn't seem like it will be added:

https://bugs.openjdk.java.net/browse/JDK-8091853

You have to settle for rendering to an image, which is useful but definitely a backward step compared to what is possible in Swing:

http://code.makery.ch/blog/javafx-2-sna ... png-image/

JFreeSVG is based on the Java2D API. It will only help in JavaFX for elements that you render to a canvas using FXGraphics2D.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Fred.M
Posts: 2
Joined: Sat Mar 26, 2016 10:26 am
antibot: No, of course not.

Re: JavaFX screenshot SVG

Post by Fred.M » Sun Apr 03, 2016 7:12 pm

Thanks for your answer.
I think, I'm going to create a java swing view of my javafx component, before to create a svg picture.

Fred

Locked