W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

Re: [whatwg] Canvas in workers

From: Kenneth Russell <kbr@google.com>
Date: Tue, 22 Oct 2013 14:52:43 -0700
Message-ID: <CAMYvS2eoNO8aVGu0nRy7MVvsyFKMPonOQRoKPEh=NJe2Gg1sgg@mail.gmail.com>
To: "Robert O'Callahan" <robert@ocallahan.org>
Cc: WHAT Working Group <whatwg@whatwg.org>, Glenn Maynard <glenn@zewt.org>, Kyle Huey <me@kylehuey.com>
On Tue, Oct 22, 2013 at 1:44 PM, Robert O'Callahan <robert@ocallahan.org> wrote:
> On Tue, Oct 22, 2013 at 7:31 PM, Kenneth Russell <kbr@google.com> wrote:
>>
>> Robert, please don't remove those APIs from your proposal. They're
>> needed in order to address known use cases, and splitting them off
>> will make it difficult to understand how they interact with
>> WorkerCanvas later.
>
>
> Yes, I think it's a good idea to specify a complete set of APIs that fit
> together logically and if there are some we don't need, we can remove them
> or just delay implementing them until they're needed.
>
>> I would like to suggest changing the 'srcObject' property on
>> HTMLImageElement into some sort of method taking ImageBitmap as
>> argument. If an ImageBitmap had been previously set against the
>> HTMLImageElement, the method would automatically call 'close()'
>> against it. Fundamentally there should be some easy way to repeatedly
>> update the HTMLImageElement without having to query its previous
>> ImageBitmap and call close() against it before setting srcObject.
>
>
> Hmm. I'm not sure how this should work.
>
> Maybe instead we should use canvas elements and define
> ImageBitmap.transferToCanvas(HTMLCanvasElement). That would mitigate Glenn's
> argument about having to change element types too.

Using a Canvas as the target for displaying an ImageBitmap is fraught
with problems. Because Canvases are rendering targets themselves,
transferring in an ImageBitmap has to interoperate somehow with the
canvas's rendering context as well as other APIs like toDataURL. The
DrawingBuffer proposal in http://wiki.whatwg.org/wiki/CanvasInWorkers
was admittedly complex, but did properly handle fully detaching a
canvas's framebuffer and attaching it to another one. ImageBitmap,
being semantically read-only, isn't well suited for this task.

The idea to use an HTMLImageElement to display the ImageBitmaps is
elegant and I would like to see it explored, including prototyping it
behind an experimental flag and seeing how well it works.

>> Would you consider copying
>> https://wiki.mozilla.org/User:Roc/WorkerCanvasProposal to
>> http://wiki.whatwg.org/wiki/Category:Proposals so that it's easier to
>> collaborate on it?
>
>
> No problem at all. Can you do it? I need to get a WHATWG account :-).

Yes, I'll take care of the initial draft. The whatwg was pretty
responsive when I got my account though.

-Ken


> Rob
> --
> Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni le
> atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
> stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
> 'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
> waanndt  wyeonut  thoo mken.o w
Received on Tuesday, 22 October 2013 21:53:08 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:12 UTC