W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2012

Re: [whatwg] CSS Filter Effects for Canvas 2D Context

From: Rik Cabanier <cabanier@gmail.com>
Date: Wed, 25 Jul 2012 22:41:20 -0700
Message-ID: <CAGN7qDB3oozU9+vimuZgoX0mRai-qex8tBX0YMCo0AqB9evOCQ@mail.gmail.com>
To: robert@ocallahan.org
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Ronald Jett <rjett@level-studios.com>, Ashley Gullen <ashley@scirra.com>, "whatwg@whatwg.org" <whatwg@whatwg.org>, David Geary <david.mark.geary@gmail.com>, Chris Marrin <cmarrin@apple.com>
On Wed, Jul 25, 2012 at 10:18 PM, Robert O'Callahan <robert@ocallahan.org>wrote:

> On Tue, Jul 17, 2012 at 4:34 PM, Rik Cabanier <cabanier@gmail.com> wrote:
>
>> I agree that it would be great to have filter effects in Canvas. It should
>> be fairly efficient if you have a GPU backend since the effects can all be
>> done with shaders so it should take up too much memory.
>> This workflow could even support our CSS shaders proposal. Also since CORS
>> is no longer an issue with Canvas, we could remove all the limitations we
>> had to build in to ensure security.
>>
>
> CORS is still an issue. You would have to apply the same limitations when
> using non-origin-clean source images.
>

Yes,
that is what I meant. CORS is implemented on Canvas for images, so that
logic should be readily accessible to CSS shaders.



>
> Something like canvas.filter = <CSS-filter-value> would probably be good,
> but you'd have to define what the object bounding box for SVG filters is.
> This would be useful for Shumway.
> https://github.com/mozilla/shumway
>
>
If you're looking into emulating flash, you'd probably do it by rendering
to an offscreen canvas (aka movieclip) and then apply the filter to the
whole thing when you blit it.
Having to calculate how big that temporary canvas should be, might be
tricky for the author. In the flash world, the movieclip's "canvas" is
calculated automatically by unioning all the drawing operators.

Rik
Received on Thursday, 26 July 2012 05:41:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:09 GMT