Details
Description
As it is explained at http://blog.chuidiang.com/2010/03/21/sigo-jugando-con-gfxbuilder, the following code from grails-j2d plugin fails to produce a picture with a single line
def graph = {
renderImage(width: 520, height: 540) {
line( x1: 10, y1: 20, x2: 300, y2: 40, borderColor: 'red', borderWidth: 3 )
}
}
However adding other elements (like a circle) does make the line appear.
A line is an unclosed Shape and unclosed Shapes will be closed automatically when added to an Area.
As a line is not closable, the bounds of this Area is [0,0,0,0] (empty).
This aswell can happen to other outlines aswell when they are straight.
This is known/intended as of the Area javadoc.
When you add another Shape (other than a line) then the combination will have a size and everything will be shown correctly.
I solved it by temporarily adding an invisible RectangleNode around each 'empty' outline if is used in a group().