BMP decoding in JavaScript and drawing to Explorer Canvas -


i need download bmp javascript , render screen, in internet explorer. first off, yes, know insane, i'm not going why, let's accept moment img src not working because of security constraints, ajax request proper authentication in post pull image. example bypasses security sake of simplicity , proves can render something.

the best idea come fetch stream via ajax, decode bitmap, , render canvas. internet explorer doesn't support canvas, luckily google provided wrapper svg called excanvas can use that.

my code (drawing code appears work, bmp decoding not much)

http://gist.github.com/614328

future support other images besides bmp plausable, , because of how canvas works it's easiest draw pixels in rgba. texture2d wrapper class rgba byte array, plus drawing code. bytestream makes bit easier on eyes dealing byte array, , bitmapdecoder contains method translate bgr format rgba texture2d drawing.

is possible bytes getting mis-translated along way or there matter decoding logic?

fyi, got file spec wikipedia:

http://en.wikipedia.org/wiki/bmp_file_format#bitmap_information_.28dib_header.29

any idea what's going on in decoding logic or drawing logic that's causing bmp draw incorrectly?

xmlhttprequest (aka ajax) designed text content, it's possible binary data (especially null characters) aren't translated correctly. first check compare size of retrieved data actual file size.

at least on firefox, there seems way retrieve binary data, described here: handling binary data.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -