Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

feComponentTransfer

7 views
Skip to first unread message

Adam

unread,
Aug 3, 2009, 12:08:00 AM8/3/09
to
When I use linear feComponentTransfer filter in Mozilla I do not get
behaviour according the w3c standart. For example for c = 0.5 and blue
box(blue=255 others 0) I get color blue ~ 180, but when I use
inkscape or F-spot I get color with value of b = 123, which I believe
is according the w3c. Why firefox behave so strange?

Boris Zbarsky

unread,
Aug 3, 2009, 1:15:20 AM8/3/09
to

I'm not following. For a linear feComponentTransfer, you need to
specify slope and intercept. What are you specifying for those?

-Boris

Adam

unread,
Aug 3, 2009, 2:35:43 AM8/3/09
to

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.

Boris Zbarsky

unread,
Aug 3, 2009, 10:12:48 AM8/3/09
to
Adam wrote:
> 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

Adam

unread,
Aug 5, 2009, 4:32:46 AM8/5/09
to

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.

Boris Zbarsky

unread,
Aug 5, 2009, 1:58:03 PM8/5/09
to
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

Robert O'Callahan

unread,
Aug 23, 2009, 7:35:58 PM8/23/09
to
It's a known bug in Opera and Inkscape that they don't default to
linearRGB in some situations where they should. E.g.
http://lists.w3.org/Archives/Public/www-svg/2009Jul/0099.html

Rob

0 new messages