Monday, June 25th, 2007

JavaFX SVG Translator

Category: Java

<>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.

Related Content:

Posted by Dion Almaer at 12:35 pm
2 Comments

++++-
4.6 rating from 40 votes

2 Comments »

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:
http://sourceforge.net/projects/excanvas
?

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

http://ajaxian.com/archives/canvas-in-ie

Comment by jcm — June 25, 2007

Leave a comment

You must be logged in to post a comment.