Issue11 2

Hi Marius

This is a proposed fix for issue #11 , cmdline output of images from OpenSCAD. 
Currently it only works on CGAL, and has only been tested under Linux and Wine
I am submitting this now to see what you think - before I go any further down the road to get OpenCSG and --viewport working. 

usage: 

       openscad -o image.png file.scad --render

(In the future, omitting '--render' will cause OpenCSG to be used)

The patch is highly experimental - I had to refactor quite a bit. The big changes are as follows:

1. Rewrite the Offscreen PNG writing code to use std::ostream instead of filename
(because all other output, like STL, DXF, etc, was based on passing std::ostreams so I stuck with that convention)

1.a. This meant rewriting some of the Mac OSX code (imageutils-macosx.cc) when I don't actually have access to a Mac. I am very unsure about this.... but I tried to copy other examples I have seen of creating a DataConsumer  from an std::ostream

1.b. I also refactored quite a bit of the image writing code in OffscreenContext.* and imageutils* to reduce duplication of code
 
2. Move a bunch of code from the Test Suite to the main 'src' directory

3. Refactor the Test Suite to actually be able to test against the gui cmdline. 

I went for the 'most direct, easiest' approach here - I simply copied all the "regression/cgalpngtest" images to "regression/guicgalpngtest" and created a "guicgalpngtest" shell wrapper to 'fool' the existing infrastructure into calling the already-built GUI openscad binary using the '-o' parameter. This did reveal one issue with the "root modifier" (! character),  which caused more refactoring of node.cc and several other files. 

It is very inefficient space-wise for now to have duplicate sets of test images, but for now it works. In fact it enables the running of 'guicgalpngtest' without having to run 'make' under the testing directory and build all the other tests. For example - 

         qmake && make
         cd tests && cmake .
         ctest -R guicgalpngtest 

Gives a 100% pass. 

Let me know what you think...