[whatwg] Support filters in Canvas

Rik Cabanier cabanier at gmail.com
Wed Mar 19 20:47:27 PDT 2014


On Sat, Mar 15, 2014 at 12:03 AM, Dirk Schulze <dschulze at adobe.com> wrote:

> Hi,
>
> Apologize if it was already discussed but I couldn't find a mail to this
> topic.
>

Yes, this was brought up a couple of times.
Last exchange was in Sept of 2012 (!):
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-September/037432.html


> In one of the early drafts of Filter Effects we had filter operation
> support for HTML Canvas. We deferred it and IMO it makes more sense to have
> it as part of the Canvas specification text.
>
> I would suggest a filter attribute that takes a list of filter operations
> similar to the CSS Image filter function[1]. Similar to shadows[2], each
> drawing operation would be filtered. The API looks like this:
>
> partial interface CanvasRenderingContext2D {
>     attribute DOMString filter;
> }
>
> A filter DOMString could looks like: "contrast(50%) blur(3px)"
>
> With the combination of grouping in canvas[3] it would be possible to
> group drawing operations and filter them together.
>
> Filter functions include a reference to a <filter> element and a
> specification of SVG filters[4]. I am unsure if a reference do an element
> within a document can cause problems. If it does, we would just not support
> SVG filter references.
>

Yes, I'd prefer if we supported just the CSS filter shorthands for now.


More information about the whatwg mailing list