Hi,
This is the official response of the SVG WG. For as long as I can
remember the filters have always behaved this way. The filters in SVG
are a stack of images which can be composited using simple Porter and
Duff operators. Any operation that requires background removal changes
the filters compositing model from basic Porter Duff operations to
Blending operations (or Blend modes).
MenTaLguY wrote:
> Hello,
>
> I've run up against a problem with filters and the use of
> BackgroundImage in SVG 1.1: the filter output is alpha-composited with
> the background, which results in double-compositing if the filter itself
> composites with the background (e.g. when using feBlend to get "blend
> modes"). This is noticable in areas of the background which are
> semi-transparent, which may be due to transparent objects, or simply
> antialiasing.
>
You are correct it does result in a double-composite. In your example,
as you point out, it is due to the first ellipse being semi-transparent.
Obviously this only occurs with semi-transparent objects.
> See here for an illustration of the problem:
>
> http://www.rydia.net/~mental/www-svg/background-image-alpha-issue.svg
> http://www.rydia.net/~mental/www-svg/background-image-alpha-issue.png
>
> Is there a way to work around this? Ideally there would be some way for
> filter output to replace part of the accumulated image rather than being
> composited with it.
>
Unfortunately, we cannot make normative changes to the SVG 1.1
specification that would change conformance criteria. But the good news
is I have a few suggestions that may help solve your problem:
- Place a group around the objects and set
enable-background="accumulate". The downside to this is you may not want
the accumulated background underneath. Also if the accumulated
background is transparent you'll probably run into this effect anyway.
- Place down a white opaque white background as you have done in your
example. The downside to this is you'll get the opposite problem to the
first solution. The background underneath will not affect the
compositing for the area where the opaque white was placed.
- Add an "in" attribute to feBlend and set it to in="BackgroundAlhpa".
This will eliminate the effect caused by the transparent background and
produce the desired output.
The working group recognizes the problem you've raised, and in response,
we are strongly considering adding a new compositing filter to the SVG
1.2 Filters module.
We hope this response addresses your issue. If not, we are happy to
consider any other suggestions you may have. Thanks.
Kind Regards,
Anthony Grasso
> -mental