Maybe I'm missing something but why not use SVG for some of this? Would be perfect for the lozenge pictures.
It would be a fascinating thing to work on, but the OffscreenCanvas API is coming to Chrome[1], so I suspect it would end up being a lot of work that would be obselete after not all that much time.