- From: Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
- Date: Wed, 23 Jun 2010 09:54:36 +0200
- To: "www-svg@w3.org" <www-svg@w3.org>
I would really like the bias property clarified in SVG 1.1 SE. The problem with the current explanation is that it seems to be contradictory (and if you take the most explicit explanation, frankly not that useful). In the explanation of the property it is said to be intended to have (as one possibility) a gray zero response. However, in the basic convolution formula the bias is added directly to the premultiplied color values. If you follow this definition the bias property does not give you any effective control over the zero response! Depending on the alpha component a bias of 0.5 could be anything from out-of-range white to 0.5 gray. We've discussed this problem before and the last post in that thread that I could find was by me (on Nabble, as my laptop, with a lot of my e-mails is being serviced) and summarized the progress as follows: <quote> 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? </quote>
Received on Wednesday, 23 June 2010 07:55:06 UTC