Bug 395036 - Anomalous behavior of color dodge blending mode and parallel blending mode
Summary: Anomalous behavior of color dodge blending mode and parallel blending mode
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: investigated, triaged
Depends on:
Blocks:
 
Reported: 2018-06-05 03:20 UTC by reptillia39
Modified: 2019-03-12 18:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot of the Issue (149.97 KB, image/png)
2018-09-15 17:54 UTC, S-Paliwal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description reptillia39 2018-06-05 03:20:17 UTC
There is a bug where if one of the pixel has 0, and the other layer with blending mode has completely white color, then you would be able to see ZX Spectrum colors (every colors that contains only 1 or 0 in each of the channel) in places where they shouldn't appear. 

To demonstrate, just take a look at the screenshot - https://i.imgur.com/1PEMfgf.png

To replicate this bug with sample images

Use this as the blend layer - https://www.getpaint.net/doc/latest/images/layerswindow/appleoriginal.png

Use this as the layer below the blend layer - https://www.getpaint.net/doc/latest/images/layerswindow/seattleoriginal.png

Just change the blend layer blending mode to Color Dodge, and you should see ZX Spectrum colors. The same bug appears in Parallel blending mode.
Comment 1 reptillia39 2018-06-05 04:29:02 UTC
There is a way to fix this, but it will involve having to add a 1 in at least one of the channel to avoid the ZX Spectrum bug. Right now, the only workaround is to change the left color adjustment to 1,1 and add a middle point where the middle part of the color adjustment graph is. That way, the bug is eliminated altogether. Another way I can see the bug eliminated is not to consider 0 as 0 in the blending mode, but close to 0 so that the end result will have 0 in one of the channel without the ZX Spectrum issue. Essentially a override, and to clamp it.

0 means one of the channel is 0 in every part of this bug report.
Comment 2 S-Paliwal 2018-09-15 17:54:46 UTC
Created attachment 114980 [details]
Screenshot of the Issue
Comment 3 S-Paliwal 2018-09-15 17:59:39 UTC
As evidenced by the screenshot I attached, the issue seems to be still present and can be reproduced with the sample images provided by the reporter.

The bug was tested on an Arch Linux installation with the following software versions: 
Application Version: 4.2.0 (Pre-alpha; Nightly version)
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.1
Comment 4 reptillia39 2018-09-16 00:38:23 UTC
I have already fixed the bug with parallel mode, and color dodge with my blending modes patch. While there will always be ZX spectrum bug with blending modes in general because of conditions returning into another value, at least the one in my patch puts in the correct order making the blending modes follow the standard approach which works often.
Comment 5 reptillia39 2019-03-12 18:15:22 UTC
Fixed with the blend mode patch. They work as expected.