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 170707 - Implement Edit->Fade
Implement Edit->Fade
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal enhancement
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
: 120033 170759 (view as bug list)
Depends on:
Blocks: 74554
 
 
Reported: 2005-03-17 18:44 UTC by weskaggs
Modified: 2006-10-21 18:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
diff against HEAD implementing Edit->Fade (14.43 KB, patch)
2005-03-17 18:46 UTC, weskaggs
reviewed Details | Review
New patch using GimpDrawableUndo (11.47 KB, patch)
2006-10-20 14:16 UTC, Michael Natterer
none Details | Review
fade-dialog.c (6.58 KB, text/plain)
2006-10-20 14:17 UTC, Michael Natterer
  Details
fade-dialog.h (1008 bytes, text/plain)
2006-10-20 14:17 UTC, Michael Natterer
  Details
Add missing help ID (12.31 KB, patch)
2006-10-20 14:41 UTC, Michael Natterer
none Details | Review

Description weskaggs 2005-03-17 18:44:17 UTC
A popular feature of another image editing program is the ability to "fade" the
most recent manipulation, by creating a blend between the current state of a
layer and its previous state.  I have put together an implementation of this,
whose code is attached below.  It inserts a "Fade XXX" entry into the image Edit
menu, where XXX is the same thing shown for "Undo".  Currently all operations
that generate an undo of type GIMP_DRAWABLE_UNDO can be faded, but it should be
possible to extend it to handle paint and ink operations as well.

Selecting Edit->Fade brings up a modal dialog, whose only control is an opacity
slider.  It comes up initially with opacity 100, which corresponds to the
current state.  Lowering the opacity to 0 changes the drawable to its previous
state.  Intermediate values produce a mixture of the two.

There are a few issues worth mentioning:

1) For some reason, the function mishandles the blue channel of the background
layer of an RGB image.  I haven't yet been able to figure out why.  It gets
everything else right as far as I can tell.

2) Cancelling the fade operation leaves an entry on the Redo stack.  I need to
figure out how to remove this.

3) The current implementation acts on the whole affected drawable, even if the
undo only applies to part of the drawable.  So, it ought to be made more efficient.
Comment 1 weskaggs 2005-03-17 18:46:09 UTC
Created attachment 38860 [details] [review]
diff against HEAD implementing Edit->Fade

The important stuff is in the new file dialogs/fade-undo-dialog.c.  Everything
else is cruft and menu-handling.
Comment 2 weskaggs 2005-03-17 18:59:27 UTC
*** Bug 120033 has been marked as a duplicate of this bug. ***
Comment 3 Sven Neumann 2005-03-17 20:35:03 UTC
The important stuff should be in the core, not in app/dialogs. But it should be
easy to move the core functionality where it belongs. I'd like to get Mitch's
comment on this implementation.
Comment 4 Petter Sundlöf 2005-03-17 21:11:35 UTC
One of the cool thing about this feature in the other IMP is that it allows to
use Blend Modes (layer modes), as briefly noted in
http://bugzilla.gnome.org/show_bug.cgi?id=120033 .
Comment 5 weskaggs 2005-03-18 20:25:47 UTC
*** Bug 170759 has been marked as a duplicate of this bug. ***
Comment 6 Sven Neumann 2005-03-23 09:37:24 UTC
In order to do this properly, we would have to push the replacing pixels to the
undo stack, not only the replaced pixels. This would increase memory
requirements for the Undo stack but I think that's acceptable. If we do this, it
would also become easy to implement the undo brush requested in bug #74554.
Comment 7 weskaggs 2005-03-23 23:10:23 UTC
Well, that would be a pretty substantial change, wouldn't it?  I think it would
be pretty simple to implement gimp_image_undo_fade() in the core -- in
gimpimage-undo.c? -- with a "mode" argument, and do it that way.  Not as
elegant, but functional.  Would that be worth doing?
 
Comment 8 Michael Natterer 2005-03-24 00:46:09 UTC
I have hacked a bit on your patch, in the direction of what sven said.
Will attach the modified patch tomorrow.
Comment 9 Joao S. O. Bueno 2005-03-24 03:05:18 UTC
I won't discourage this. It is just that while thinking about how to implement 
this, I came to a different way to implement it, so I will mention my idea 
here just in case it may look more simple (#6 talks aboutmemory consuption on 
this method). 
 
basically, what I thought would require an "undo/redo" API, and be doable by a 
simple plug-in. By undo/redo API, I mean a simple libgimp/PDB call to undo the 
last action (and another to redo, but it would not be used here). 
 
The fade plug-in them would just: copy the active drawable, undo the last 
action, paste the copy as a new layer, set its opacity, and merge both new 
layer and previously active drawable. 
 
Regards! 
 
 
 
 
 
Comment 10 weskaggs 2005-06-01 15:55:08 UTC
Mitch, could you follow up on comment #8?  (If you've changed your mind, that's
fine). 
Comment 11 Sven Neumann 2005-08-18 15:50:21 UTC
Since we will want to have preview on this feature, it should probably become an
imagemap tool. But first the changes to the undo stack will have to be figured out.
Comment 12 weskaggs 2006-05-20 23:44:47 UTC
This is probably too sensitive to get into 2.4, so I am bumping the target to Future, althought that's a bit of a shame given the potential usability value of the feature.
Comment 13 weskaggs 2006-06-16 18:40:31 UTC
Upgrading target from Future to 2.6.
Comment 14 Michael Natterer 2006-10-20 14:16:42 UTC
Created attachment 75086 [details] [review]
New patch using GimpDrawableUndo

New patch allows to change opacity and paint mode, by using the
new GimpDrawableUndo.
Comment 15 Michael Natterer 2006-10-20 14:17:18 UTC
Created attachment 75087 [details]
fade-dialog.c
Comment 16 Michael Natterer 2006-10-20 14:17:52 UTC
Created attachment 75088 [details]
fade-dialog.h
Comment 17 Michael Natterer 2006-10-20 14:41:05 UTC
Created attachment 75089 [details] [review]
Add missing help ID
Comment 18 Michael Natterer 2006-10-21 18:47:00 UTC
2006-10-21  Michael Natterer  <mitch@gimp.org>

	Added "Edit -> Fade" which allows to modify the paint mode and
	opacity of the last drawable operation (fill, plugins etc.).
	Started from a patch by Bill Skaggs. Fixes bug #170707.

	* app/base/base-enums.[ch] (enum GimpLayerModeEffects): register
	the values REPLACE_MODE, ERASE_MODE and ANTI_ERASE_MODE with
	the type system.

	* app/widgets/gimppropwidgets.[ch]
	* app/widgets/gimpwidgets-constructors.[ch]: added "gboolean
	with_replace_modes" to the paint mode menu constructors.

	* app/tools/gimppaintoptions-gui.c
	* app/widgets/gimpbrushselect.c
	* app/widgets/gimplayertreeview.c: pass with_replace_modes = FALSE.

	* app/core/gimpdrawableundo.[ch]: added members which keep tiles,
	paint mode and opacity of the pasted pixels.

	* app/core/gimpimage-undo.[ch] (gimp_image_undo_get_fadeable):
	returns a GimpUndo suitable for a fade operation, or NULL.

	* app/core/gimp-edit.[ch] (gimp_edit_fade): implements the actual
	fade by undoing the last operation and then re-applying the pixels
	with different paint mode and opacity.

	* app/core/gimpdrawable-combine.c: store the pasted pixels in
	the GimpDrawableUndo.

	* app/actions/edit-actions.c
	* app/actions/edit-commands.[ch]: action and callback for fade.

	* app/dialogs/Makefile.am
	* app/dialogs/fade-dialog.[ch]: the fade dialog.

	* app/widgets/gimphelp-ids.h: the fade help ID.

	* menus/image-menu.xml.in: added a menu entry in "Edit".