If you’ve been reading my blog, you probably know that one of the pieces of the web platform that I’m most involved in is the HTML5 Canvas. It’s a very direct way of getting 2D (and soon 3D) graphics into web pages, and removes many of the barriers between developers and graphics rendering. One of the biggest roadblocks towards adoption of modern web tech such as Canvas is the lack of support in Internet Explorer. ExCanvas was an early attempt at providing Canvas support in IE, but it did so by translating Canvas commands to VML. This worked for simple static stuff, but was pretty slow, and definitely too slow for interactive usage. Microsoft does not support Canvas in IE7, and has stated that it will not be supported in IE8.
For the past few weekends (and one frustrating afternoon trying to work around an IE bug), I’ve been working on a native Canvas implementation for IE based on the same rendering core that’s in Firefox. With an object tag, a bit of CSS, and (to work around another IE bug) a single line of script, <canvas> elements in HTML just work. I’m excited that this experiment is working out, because lack of Canvas support in IE is one of the reasons people skip Canvas and instead turn to Flash and other plugin technologies.
I don’t have binary builds yet, but you can track development in an hg repository. One of the big unresolved questions is how to distribute this thing — it’s what’s called a “binary rendering behaviour” in IE parlance, and is packaged as an ActiveX component (well, it might or might not be ActiveX — I don’t really understand that part of the equation). Currently, the experience is pretty crappy: you have to click through an infobar to allow installation of this component, then you have to click “Yes” to say that you really want to run the native content, and then you have to click “Yes” again to allow the component to interact with content on the page. This sucks. In theory, with the right signatures, the right security class implementations, some eye of newt, and a pinch of garlic, it’s possible to get things down to a one-time install which would make the component available everywhere.
Implementation-wise, there are still many missing pieces — drawImage, get/put/createImageData, text, shadows, patterns, and gradients aren’t implemented — but with the exception of drawImage, it’s all pretty straightforward stuff, and the core path stroking/filling/compositing works. drawImage will take a bit of work, since I don’t think it’s possible to pull out the decoded image from IE (anyone know how to get a BITMAP or HDC from a IHTMLImgElement?)
We’ll see how this works out; if successful, other pieces of the modern web could be retrofitted onto IE; <video> and <audio> come to mind. I’ll be working on this as I have time, and will post updates here… don’t expect super fast progress, but I hope to have a full implementation by the end of the year.