Wednesday, August 26th, 2009

Canvas via Silverlight again

Category: Canvas

<p>The infamous excanvas has had a Silverlight bridge for some time. It is faster, yet has some artifacts and most people stick with good ole VML.

David Anson has put his hat in the ring by creating a new prototype canvas implementation in Silverlight.

Thanks to Silverlight’s HTML Bridge, I had no trouble creating a Silverlight object that looks just like a <canvas> to JavaScript code running on a web page. So similar, in fact, that I’m able to run some pretty cool sample applications on my own <canvas> simply by tweaking the HTML to instantiate a Silverlight <canvas> instead of the browser’s <canvas>. And as a nice side effect, Internet Explorer “magically” gains support for the tag!

I did not attempt to implement the complete canvas specification. Instead, I implemented just enough to support the first 5 (of 6 total) Mozilla sample pages as well as the handful of applications shown above. Specifically, I’ve implemented everything that’s not in italics in the feature list at the beginning of this post. Thinking about what it would take to add the stuff that’s not implemented: text and pixel-level manipulation are both directly supported by Silverlight and should be pretty easy. Shadows seem like a natural fit for Silverlight’s pixel shader support (though I haven’t played around with it yet). All that’s left is layer compositing, which does worry me just a little… I haven’t thought about it much, but this seems like another job for WriteableBitmap, perhaps.

David gets a ton of the examples going though, and I am still hopeful that someone will continue work on this kind of shim to make a fast implementation. I need to go off and test Bespin.

Posted by Dion Almaer at 6:18 am
4 Comments

+++--
3.4 rating from 29 votes

4 Comments »

Comments feed TrackBack URI

Very good ! I think this could be complementary to Explorer Canvas Silverlight made by Google, because it seems to be a “compiled” implementation, not like the one available in Explorer Canvas which dynamically creates a Silverlight object and sends drawing commands via JS.
This implementation should be faster than the VML one, but I still hope there will be a native Canvas implementation in IE one day…

Comment by fabienmenager — August 26, 2009

Except the speed, what is wrong with ExCanvas?

Comment by igitur — August 26, 2009

@igitur: The speed *is* what’s wrong with ExCanvas. That, and the fact that it’s not just slower — its performance varies from Canvas in huge and surprising ways that can’t be fixed, because it’s trying to build an imperative canvas API on top of a scene graph.

Comment by jgw — August 26, 2009

Finally

Comment by Darkimmortal — August 26, 2009

Leave a comment

You must be logged in to post a comment.