Add support for SVG images

This commit modifies draw_to_png (renamed to _image) so that it receives
the cairo surface through a callback. This makes possible to define
several formats. The type of the destination format is passed as a
string all the way down from draw_productions_to_{svg,png}.