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

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 UTC