Fixed on_paint to handle a seperate canvas; documented and tested

I realized in some other work that the on_paint method *must* be
able to handle a distinct canvas argument. This commit addresses
that. It also adds a fair bit of documentation explaining the
different ways to produce a raster image from a plot, and tests to
ensure that those methods work as documented.