[whatwg] Proposal: ImageData constructor or factory method with preexisting data

Rik Cabanier cabanier at gmail.com
Fri Aug 9 14:21:56 PDT 2013


On Fri, Aug 9, 2013 at 1:32 PM, Ian Hickson <ian at hixie.ch> wrote:

> On Mon, 11 Mar 2013, Kenneth Russell wrote:
> >
> > It would be useful to be able to create an ImageData [1] object with
> > preexisting data. The main use case is to display arbitrary data in the
> > 2D canvas context with no data copies.
>
> Doesn't ImageBitmap support this already? I'm not sure I understand the
> use case here. Where are you getting the image data from, that it's
> already in raw RGBA form rather than compressed e.g. as a PNG? (Presumably
> this isn't coming over the network, since I would imagine the time to
> compress and decompress an image is far smaller than the time to send
> uncompressed data. But maybe I'm wrong about that.)
>

>From re-reading the thread, it seems that this data comes from the server
(or a web worker?) as uncompressed data. The http protocol likely did
compression on the packets so the size difference is probably not that
great.

I think the use-case is to avoid having to copy over the data pixel by
pixel from the arraybuffer.


>
>
> On Mon, 11 Mar 2013, Justin Novosad wrote:
> >
> > The use cases I see for this new interface is for relaying image data,
> > that is *not* generated in JS.  For example, suppose a chunk of image
> > data is generated on the server side and sent to the client via
> > WebSocket.
>
> Wouldn't you send that as a PNG and then just use ImageBitmap?
>
>
> [snip the rest of this thread, which seemed to mainly discuss
> implementation details -- without knowing what the use case is, it's
> impossible to evaluate that level of detail]
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>



More information about the whatwg mailing list