feComponentTransfer - Table in alpha on a white object is rendered incorrectly
Steps to reproduce:
- Open Inkscape
- Draw a large blue rectangle (this one merely aids in visibility of the problem).
- Draw a 100x100px white rectangle on top of the previous rectangle.
- Give the white rectangle a linear gradient fill, going from transparent white to opaque white.
- Give this rectangle a new filter.
- Add Component Transfer to the filter.
- In Component Transfer's settings, set Alpha to Table, and set the table value to "0 0 1".
What happened?
The pixels of the rectangle with the lowest alpha (the bottom 50%) will have turned solid white. The other pixels are correctly interpolated.
What should have happened?
The pixels of the rectangle with the lowest alpha (the bottom 50%) should have turned completely transparent. The other pixels are correctly interpolated.
Notes:
- The problem does not happen if the rectangle is black. The lighter the color used, the more prominent the problem becomes.
- The problem does not happen if you export the wrongly-rendered object as a PNG alone (i.e. without the blue rectangle in the reproduction steps). You may need to open the exported PNG with the likes of GIMP and add a dark background layer in order to see that it got rendered correctly.
- If you replace "0 0 1" with "0 * 1", with the asterisk being a value between 0 and 0.25, you will see the broken cut-off getting closer to the middle the closer to 0 you are. Similarly, using "0.01 0.01 1" is the closest to the intended result I could find, making it a possible workaround (though not perfect).
- If the gradient's endpoints are inside of the rectangle, (i.e. they are not sitting at the edges), the endpoint with 0 alpha will have everything beyond it be completely transparent, in harsh contrast with the glitchy full white opacity. This too does not happen when the rectangle is black.
- This problem also happens if you start with any shape of any color, then use Component Transfer to recolor the object white.
- The problem also happens with Discrete mode.
Example:
This SVG file contains a reproduction of the steps. It renders fine in Firefox 56 (i.e. the left half of the center square is transparent and the right half is interpolating). In Inkscape 0.92, it will be as described in the "What happened?" section.
The following is how it looks in Inkscape (and also if you export it as a PNG in its entirety; see Notes):
Inkscape Version and Operating System:
- Inkscape Version: 0.92
- Operating System: Lubuntu
- Operating System version: 4.4.0-170 64-bit