New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[filter-effects-1] Clarify equivalent markup for filter functions #5704
Comments
I'd like to add a Is there still a chance to fix those color filter functions? |
Yes, clearly all filter examples should state if they depend on a non-initial value of |
In general, the fact that the predefined filters work on gamma-encoded space is an unfortunate bug which probably can't be changed now for Web compat, but should never have arisen in the first place. SVG makes the default filter processing linear-light for a reason. |
This parameter can just be included in the svg examples: <filter id="saturate" color-interpolation-filters="sRGB">
<feColorMatrix type="saturate" values="[amount]"/>
</filter> |
Yesterday I found out, that this is currently not the case in Chromium browsers (at least for |
In general the descriptions of the predefined filters are under-specified and under-tested. |
// https://.../filter.html
<svg viewBox="0 0 100 100" color-interpolation-filters="sRGB">
<defs>
<filter id="filter">
<feColorMatrix type="saturate" values="0.5" />
</filter>
<rect id="object" width="40%" height="40%" fill="red" />
</defs>
<use id="a" href="#object" filter="url(#filter)" />
<use id="b" href="#object" x="50%" style="filter: url(#filter);" />
<use id="c" href="#object" y="50%" filter="url(https://.../filter.svg#filter)" />
<use id="d" href="#object" x="50%" y="50%" style="filter: url(https://.../filter.svg#filter);" />
</svg>
// https://.../filter.svg
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<filter id="filter">
<feColorMatrix type="saturate" values="0.5" />
</filter>
<rect id="object" width="40%" height="40%" fill="red" />
</svg> In Chrome v88, I'm seeing Related issue SVG (filter | fill | stroke | clip-path | mask | marker-*) from external files not applied: https://bugs.chromium.org/p/chromium/issues/detail?id=109212 |
OK, that is correct. |
Hmm, I meant something different, where you use Here's a demo/test: https://pepkin88.me/link/chromium-filter-bug/ |
Oh ok. I can see the same results as with your pngs in Chrome v88, which means it supports referencing a filter from an external file via a CSS property applied on a HTML (vs. a SVG element) and as you correctly pointed out, it incorrectly uses |
Worth mentioning that at https://wiki.csswg.org/ideas/mistakes? Sebastian |
It's not really a design mistake - more that the definition of the predefined filters was too terse. It was written by SVG people with one set of assumptions, and interpreted by HTML people wit different sets of assumptions and less computer graphics background. |
Hello,
From the definition of
saturate()
:The related markup:
But the result of this markup, will be different than
saturate(amount)
if the root<svg>
doesn't setcolor-interpolation-filters
tosRGB
(default tolinearRGB
).I suggest the following change (as well as for some/all of the other filter functions):
Side note: for the reasons why they are not equivalent by default (which can be questionable), see #3131.
The text was updated successfully, but these errors were encountered: