Monday, June 25th, 2007

JavaFX SVG Translator

Category: Java

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

4.6 rating from 40 votes


Comments feed TrackBack URI

Or, these kinds of things could start supporting standards and just take SVG as an image type to begin with.

Comment by Andy — June 25, 2007

How can it be useful, compared to the Google’s Canvas emulator for IE:

BTW, there was already at least one article on Ajaxian:

Comment by jcm — June 25, 2007

Leave a comment

You must be logged in to post a comment.