W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2012

Re: drop-shadow filter vs. a separate property

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 18 Jan 2012 14:41:22 -0800
To: Dean Jackson <dino@apple.com>
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, Chris Marrin <cmarrin@apple.com>, "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <2665948B-6A6A-4A66-8B89-8D83966312B4@adobe.com>
If we would not allow drop-shadow in the filter chain, developers will just surround the content with the filter by a new div and apply the filter there. The situation gets worst if drop-shadow would be in the middle of the filter chain. User would have to surround the filtered content  with two div's and apply three different filters. I assume that it is better to deal with it in the implementation. Even eliminating drop-shadow would rarely make the situation better.

Dirk

On Jan 18, 2012, at 2:28 PM, Dean Jackson wrote:

> 
> On 19/01/2012, at 9:03 AM, Tab Atkins Jr. wrote:
> 
>> On Wed, Jan 18, 2012 at 1:53 PM, Chris Marrin <cmarrin@apple.com> wrote:
>>> I've been implementing hardware accelerated filters in WebKit and the drop-shadow filter is a real stumbling block. All of the hardware accelerated ways we have to implement it are problematic. It's a pretty complex filter, requiring two separate input paths, color channel swizzling, blur and blending of the inputs. All that is possible, but integrating it into a chain of other filters is difficult and has performance issues. For hardware, doing drop-shadow as a single operation after the filter chain is way easier. This is a small problem on desktop hardware, but a much bigger one on mobile hardware where resources are much more scarce.
>>> 
>>> So I got to thinking about why we have a drop-shadow filter at all. Drop shadow is a great feature for CSS and has been discussed a lot. But it seems like it could just as easily be done as a separate property that is applied after filtering. Then it would be like box-filter, but would use the alpha of the element rather than its bounds.
>>> 
>>> Most of the current CSS filters don't even affect the alpha channel, so there would be no way to tell where in the chain the drop-shadow appeared. So in most cases having a separate drop-shadow property would be functionally equivalent. I think the only time it would matter is with blur and another drop-shadow filter. In those two cases you'd get different results depending on whether or not you put the drop-shadow before of after the filter. I'm sure someone could come up with a use case where you could see the difference between a drop-shadow filter vs a property. But are such use cases essential?
>>> 
>>> I want to make sure these filters can be efficiently hardware accelerated. For Apple hardware at least (and I'm assuming other platforms have the same issues), doing drop shadow as a separate function after filters is easily hardware accelerated. But a drop shadow filter is very resource intensive.
>>> 
>>> Dean told me that this issue was discussed at a recent meeting that I didn't attend, but I haven't found any notes from that meeting. Can someone recap the rationale for wanting a drop-shadow filter rather than a property?
>> 
>> The immediate reason to want a drop-shadow filter is that drop shadows
>> are very common, and it currently takes six filters to implement.
>> Making a shortcut filter for it is just good sense.
>> 
>> I'm not sure if forcing it to always be after the rest of the filters
>> would be acceptable or not - we'd have to look at existing usage of
>> drop shadows.
> 
> It could also apply before the filter effect (the way box-shadow and text-shadow do already).
> 
> I agree that drop shadows are important, and this is the only way to put a shadow on the opaque parts of a partially transparent image.
> 
> Dean
> 
> 
Received on Friday, 20 January 2012 17:31:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 20 January 2012 17:31:54 GMT