Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

F3 and SVG

 

F3's declarative 2D graphics API's are largely based on those defined by SVG. As a result, it was (relatively) easy to write a translator from SVG to F3.

Our current translator isn't perfect but does cover a large portion of SVG syntax.

Having such a translator makes it possible to create graphic elements in vector drawing tools such as Inkscape or Illustrator and then use the result in your F3 programs. In addtion, since F3 is a real programming language, you can parameterize properties of such graphic elements, for instance fill or stroke or some of the coordinates, and then call it like a function in your program.

F3 SVG Browser

Here's a demo program written in F3 that resembles the Apache Batik Squiggle SVG browser, but renders SVG files by first translating them into F3 source code and then compiling and executing the result.

You can drag URL's that point at SVG files from web pages into the SVG Browser's canvas. Below are a few examples for you to try: