After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 70964 - Gradient Map ignores alpha channel from source layer
Gradient Map ignores alpha channel from source layer
Status: VERIFIED FIXED
Product: GIMP
Classification: Other
Component: Plugins
1.x
Other All
: Normal normal
: ---
Assigned To: GIMP Bugs
Daniel Egger
Depends on:
Blocks:
 
 
Reported: 2002-02-08 18:30 UTC by Raphaël Quinet
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for plug-ins/common/gradmap.c (2.30 KB, patch)
2002-02-08 19:20 UTC, Raphaël Quinet
none Details | Review

Description Raphaël Quinet 2002-02-08 18:30:58 UTC
The Gradient Map plug-in (Filters->Colors->Map->Gradient Map) ignores the
alpha channel and resets it so that the layer becomes fully opaque after
applying the filter, even if it was fully transparent before.

It should preserve the alpha channel instead of resetting it.
Comment 1 Raphaël Quinet 2002-02-08 19:09:32 UTC
The following patch fixes the problem by multiplying the samples from
the gradient (which may have an alpha channel) with the previous
alpha value of the source pixel.  Previously, the source alpha was
implicitely assumed to be 100% (255), which is incorrect.
Comment 2 Raphaël Quinet 2002-02-08 19:20:53 UTC
Created attachment 6651 [details] [review]
patch for plug-ins/common/gradmap.c
Comment 3 Raphaël Quinet 2002-02-09 08:26:30 UTC
Two minor corrections:
- In my previous comment, my explanation is not correct: I wrote that
  the patch multiplies the samples from the gradient with the alpha
  value of the source layer.  Instead, I should have said that it
  multiplies the alpha value from the gradient with the one from the
  source layer.  This is what the patch does, and this is correct.
- In the patch, maybe it would be better to cast samp[b] and src[b]
  to (guint) instead of (gint).  This does not change much, but this
  is a bit cleaner and maybe even a bit more efficient.

Please apply this patch to the 1.2 branch and to HEAD.
Comment 4 Sven Neumann 2002-02-09 13:06:13 UTC
Shouldn't that be

  dest[b] = ((guint)(samp[b]) * (guint)(src[b])) / 256;

instead?
Comment 5 Sven Neumann 2002-02-10 20:27:43 UTC
My last comment was bogus. I have applied the patch (with the cast
changed to guint) to the stable and development branches.
Comment 6 Raphaël Quinet 2002-02-12 09:36:20 UTC
Fix is part of gimp-1.2.3, which has just been released.
Bug is now CLOSED.