GraphicsBuilder: update on SVGRenderer - No Fluff Just Stuff

GraphicsBuilder: update on SVGRenderer

Posted by: Andres Almiray on April 17, 2008

GraphicsBuilder has had SVG support for some time ago, but it only supported transforming SVG documents into groovy code. Not anymore! it now is capable of writing SVG documents too, thanks to SVGRenderer. I must confess that Batik is the real workhorse here, as it provides a very handy SVGGraphics2D class (a subclass of Graphics2D), writing svg is just a matter of pluggin an instance of that class into a GraphicsContext, execute the code and write the result. To show you how easy it is here is the previous SWFRenderer example but with SVG this time

This code produces the following SVG output

Because SVGRenderer uses a Graphics2D subclass all other nodes are automatically supported, this means gradients, filters, images, ... neat!

Keep on Groovying!
Andres Almiray

About Andres Almiray

Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »