Griffon
  1. Griffon
  2. GRIFFON-154

GfxBuilder: Line node cannot be used by itself

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.2-rc1
    • Component/s: builders
    • Labels:
      None
    • Number of attachments :
      0

      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.

        Activity

        Hide
        Alexander Klein added a comment -

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

        Show
        Alexander Klein added a comment - 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().
        Hide
        Alexander Klein added a comment -

        gfxbuilder-0.4 included into gfxbuilder-plugin 0.6

        Show
        Alexander Klein added a comment - gfxbuilder-0.4 included into gfxbuilder-plugin 0.6

          People

          • Assignee:
            Alexander Klein
            Reporter:
            Andres Almiray
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: