Convert canvas element to bitmap data?


Is this possible? Something like:

var element = js.Browser.document.getElementById('image0');

And then convert it to a bitmap data? If so, how would i go about it?



I think you could do the following:

var bitmapData = BitmapData.fromCanvas (element);

I don’t know that it is designed for continuous updates, it probably is expecting this to be called one-time, but it should work. I think there’s also a BitmapData.fromBase64 that’s also HTML5-specific


Thanks Josh, this will help a lot!