I redid a program in Python I made a few years ago that controlled the mouse pointer to “draw” a raster image by moving the pointer around and automatically clicking, pixel by pixel. However, this time, I decided to add in SVG support to overcome the inefficiency of drawing every pixel, and now it’s pretty cool watching your mouse pointer do its work. Now your mouse cursor supports SVG better than Internet Explorer!
Here’s a demonstration of the famous SVG cubic spline example file being drawn. Note that it draws every line, and a flood fill of an element on top won’t cover a line.
[kml_flashembed publishmethod="static" fversion="8.0.0" useexpressinstall="true" movie="http://www.youtube.com/v/3D_4mWwDdn4" width="450" height="276" targetclass="flashmovie" allowfullscreen="true"]
[/kml_flashembed]
I have posted the code, but there are some major caveats:
- It was a quick project, so the code is fairly ugly.
- It is by no means a complete implementation of the SVG spec.
- All paths but elliptical arc curves are supported.
- All basic shapes are supported, but rectangles will not have rounded corners.
- Transformations are implemented, but I am not sure if they work properly.
- Viewports are not understood. The only unit understood is the one of userspace.
- It uses the Windows API to control the mouse.
- The drawing method doesn’t work in all programs.
You can find the code here:
http://github.com/sk89q/scripts/blob/master/mdraw/mdraw.py

I'm on Twitter!