modified svg_write() to handle multiple gradients