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 140974 - No preview for unsharp mask
No preview for unsharp mask
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: Normal enhancement
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
: 141810 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-04-23 20:11 UTC by geert jordaens
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2


Attachments
Patch adds a preview window to the unsharp plug-in. (10.52 KB, patch)
2004-04-23 20:13 UTC, geert jordaens
needs-work Details | Review
Updated patch for unsharp plugin (14.89 KB, patch)
2004-05-05 19:51 UTC, geert jordaens
none Details | Review
Patch is first attempt to add preview for blur plugin (16.70 KB, patch)
2004-05-05 19:53 UTC, geert jordaens
none Details | Review
patch from preview windoww (15.33 KB, patch)
2004-05-10 15:05 UTC, geert jordaens
none Details | Review
updated patch (16.37 KB, patch)
2004-05-10 18:04 UTC, geert jordaens
none Details | Review
Preview window for blur plugin (same principle as for unsharp plugin) (17.15 KB, patch)
2004-05-10 20:03 UTC, geert jordaens
none Details | Review

Description geert jordaens 2004-04-23 20:11:43 UTC
The unsharp mask is a time consuming task. 
The lack of a preview makes in less usefull.
Comment 1 geert jordaens 2004-04-23 20:13:59 UTC
Created attachment 27028 [details] [review]
Patch adds a preview window to the unsharp plug-in.
Comment 2 weskaggs 2004-04-23 21:33:01 UTC
Geert:  I tried your patch, and I think it is a great improvement to the
plug-in.    There is a change you could make that I think would make it even
better, though.  This is unfortunately a rather slow plug-in, particularly if
the radius is large, so I think it would be better to have an "update" button
for the user to press in order to update the preview, rather than having it
update continuously.  You could also, if you like, have a check box for "update
continuously" that would produce the current behavior if the user wants it.

There are two issues I see with the coding, one minor and one major.  The minor
one is that you have introduced a bunch of new global variables, which is not
good coding practice.  The major one is that you have used the GtkPreview
widget, which is deprecated and ought not to be used in new code.  It might not
be worth changing this, though, since Gimp is likely to have its own preview
widget in the not-too-distant future.

I need to add that I am not a member of the Gimp development team, just somebody
who is interested, so you should not take my suggestions as having any authority
or predicting what others will say.
Comment 3 geert jordaens 2004-04-24 18:19:45 UTC
issue 1: Agree with the global variables, this was a quick fix.
First time I ever looked at gimp code and over 5 that I've looked at any C code.

issue 2: Is there a reference implementation for the new preview?
If there exists some doc or reference impelementation I'would like to try and
modify the plug-in.

>...There is a change you could make ...it would be better to have an "update"
>button ... rather than having it update continuously.

I'd prefer to set the policy of the radius/amount/treshold to update delayed.
However it seems that it's not that easy as for the preview scrollbars.
Any sugesstions how to set the update policy on objects created via
gimp_scale_entry_new
Comment 4 weskaggs 2004-04-24 22:22:56 UTC
There are macros (listed in the API docs) that let you access the components of
the scale entry:  I think GIMP_SCALE_ENTRY_SCALE (adj) is the one you want, but
it might be  GIMP_SCALE_ENTRY_SCALE_ADJ (adj). 

You can find the discussion of preview widgets in the Gimp Developer's List
archive; a good place to begin might be:
http://www.mail-archive.com/gimp-developer@lists.xcf.berkeley.edu/msg06115.html
Comment 5 Sven Neumann 2004-05-04 12:13:55 UTC
See also bug #52374.
Comment 6 Sven Neumann 2004-05-04 12:14:12 UTC
*** Bug 141810 has been marked as a duplicate of this bug. ***
Comment 7 Sven Neumann 2004-05-04 12:16:34 UTC
BTW, it's perfectly fine to continue to use GtkPreview. At least until we can
provide a reasonable replacement. There was actually no good reason for
deprecating GtkPreview and IMHO it's OK to continue using it.
Comment 8 geert jordaens 2004-05-04 13:15:07 UTC
... I've been struggling with the GdkDrawing area to replace the GtkPreview.
Perhaps it's enough to make change the update policy of the 
radius/threshold/amount sliders to UPDATE_DELAYED. 
Comment 9 geert jordaens 2004-05-04 13:30:34 UTC
At the moment the patch only unsharpens the displayed part of the buffer.
Perhaps rendering the whole buffer and scrolling trough it would be better 
(less speedy). 

Having the whole image in the unsharpen preview area (as suggested in bug 
report 141810) is only a good idea if the image can be displayed unscaled.
It makes no sense to apply a unsharp mask before scaling the image to it's 
final size as scaling modifies the effect. IOW a unsharp mask should only be 
applied after the final size of a photo/image is determined. 
Comment 10 Sven Neumann 2004-05-04 13:37:37 UTC
It would be nice to have an updated patch attached to this report. Don't worry
if it uses GtkPreview.
Comment 11 geert jordaens 2004-05-05 19:51:08 UTC
Created attachment 27408 [details] [review]
Updated patch for unsharp plugin

Changes to previous version :

- Whole selection is redered (slow) to buffer.
- Preview area allows scrolling through whole buffer window without rendering.
Comment 12 geert jordaens 2004-05-05 19:53:31 UTC
Created attachment 27409 [details] [review]
Patch is first attempt to add preview for blur plugin

First attempt, some what annoying with a large repeat count.
Maybe a button that triggers the preview update instead of the value chaged
signals could solve this.

any other suggestions.
Comment 13 geert jordaens 2004-05-10 15:05:06 UTC
New patch available thet renders the preview on a buffer.
The buffer depends on the radius size.
Comment 14 geert jordaens 2004-05-10 15:05:50 UTC
Created attachment 27548 [details] [review]
patch from preview windoww
Comment 15 Sven Neumann 2004-05-10 17:15:22 UTC
A couple of comments:

- What does gimp_get_data ("plug_in_unsharp_mask", &unsharp_params) do in the
  preview_params() function? I guess you want to pass the parameter struct to
  the preview function instead.
- You don't need the callback functions you introduce at the bottom. Simply
  connect to the standard callbacks as provided by libgimpwidgets and do
  additionally connect all controls that invalidate the preview to
  preview_update().
- Please try to adhere to the GIMP coding style. That will reduce the amount
  of work that I will have to put into this when applying the patch.
- You cannot declare variables in the middle of a scope. That's a C99 feature
  and we don't depend on that (nor do we like this style).
Comment 16 geert jordaens 2004-05-10 18:04:33 UTC
Created attachment 27560 [details] [review]
updated patch

modified as suggested in comment :

- no call to gimp_get_data for unsharp_params
- removed callback functions and repplaced with connact_after.
- Gimp coding style : changed (I think I've got that part right)
- Declaration C99 style : changed 

please have some patience I'm learning.
Comment 17 Sven Neumann 2004-05-10 18:18:14 UTC
Thanks for the update. I will look into applying this later.
Comment 18 geert jordaens 2004-05-10 20:03:26 UTC
Created attachment 27565 [details] [review]
Preview window for blur plugin (same principle as for unsharp plugin)

Did the same for blur as for unsharp
Comment 19 Sven Neumann 2004-05-10 21:05:09 UTC
Please open a separate bug report for the blur plug-in.
Comment 20 geert jordaens 2004-05-11 06:34:21 UTC
Comment on attachment 27565 [details] [review]
Preview window for blur plugin (same principle as for unsharp plugin)

Created new bug report : 142318
Comment 21 Sven Neumann 2004-05-17 09:56:17 UTC
I would have applied this patch by now but Federico picked it up and said he
wanted to improve it further.
Comment 22 Sven Neumann 2004-06-05 17:15:02 UTC
Geert, I'd appreciate if you could have a look at the modifications I did and
could apply them to your patch for the blur plug-in.

Applied to the HEAD branch:

2004-06-05  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/unsharp.c: applied a modified patch from Geert
	Jordaens that adds a preview to the Unsharp Mask plug-in. Fixes
	bug #140974.