Hi,
Some days ago, Jasper van de Gronde asked me if I still got problem with negative values in feComposite. He pointed that I forgot about the alpha value (becoming zero) https://bugs.launchpad.net/inkscape/+bug/1044989
So I reworked my filters using his clever trick so that alpha won't reach 0 (except I used feColorMatrix instead of feComponentTransfer)
And once again I'm stuck. I try to redo the exclusion filter in photoshop using feComposite For two layers A (=sourceImage) and B (=backgroundImage) with opacities = 1, formula is supposed to be A+B - 2AB.
As feComposite (stupidly IMO) computes not only rgb channels but the alpha too I need to get rid of the alpha channel (either in earlier or later stages) until now I failed.
What I'd expected rgb(1,0,0.5, x) exclusion rgb(0,1,0.5, y) should be rgb(1,1,0.5, 1) r:1 + 0 - 2 (1*0) = 1 g:0 + 1 - 2 (0*1) = 1 b:0.5+0.5 - 2 (0.5*0.5) = 0.5
problem is the alpha coz 1 + 1 - 2(1*1) = 0
I tried the 2 following solutions
solution 1: dealing later with alpha => set alpha to 1 when everything is done. feComposite k=(-2;1;1;_) followed by colorMatrix 1 0 0 0 0 0 1 0 0 0 <= identity for rgb 0 0 1 0 0 0 0 0 0 1 <= reset alpha to 1.0 whatever it could've been before
this doesn't work, the result is full black
solution 2: dealing earlier with alpha => set alpha so that it is 1 and not 0 after composition (=set it to 0 before the feComposite) pass sourceimage through the following colormatrix to remove the alpha 1 0 0 0 0 0 1 0 0 0 <= identity for rgb 0 0 1 0 0 0 0 0 0 0 <= reset alpha to 0 run this + backgrounImage in feComposite k=(-2;1;1;_)
with this I'd expected the alpha to be ok because 0 + 1 - 2 (1*0) = 1.
but this doesn't work either (fully transparent ?)
Could anybody help ? How do you deal with alpha when using feComposite ? Does Inkscape (or svg) drop result of a filter stage if alpha is zero ? (in solution 1)