Re: ordering of effects with enable-background:new and filter on the same element

Hello Rob,

On Thu, 05 Jun 2008 11:02:28 +0200, Robert O'Callahan <robert@ocallahan.org> wrote:

> Thanks. I think I know how it's supposed to work. But the spec explicitly
> says that enable-background:new on the filtered element E will make E be the
> root of the background construction, which means Opera's rendering is wrong,
> per spec.

'enable-background' has no effect on anything but container elements. If you need the graphical element that has the filter property on it as an input image, just use any of SourceGraphic, SourceAlpha, FillPaint or StrokePaint.

Spec says:
"(Note that for the case of A0=E, the graphical contents of E are not rendered into BUF1 and thus are not part of the background image available to E. Instead, the graphical contents of E are available via the SourceGraphic and SourceAlpha pseudo input images.)"

In your particular testcase you'd get:

Assumption: n = the number of ancestors, not including the element A0 (this is not clear from the spec, so should probably be clarified).

- n = 1
- A0 = the rect with the filter on it
- A1 = the root svg element
- Spec: "For each Ai (from i=n to 1), initialize BUFi to transparent black. Render all children of Ai up to but not including Ai-1 into BUFi."
  So BUF1 contains a rendering of the lime rect only, since A0 must not be rendered.
- Spec: "Then, for each Ai (from i=1 to n-1), composite BUFi into BUFi+1."
  Since there is no BUF0 this makes no sense to me. There should be a condition that n>2 here.
- Spec: "The accumulated result (i.e., BUFn) represents the background image available to E."
  BUF1 is the result.

Then the filter is applied on the second rect, and according to batik you were missing the required in2 parameter on feComposite. When I added in2="black" batik 1.7 produced the same result as Opera. In SVG Filters 1.2 the lacuna value of 'in2' will be the previous filter primitive, and in general there will be as few required attributes as possible.

I agree that the description of how to generate the background image is not the easiest read there is, and it might be an idea to try and express it in a more intuitive manner.

Cheers
/Erik

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

Received on Thursday, 5 June 2008 15:31:19 UTC