Out of curiosity, what's the use for such library? If you are on a desktop surely there is a better native library to draw shapes, no?
We had a rendering engine backed by canvas, so it was easy to just redirect it to this to get the file output. (not everything was visible on the user's screen all the time so couldn't just save from the client)