Miscellaneous routines for canvas 2D context.