W3C home > Mailing lists > Public > www-svg@w3.org > February 2010

Re: feConvolve matrix bias property premultiplied or not?

From: Erik Dahlstrom <ed@opera.com>
Date: Mon, 15 Feb 2010 17:26:19 +0100
To: "Jasper van de Gronde" <th.v.d.gronde@hccnet.nl>, "Robert Longson" <longsonr@gmail.com>
Cc: www-svg@w3.org
Message-ID: <op.u76fx2x5geuyw5@localhost>
On Mon, 15 Feb 2010 12:41:32 +0100, Jasper van de Gronde  
<th.v.d.gronde@hccnet.nl> wrote:

> Robert Longson wrote:
>> Jasper,
>>  What version of Firefox are you testing with. Firefox prior to version  
>> 3.6 does not process bias values correctly. Firefox 3.6 displays your  
>> testcase the same as Opera.
>
> I was still using 3.5, I've updated and now it does indeed look better  
> (at least it gets rendered). But it does surprise me. There are roughly  
> two kinds of output I would expect:
>
> 1. If you add the bias unmodified to all channels (except the alpha  
> channel in this case, as preserveAlpha=true) then you should get  
> (0.5,0.5,0.5,0.5), which is transparent white.
>
> 2. If you premultiply the bias by the resulting alpha channel you should  
> get (0.25,0.25,0.25,0.5) (which would result in the same transparent  
> gray as the other square, on a white background).
>
> There is one other option I've heard mentioned (premultiplying by  
> ResultAlpha-bias, but this makes little sense when preserveAlpha=true).
>
> So I guess I know now have even more questions :)
>   - What on earth does Firefox/Opera do with bias.
>   - Is there any reason NOT to use premultiplied bias?
> (And if so, what is the reason? If not, can we clarify the  
> specification?)

(This is a repost from what I sent to the inkscape mailinglist a long time  
ago)

Here's what Opera 10 does wrt to @bias:

- After applying the @kernelMatrix and @divisor the number in @bias will  
be added to each channel
- If @preserveAlpha is "true" then the alphachannel will not get any bias  
added

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.

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

[[
To apply bias on a pixel follow these steps:
1. For each color channel (RGB) let the 'actual bias value' be the bias  
value multiplied by (ResultAlpha(X,Y)-bias). After applying the  
kernelMatrix and divisor, add the 'actual bias value' to each component  
(RGB).
2. For the alpha channel, unless preserveAlpha is 'true', add the  
[unmodified] bias value.
]]

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 Monday, 15 February 2010 16:43:58 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT