[whatwg] Adding features needed for WebGL to ImageBitmap

Rik Cabanier cabanier at gmail.com
Wed Jul 10 21:37:01 PDT 2013


On Wed, Jul 10, 2013 at 5:07 PM, Ian Hickson <ian at hixie.ch> wrote:

> On Wed, 10 Jul 2013, Kenneth Russell wrote:
> >
> > ImageBitmap can cleanly address all of the desired use cases simply by
> > adding an optional dictionary of options.
>
> I don't think that's true. The options only make sense for WebGL --
> flipping which pixel is the first pixel, for example, doesn't do anything
> to 2D canvas, which works at a higher level.
>
> (The other two options don't make much sense to me even for GL. If you
> don't want a color space, don't set one. If you don't want an alpha
> channel, don't set one. You control the image, after all.)
>
>
> > I suspect that in the future some options will be desired even for the
> > 2D canvas use case, and having the dictionary already specified will
> > make that easier. There is no need to invent a new primitive and means
> > of loading it.
>
> If options make sense for 2D canvas, then having ImageBitmap options would
> make sense, sure.
>
>
yeah, these options seem a bit puzzling.
>From the spec:

An ImageBitmap object represents a bitmap image that can be painted to a
canvas without undue latency.

note: The exact judgement of what is undue latency of this is left up to
the implementer, but in general if making use of the bitmap requires
network I/O, or even local disk I/O, then the latency is probably undue;
whereas if it only requires a blocking read from a GPU or system RAM, the
latency is probably acceptable.

It seems that people see the imageBitmap as something that doesn't just
represent in-memory pixels but that those pixels are also preprocessed so
they can be drawn quickly. The latter is not in the spec.

I think authors will be very confused by these options. What would it mean
to pass a non-premultiplied ImageBitmap to a canvas object? Would the
browser have to add code to support it or is it illegal?
Maybe it's easier to add an optional parameter to createImageBitmap to
signal if the ImageBitmap is for WebGL or for Canvas and disallow a Canvas
ImageBitmap in WebGL and vice versa.



More information about the whatwg mailing list