- From: Justin Novosad <junov@google.com>
- Date: Fri, 26 Feb 2016 11:20:10 -0500
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: WHATWG <whatwg@whatwg.org>, Ali Juma <ajuma@chromium.org>, mstange@themasta.com
On Fri, Feb 26, 2016 at 10:40 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > On Fri, Feb 26, 2016 at 4:34 PM, Ali Juma <ajuma@chromium.org> wrote: > > The current canvas filters proposal [1] allows using SVG reference > filters > > defined in external documents (e.g. “url(file.svg#filter)”). Since the > > external document needs to be loaded before the filter can be applied, > > there’s a delay between setting the context’s filter attribute to such a > > filter and actually having the filter apply to drawing operations. > > Perhaps we could support assigning an SVG filter directly (as an > object)? Developers would be responsible to load them if they're > external. Adding yet another network API that's a thin layer on top of > some CSS syntax seems a little hackish. I'd prefer if we exposed > filters at a lower level somehow. > Just thought of a way to solve this problem without new API. You can load the svg file as xml using XHR, and therefore guarantee the resource's continued availability thereafter. In order to make the filter node reachable for setting it as a canvas filter using the url() syntax, I think you'd have to pull it in to your HTML with something like: someLocalElement.innerHTML = new XMLSerializer().serializeToString(svgObtainedViaXHR.documentElement); I know this is gross (parse->serialize->re-parse), but I'm just saying there is a way (I think). > -- > https://annevankesteren.nl/ >
Received on Friday, 26 February 2016 16:20:40 UTC