Fix canvas immediate API for cases where stride ≠ 2

This PR provides a fix for #2136. It is a major rewrite of the canvas immediate code.

This is still WIP as @bartvde is working on unit-tests. The "complex" example is also to be removed before merging this into master.