I have a C++/CX component that can return an image as a stream (I could easily make it return an IBuffer, if that makes things easier). Currently, the component's return type is IRandomAccessStream and the actual stream is a InMemoryRandomAccessStream.
I want to use this stream as the source for an image in a HTML/JavaScript Windows 8 app. The problem is that I don't know how to shove this stream, or an array that I can create from it, into the image. I've tried a few things, but for example URL.createObjectURL deosn't take just an IRandomAccessStream, it requires an IRandomAccessStreamWithContentType. I've also tried to use a canvas and imagedata (http://www.w3schools.com/tags/canvas_createimagedata.asp).
My next step will probably be to try to wrap my stream in a IRandomAccessStreamWithContentType and see if I can make that work. Either in JavaScript or in my C++/CX control.
Any suggestions on how to go about this would be appreciated.
Thanks, Tomas