| Excerpt |
|---|
GraphicsBuilder is a Groovy builder for Java 2D |
Module Overview
GraphicsBuilder provides an easy way to create Java2D graphics in a similar manner as JavaFX Script but in a groovier way. Here is the Groovy logo (kind of) drawn with GraphicsBuilder using the built-in GraphicsPad application

This is the code used to draw the logo
| Code Block |
|---|
// turn on antialias
antialias( 'on' )
// create the Groovy star
star( ir: 40, or: 100, cx: 160, cy: 120, borderWidth: 4,
fill: [118,167,183] as Color ){
transformations{
scale( y: 0.6 )
}
}
// load the swingtime font, get it? Swing
def fontFile = new File("SWINM___.TTF")
font( Font.createFont(Font.TRUETYPE_FONT,fontFile).deriveFont(50.0f) )
// draw the text
text( text: 'Groovy', borderWidth: 4, fill: 'white' ){
transformations{
translate( x:80, y:30 )
scale( y: 1.2 )
}
}
|
Download
Distributions
graphicsbuilder-0.6.1 (with dependencies)
graphicsbuilder-0.6
graphicsbuilder-0.6-dependencies
Installing
Drop all jar files into $GROOVY_HOME/lib
Drop the scripts into $GROOVY_HOME/bin
Since Groovy 1.1-beta-3 the Windows NSIS Installer includes GraphicsBuilder as an additional module to install (http://groovy.codehaus.org/Windows+NSIS-Installer)
Pre-requisites
GraphicsBuilder 0.6.0 requires Groovy 1.5.0+ and Java 1.6+
Additional extensions have the following requisites
Extension | Java Version | Extra libraries |
|---|---|---|
graphicsbuilder-ext-swingx | 1.5+ | swingx-0.9.2 |
graphicsbuilder-ext-svg | 1.5+ | batik-1.7 (the whole package) |
graphicsbuilder-ext-swf | 1.5+ | transformSWF |
graphicsbuilder-ext-jhlabs | 1.5+ | Filters.jar |
graphicsbuilder-ext-jdk6 | 1.6+ |
|
graphicsbuilder-ext-animation | 1.6+ | Timing Framework |
graphicsbuilder-ext-substance | 1.6+ | Substance + Substance extras 5.0 |
GraphicsBuilder 0.6.1 requires Groovy 1.6-beta-2
Documentation
| Children Display | ||
|---|---|---|
|
Update: all graphics operation support binding in the same way as SwingBuilder does.
Developers
Andres Almiray
Source Control
http://svn.codehaus.org/groovy-contrib/graphicsbuilder
Building
GraphicsBuilder uses Maven2 as its build tool, which means that if you want to
build your own version from source you'll need to have it installed. Follow the
instructions at http://maven.apache.org.
Make sure to use maven 2.0.7 or higher.
Have fun!
Contributing
Please contact the team members by e-mail or use the mailing lists =)
Community
Mailing List(s)
http://groovy.codehaus.org/Mailing+Lists