Re: feConvolve matrix bias property premultiplied or not?

Erik Dahlstrom wrote:
> It's agreed that this is probably not what one wants. Considering that 
> @bias is probably not that widely used at the moment we should try to 
> make it clear in the spec and make @bias useful.

Agreed.

> How about changing the spec to say something like the following for the 
> application of @bias:
> ...

Since no one has started screaming that it's a terribly bad idea to use 
premultiplied bias values I guess it should be okay to do something like 
this :) For reference, the pseudo-code in the SVG specification suggests 
the following (preserveAlpha=false):
-------------------------------------
Option 1:
   aF = filtered alpha without bias
   cF = filtered (premultiplied) color without bias
   aR = aF + bias
   cR = cF + bias
-------------------------------------

I previously suggested:
-------------------------------------
Option 2:
   cR = cF + bias*aR
-------------------------------------

You seem to suggest:
-------------------------------------
Option 3:
   cR = cF + bias*(aR-bias)
-------------------------------------
I'm not sure what the advantage of this would be though. For example, if 
you have a uniformly colored shape (opacity also uniform) and apply the 
filter -1 1 (with bias=0.5) I would expect a response of 
(0.25,0.25,0.25,0.5), and not (0,0,0,0.5).

Another option would be to do an explicit conversion from and to 
premultiplied colors:
-------------------------------------
Option 4:
   cR = (cF/aF + bias)*aR
-------------------------------------
Conceptually this might be cleaner, but it does have the disadvantage of 
needing a division. Specifically, what color should result if aF=0?

Received on Tuesday, 16 February 2010 14:06:43 UTC