GNOME Bugzilla – Bug 766116
Behind mode is not working correctly
Last modified: 2016-07-25 20:13:35 UTC
Created attachment 327450 [details] comparison between GIMP Git Master and GIMP 2.8.16 > Behind mode on painttool My DE is GNOME 3.10 Ubuntu Gnome 14.04.2 GIMP Git Master commit 46096a1 --- The behind mode is modifying the color hue when I use different opacities. Is possible only to paint in the transparent layers. I have made a comparison with GIMP 2.8.16... and is OK. Is possible in GIMP 2.8.16, also, to use the behind mode on the paint-tools in a non transparent layer. The archive show the two cases, with gimp git master and gimp 2.8.16.
See: https://git.gnome.org/browse/gimp/tree/app/operations/gimpoperationbehindmode.c#n108 The second 'value' is certainly wrong and I consider assigning to out[ALPHA], when in[ALPHA] and layer[ALPHA] are used later, another source of errors because specially in the painting code it is possible that 'in' or 'layer' are the same buffer as 'out'. Will test in the next days, unless someone fixes it sooner
Created attachment 327573 [details] [review] fix behind mode operation The attached patch should fix this problem. If there are no objections, I'll push it later
Review of attachment 327573 [details] [review]: well that patch is wrong, it seems to fix painting on a transparent layer, but not on a opaque. Sorry
> The behind mode is modifying the color hue when I use different opacities. > Is possible only to paint in the transparent layers. I have made a > comparison with GIMP 2.8.16... and is OK. Is possible in GIMP 2.8.16, also, > to use the behind mode on the paint-tools in a non transparent layer. The > archive show the two cases, with gimp git master and gimp 2.8.16. Apparently there is an inconsistency also in gimp-2.8 because if I add the alpha channel to the background layer, painting on a white background (opaque but with alpha channel) results in white (so no visible effect). Removing the alpha channel instead results in the pencil color.
> Apparently there is an inconsistency also in gimp-2.8 because > if I add the alpha channel to the background layer, painting > on a white background (opaque but with alpha channel) results in > white (so no visible effect). Removing the alpha channel instead > results in the pencil color. Yes, correct! I have this test and is very strange. --- Around the color variations I have a short test between GIMP stable (2.8.16) and GIMP 2.9.3 focused on the colour values. We have a great difference between the values of 2.8.16 to 2.9.3. See my .xcf in attachment.
Created attachment 327627 [details] Variations colours with behind mode with opacity 50%
Created attachment 327653 [details] [review] fix behind mode operation This is a patch fixing the issues reported earlier, written to look as much as possible similar to: https://git.gnome.org/browse/gimp/tree/app/paint-funcs/paint-funcs.c?h=gimp-2-8#n1211 I think that gimp-2.8 behavior on opaque layers without alpha channel is a wrong optimization: painting 'behind' an opaque object is a nop, not equal to normal.
(In reply to Massimo from comment #7) > Created attachment 327653 [details] [review] [review] > fix behind mode operation > I'm going to test again tomorrow this patch and if I don't find errors, weird things, I'll push it. As I said I think that gimp-2.8 behind mode is wrong painting on opaque layers and it is quite too rarely used and the code complex to deserve a fix. Anyway I'm not going to fix it.
I've pushed a slightly modified patch. commit 3a43478fdadd3fb2285caa3fca94ddc48e6688b6 Author: Massimo Valentini <mvalentini@src.gnome.org> Date: Tue May 17 19:56:39 2016 +0200 Bug 766116: Behind mode is not working correctly use same var names as gimp-2-8 to make it easier to spot unwanted differences I'm leaving the bug open because the behavior is not the same as in gimp-2.8, but it seems to me that it is a bug in gimp-2.8.
I think we can safely close this because this change cannot affect loaded 2.8 XCF files (behind cannot be used as layer mode). Unless you have something to add?
(In reply to Michael Natterer from comment #10) > I think we can safely close this because this change cannot affect > loaded 2.8 XCF files (behind cannot be used as layer mode). > > Unless you have something to add? The bug here is that, in gimp-2-8, painting with behind mode works differently whether an opaque layer has or not the alpha channel. I think it is a wrong optimization choice: painting behind a layer without alpha channel (so opaque) is a nop and not equivalent to normal mode. But the code in gimp-2-8 is quite complex and I don't think is worth fixing. You can achieve nop by simply not painting. I left it open to mean it is a known issue. When gimp-2-8 is no more the stable version it is reasonable to close this as obsolete or wontfix. Obviously it is possible to close it now
Let's just get rid of the bug and let 2.8 rot in stability.