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:

A. 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)

A.1. 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

A.2. I also refactored quite a bit of the image writing code in OffscreenContext.* and imageutils* to reduce duplication of code
 
B. Move a bunch of code from the Test Suite to the main 'src' directory

C. 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 - 

         git submodule update --init # MCAD
         qmake && make
         cd tests && mkdir bin && cd bin && cmake ..
         ctest -R guicgalpngtest 

Gives a 100% pass.  (for some reason tests in the SRC dir itself dont find MCAD)

Please let me know what you think...