Re: Filters spec: CSS vs SVG

On Thu, 12 May 2011 00:02:49 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> On Tue, May 10, 2011 at 6:30 PM, David Dailey <ddailey@zoominternet.net>  
> wrote:
>> Tab wrote (about feDisplacement):
>>
>> "This is similar to how <feImage> will remain in the SVG syntax to pull
>> images into the filter pipeline, but the corresponding concept in the
>> CSS syntax is just the url() function."
>>
>> <feFlood> would presumably be in this same category, I suppose. (Just  
>> checking to see if I get the idea.)
>
> Yup, just use a color instead.  (Or, if Filters absolutely require an
> image, you can use the image() function, like "image(blue)", to
> generate an image of the appropriate color, but I want to avoid that
> actually being necessary wherever possible.)

Is there a way in image() to get a generated image of a particular size?  
The filter primitive subregion defines that for feFlood (and all the other  
filter primitives), and also the x/y offset (in the chosen  
coordinatesystem) to the filter region.

>> I'm confused about filter pipelines in CSS. My concept of filter  
>> pipelines is very DOM-ish, so I'm having a hard idea of visualizing the  
>> flow chart of a complex graph of filters being implemented without DOM.  
>> The mathematics of filters is graph theoretic, and CSS seems adverbial  
>> rather than sentential.

Well, it's just as possible to build an internal graphlike structure from  
a syntax specified in CSS, I think that's what an implementation will have  
to do anyway (at least if the filter property is more complex than just a  
single simple shorthand).

...
>> If one has a graph-like object (I suppose it is actually a poset) of  
>> filter-like things, implemented in CSS and one wants to fiddle with  
>> things (adjectives associated with nouns nested in a phrase-structure  
>> and case-inflected grammar, e.g. <filter>) using script, are the  
>> techniques for doing this straightforward? I ask since I don't know.
>
> The CSSOM is really sucky, in general.

What, string manipulation isn't good enough as a DOM? ;)

Seriously though, I agree, and it would be nice if the CSSOM provided easy  
typed access to the stylerules. I'm not yet sure if the Filter Effects  
spec is the right place to add that, sounds more like a CSSOM thing to me.

Just to play with the thought a bit, here's one way it could be done:

   <div style="filter: saturate(5) blur(5 10)  
url(#advancedfilter)">...</div>
   <script>
   elm.style.filters[0].amount = 10;
   elm.style.filters[1].blurX = 10;
   </script>

An alternative to picking 'filters' (note the trailing 's') is chosing the  
existing 'filter' property and adding some new thing on that, like this:

   elm.style.filter[0].amount = 10;

or alternatively:

   elm.style.filter.list[1].blurX = 10;

I think the url() value shouldn't be too magical here, but it might be  
nice if it provided the DOM node in question if asked.


-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Thursday, 12 May 2011 07:39:06 UTC