WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
105776
feComponentTransfer linear gives wrong values
https://bugs.webkit.org/show_bug.cgi?id=105776
Summary
feComponentTransfer linear gives wrong values
Bob Wyttenbach
Reported
2012-12-26 15:02:56 PST
The SVG feComponentTransfer linear function doesn't work as expected. A slope of -1 and intercept of 1 applied to a grayscale image should invert the image: black -> white, white-> black, 25% gray -> 75% gray, 50% gray unchanged, and so on.
http://www.w3.org/TR/filter-effects/#feComponentTransferElement
says "C' = slope * C + intercept" where "C is the initial component (e.g., ‘feFuncR’), C' is the remapped component; both in the closed interval [0,1]." Thus slope -1 intercept 1 should applied to C=0.5 should give 0.5. The following filter <filter id="linear"> <feComponentTransfer> <feFuncR type="linear" slope="-1" intercept="1" /> <feFuncG type="linear" slope="-1" intercept="1" /> <feFuncB type="linear" slope="-1" intercept="1" /> </feComponentTransfer> </filter> maps black to white and white to black, but intermediate values are off, e.g. 50% gray maps to 90% gray and 75% gray maps to 98% gray. See
http://jsfiddle.net/Rpjs2/
for a simple example.
http://src.chromium.org/chrome/branches/WebKit/195/LayoutTests/svg/custom/feComponentTransfer-Linear.svg
shows another example in which the "invert" example is significantly shifted to the lighter end of the spectrum. Tested in Safari (WebKit 536.26.17) and Chrome (WebKit 537.11) with same results.
Attachments
Add attachment
proposed patch, testcase, etc.
Robert Longson
Comment 1
2012-12-27 06:38:08 PST
It gives the right results. It's operating in the linearRGB colour space and you're expecting it to operate in sRGB. You can use color-interpolation-filters to change this per
http://www.w3.org/TR/SVG/painting.html#ColorInterpolationFiltersProperty
I'm afraid this bug is invalid.
Dirk Schulze
Comment 2
2012-12-27 20:06:45 PST
(In reply to
comment #1
)
> It gives the right results. It's operating in the linearRGB colour space and you're expecting it to operate in sRGB. You can use color-interpolation-filters to change this per
http://www.w3.org/TR/SVG/painting.html#ColorInterpolationFiltersProperty
> > I'm afraid this bug is invalid.
Thanks for investigating Robert. Closing bug now.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug