Comment #8 on issue 1089 by tu...@tudorgirba.com: Roassal should export PNG https://code.google.com/p/moose-technology/issues/detail?id=1089
Here is a standalone script that seems to almost works. There is still seems to be a problem with one pixel at the bottom and to the right that gets cut.
b := RTMondrianViewBuilder new. b shape rectangle withBorder; width: [ :cls | cls numberOfVariables * 5]; height: #numberOfMethods; linearFillColor: #numberOfLinesOfCode within: RTObject withAllSubclasses. b nodes: RTObject withAllSubclasses. b edgesFrom: #superclass. b treeLayout. b build.
trachelCanvas := b view canvas. form := FormCanvas extent: (trachelCanvas encompassingRectangle) extent. session := Smalltalk session. surface := AthensCairoSurface extent: (trachelCanvas encompassingRectangle extent) asIntegerPoint. form fillRectangle: trachelCanvas encompassingRectangle color: trachelCanvas color. "The drawing has to be done when a change in the shapes occured or when there is an animation." surface drawDuring: [:cs | surface clear. "We display the elements that are subject to the camera" trachelCanvas shapes do: [ :trachelShape | trachelShape drawOn: cs. ]. "We display the elements that are _NOT_ subject to the camera" trachelCanvas fixedShapes do: [ :trachelShape | trachelShape drawOn: cs. ]. ]. "aCanvas translucentImage: surface asForm at: self bounds origin." "asForm creates a new Form, which is likely to be expensive. This can be cached" form image: surface asForm at: trachelCanvas encompassingRectangle origin sourceRect: (0 @ 0 extent: surface extent) rule: 34. surface writeToPng: 'foo.png'