W3C home > Mailing lists > Public > public-fx@w3.org > July to September 2013

Re: [filter-effects] blur() on background-image and edge blurring

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sun, 25 Aug 2013 09:57:09 -0700
Message-ID: <CAAWBYDCDnAB0W1jhFM5a13Q0d1_gm5jrL-q-Mab4ERnZrJcysw@mail.gmail.com>
To: Dirk Schulze <dschulze@adobe.com>
Cc: "public-fx@w3.org" <public-fx@w3.org>
On Sun, Aug 25, 2013 at 5:02 AM, Dirk Schulze <dschulze@adobe.com> wrote:
> Hi,
>
> Experimenting with the CSS Image filter() function support in WebKit, I noticed a problem with blur(). Just as a summary to filter(). The function lets you filter its input before it is used as e.g a background image:
>
>         background-image: filter(url(image.png), blur(10px));
>
> When you try the example above then you'll see a blurred image. Since the gaussian kernel goes over each pixel in the image, there are naturally undefined pixels that are outside of image.png. In this case the specification requires taking transparent black pixels, making the edges fading transparent. This is not necessarily wanted and produces ugly results because of the clipping to the image boundaries. You just see the half of the blurring, the rest gets clipped away.
>
> I suggest adding the attribute "edgeMode" from feConvolveMatrix[1] to the feGaussianBlur element. The initial value would be 'none'. The current behavior would be preserved.
> For the CSS Image filter() function and blur(), the value would be 'duplicate'. This duplicates the pixels on the nearest edge (separated by horizontal and vertical direction) to fill the value for the sliding kernel matrix of the gaussian blur algorithm.
>
> 'Wrap', which takes the pixel color values of the opposite side, can produce reasonable results too. But just if you have a repeating image and unless you do not use properties like 'background-repeat: space' where you have spacing between single image tiles and the wrapping will look ugly.
>
> I don't think that we need to extend blur() with the  edgeMode keywords at the this point. If a different behavior is wanted, the user can switch to the SVG Filter alternative. But we have the possibility to do so later.

This sounds reasonable, and I agree that "duplicate" is the best
default for the CSS functions.  I'm fine with not allowing
customization of it for now, as it's trivial to add later if we feel
like it.

~TJ
Received on Sunday, 25 August 2013 16:57:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:46 UTC