I'm not following. For a linear feComponentTransfer, you need to
specify slope and intercept. What are you specifying for those?
-Boris
I am sorry, slope is 0.5 (that is what I called c) and intercept 0.
But the issue is that in different programs I get very different
results. In one case blue(255) is transferd to blue 180 and in thers
to blue 127 (I wrote 123, but should be 127). But I think for these
parametrs it should be 127.
Should be, yes. Can you point to a testcase showing the problem?
-Boris
it is as simpe as:
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/
Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="400px" height="150px" version="1.1" xmlns="http://
www.w3.org/2000/svg">
<desc>Gradienty</desc>
<defs>
<linearGradient id="Gradient01">
<stop offset="0%" stop-color="#000000" />
<stop offset="100%" stop-color="#0000FF" />
</linearGradient>
<filter id="test" filterUnits="objectBoundingBox" x="0%" y="0%"
width="100%" height="100%">
<feComponentTransfer>
<feFuncB type="linear" slope=".5" intercept="0.0"/>
</feComponentTransfer>
</filter>
</defs>
<rect x="20px" y="20px" width="256px" height="20px" fill="url
(#Gradient01)" filter="url(#test)" />
<rect x="20px" y="60px" width="256px" height="20px" fill="#0000ff"
filter="url(#test)" />
<rect x="20px" y="100px" width="256px" height="20px" fill="#0000ff" />
</svg>
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. Thanks for your previous responses.
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
Rob