Re: feComponentTransfer
Boris Zbarsky <[email protected]> Wed, 05 Aug 2009 13:58:03 -0400
| Newsgroups | gmane.comp.mozilla.devel.svg |
|---|---|
| Message-ID | <[email protected]> |
Adam wrote:
> <feComponentTransfer>
> <feFuncB type="linear" slope=".5" intercept="0.0"/>
> </feComponentTransfer>
Ah, I see what's going on here. Here's the relevant part of the SVG
spec (section 15.7.1):
The color space in which a particular filter primitive performs its
operations is determined by the value of property
'color-interpolation-filters' on the given filter primitive. A
different property, 'color-interpolation' determines the color space
for other color operations. Because these two properties have
different initial values ('color-interpolation-filters' has an
initial value of linearRGB whereas 'color-interpolation' has an
initial value of sRGB), in some cases to achieve certain results
(e.g., when coordinating gradient interpolation with a filtering
operation) it will be necessary to explicitly set
'color-interpolation' to linearRGB or 'color-interpolation-filters'
to sRGB on particular elements.
Given the defaults described above, to apply the filter the image has to
be converted from sRGB to linearRGB, then the filter is applied, then
the conversion back to sRGB is performed. In particular, converting
from sRGB to linearRGB, #00000ff becomes #0000ff. Converting from
linearRGB to sRGB, #00007f becomes #0000bb, which is what you're seeing.
You can affect this behavior in the way described in the spec above.
> now I have another issue concerning filters. Blending filters are not
> working properly too. e.g: http://www.w3.org/TR/SVG11/images/filters/feBlend.svg
> and I do not think that solutions given by feColorMatrix are right
> too, I get different results when I am multiplying matrices using
> pencil and paper.
Did you take the color space conversions described above into account
when doing the pencil and paper approach? ;)
-Boris