Monday, June 25th, 2007>p>Chris Oliver (Mr. JavaFX Script) has posted a preview of a JavaFX to SVG translator:
It’ll take a few more days before we post the code to OpenJFX, but in the meantime here’s a preview of the latest version of our SVG to FX translator. The translator converts an SVG document into a single JavaFX class. Each definition id in the SVG is converted into a method of the class that returns the JavaFX equivalent of that element. The generated class itself is an instance of the JavaFX class Node, which means it can be used anywhere in a JavaFX Canvas.
Having this translator makes it straightforward to incorporate graphics created in vector drawing tools into JavaFX programs.
The below demo program consists of an SVG browser that uses the translator to convert SVG into JavaFX source code and then compiles and executes the result. In addition, the browser lets you view the original SVG source as well as the translated JavaFX source.
What if we had some code that did “if browser.supports(SVG) run the SVG app else run the JavaFX Script version”.
You can launch it via Java Web Start.
Posted by Dion Almaer at 12:35 pm