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 143315 - Turning off alpha channel visibility should make alpha=255
Turning off alpha channel visibility should make alpha=255
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
: 595851 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-05-28 00:27 UTC by Philip L
Modified: 2012-10-07 20:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A Patch that seems to fix the problem (1.54 KB, patch)
2005-02-09 20:22 UTC, Shlomi Fish
none Details | Review
A Patch against CVS head that now also resolves what Bill reported (2.33 KB, patch)
2005-02-11 11:00 UTC, Shlomi Fish
none Details | Review
XCF image showing a problem (2.09 KB, image/x-xcf)
2005-03-05 01:25 UTC, Sven Neumann
  Details
A Patch against CVS head that now also resolves what Sven reported (4.02 KB, patch)
2005-03-06 14:10 UTC, Shlomi Fish
committed Details | Review

Description Philip L 2004-05-28 00:27:27 UTC
Someone mentioned this on IRC but didn't file a report. Currently when the alpha
channel is turned off, the image goes away (0 opacity). It should instead give
all pixels full opacity.

(I'm not sure if this is a bug or an enhancement, but currently the alpha
visibility toggle is pretty useless.)
Comment 1 weskaggs 2004-05-28 15:28:55 UTC
Same thing happens in 2.0.1.
Comment 2 Michael Natterer 2004-06-14 16:01:06 UTC
That's indeed a very old bug that needs to be fixed.
Comment 3 weskaggs 2004-06-14 23:07:06 UTC
Well, this will be quite a nasty one.  The relevant code is in
paint-funcs/paint-funcs-generic.h, in several functions that take an argument
called "affect" which is a boolean array determining which channels are
affected.  It looks like fixes would be needed in a number of spots there.
Comment 4 Sven Neumann 2004-10-29 23:41:12 UTC
In the absence of someone actively working on this one, it doesn't make sense to
keep it on the 2.2 milestone. Bumping to Future.
Comment 5 Shlomi Fish 2005-02-09 20:22:44 UTC
Created attachment 37264 [details] [review]
A Patch that seems to fix the problem

This is a patch that seems to fix the problem. It changes the functions that
Bill Skaggs pointed to, and does what seemed right to me. I tested it and it
seems to be working pretty nicely, from what I've tried.
Comment 6 weskaggs 2005-02-09 20:54:35 UTC
A bit of testing -- the patch seems to do the right thing when there is just a
single visible layer.  When there are multiple layers, though, it would be
expected to make the top layer opaque, and it doesn't.
Comment 7 Shlomi Fish 2005-02-10 13:58:09 UTC
SHLOMIF->BILL-SKAGGS: yes, I can reproduce the behaviour. I tried to trace the
problem and it seems to be a problem in the combine_sub_region() function in
app/paint-funcs/paint-funcs.c. My problem right now is that, for the life of me,
I cannot find where this function renders the pixels in dest that belong to the
 non-alpha channels.

I'll try to work on it a bit more.
Comment 8 weskaggs 2005-02-10 17:39:34 UTC
I also wonder whether you shouldn't be setting the opacity to 100 instead of
just removing the lines that set it to 0 -- but I haven't yet looked for
problems this might cause.
Comment 9 Shlomi Fish 2005-02-11 11:00:57 UTC
Created attachment 37331 [details] [review]
A Patch against CVS head that now also resolves what Bill reported

This is a patch against CVS head that corrects the full transperency problem
and also corrects what Bill Skaggs reported (that it doesn't make the top layer
opaque). I did not fully tested it on all the configurations in
combine_sub_region() (some of which don't make use of the macro I modified).

I only have a vague understanding what I did, but I'm sure that if
affect[alpha] is TRUE, the original behaviour is preserved.
Comment 10 Sven Neumann 2005-03-05 01:24:03 UTC
Seems to work rather well but I found a corner case which doesn't seem to be
handled correctly. Please load the XCF that I will attach and turn off alpha
channel visibility. You should notice that the top layer doesn't become
completely transparent.
Comment 11 Sven Neumann 2005-03-05 01:25:53 UTC
Created attachment 38281 [details]
XCF image showing a problem
Comment 12 weskaggs 2005-03-05 15:32:10 UTC
Noting that the current behavior is totally and absolutely useless (turning off
the alpha channel gives a completely transparent image no matter what), it might
be reasonable to let Shlomi commit his changes and work on issues within cvs. 
This would prevent things from bitrotting or getting lost.
Comment 13 Sven Neumann 2005-03-05 16:58:47 UTC
That's Shlomi's decision; iirc he has CVS write access.
Comment 14 Shlomi Fish 2005-03-06 14:10:11 UTC
Created attachment 38328 [details] [review]
A Patch against CVS head that now also resolves what Sven reported

This is an updated patch against CVS head that also resolves what Sven
reported.
Comment 15 Shlomi Fish 2005-03-15 20:04:16 UTC
Comment on attachment 38328 [details] [review]
A Patch against CVS head that now also resolves what Sven reported

OK, per Bill Skaggs' request, I commited this patch to the CVS. This is so we
can get as much input as possible on this patch, and problems user encounter
with it.
Comment 16 weskaggs 2005-03-15 20:31:27 UTC
Works nicely for the things I have tried.  So, let's call it FIXED unless there
is some reason to think otherwise.
Comment 17 weskaggs 2005-10-18 20:50:44 UTC
For purposes of cross-reference, note that bug #307213 seems to have been caused
by the changes made here.
Comment 18 Michael Natterer 2005-11-09 01:30:06 UTC
I think this change was made in the wrong place. It should only
affect projection code, but was done in a place which modifies
image data and is used for much more that just projection
compisiting.

It should IMHO be reverted and fixed differently.
Comment 19 Michael Natterer 2005-11-09 09:56:42 UTC
Reverted the patch:

2005-11-09  Michael Natterer  <mitch@gimp.org>

	* app/paint-funcs/paint-funcs-generic.h
	* app/paint-funcs/paint-funcs.c: reverted patch which makes
	alpha=255 when turned off because these functions are not only
	used for display projection. Re-opens bug #143315.
	Fixes bug #307213.
Comment 20 Michael Hoelzen 2005-11-16 13:46:50 UTC
well, hopefully the following belongs to here:
make a selection not with the rectangular tool (elliptic, lasso, color...)
copy this selection to a new image.
in this new image switch off the alpha-channel.
what you get is a rectangular image in the bounds 
of the selection you've made in the source image.
this is new to 2.3.5. it doesn't happen in 2.2.8.
Comment 21 Sven Neumann 2005-11-19 11:43:17 UTC
Nope, this comment doesn't belong here because the change in the 2.3 tree has
been reverted in the meantime. Please ignore comment #20.
Comment 22 weskaggs 2006-05-19 16:36:51 UTC
Bumping target to "Future" because 2.4 is approaching, and any change that solves this issue is going to be very intrusive and require quite a bit of testing.
Comment 23 Michael Schumacher 2009-09-21 19:17:37 UTC
*** Bug 595851 has been marked as a duplicate of this bug. ***
Comment 24 Michael Natterer 2012-10-07 20:38:21 UTC
Fixed in master:

commit d169244955128e1fd5eeeebc2797e4677c1a2135
Author: Michael Natterer <mitch@gimp.org>
Date:   Sun Oct 7 22:36:42 2012 +0200

    Bug 143315 - Turning off alpha channel visibility should make alpha=255
    
    When the alpha channel is "invisible", make it 1.0 not 0.0.

 app/operations/gimpoperationmaskcomponents.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)