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 86279 - Rectangle selection could have "Round corners" as an alternative to "Feather"
Rectangle selection could have "Round corners" as an alternative to "Feather"
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
git master
Other All
: Normal enhancement
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2002-06-23 19:38 UTC by Tuomas Kuosmanen
Modified: 2006-10-18 18:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch preview (34.67 KB, patch)
2006-10-16 10:28 UTC, Martin Nordholts
none Details | Review
Patch with full antialias support (37.55 KB, patch)
2006-10-18 09:47 UTC, Martin Nordholts
none Details | Review
Previous patch with primary feedback applied (37.54 KB, patch)
2006-10-18 10:50 UTC, Martin Nordholts
committed Details | Review

Description Tuomas Kuosmanen 2002-06-23 19:38:30 UTC
A lot of times one needs to do rounded selections. Currently there are 3
ways to do it in the Gimp:

   1. Use guides to align 4 circular selections inside a rectangle and connect
   them with rectangular selections. Tough and time consuming,  but gives
good results.

   2. Use rectangular selection and do "Select -> Round" (requires gimp-perl,
   and it seems gimp-perl is not ported for gimp CVS (yet? won't at all?))

   3. Use the script-fu->Selection->Round selection script. This works too,
but it is a
   bit buggy (you need to cut out a line of pixels from right and bottom edges)

   4. Do a feathered selection and later sharpen it.

The scripts also have quite inaccurate ways to define the rounded corner
size. Of course there is the 4th way - if you have a super steady hand,
Real Men just pick a suitable brush, and draw a perfect rounded rectangle.
Piece of cake!

In reality all the above are a bit hard to use though. Hence here's my
proposal. We could implement a way to do rounded selections, and hook it as
an alternative mode to Feather. Feathered selections are already rounded,
so one never needs to feather *and* round corners, so it could work like
this on the UI:

.--- Rect Select Options -------- -- -  -
| (the mode stuff - imho should be removed btw)
| [x] Antialiasing
|.- [x] [Round corners = ] -------------- -- -  -    <- select either
"round corners" or "feather"
|| Radius: [=====(_)==] [ 8] pixels
||
|| etc..
|

What do you think?
Comment 1 Tuomas Kuosmanen 2002-06-23 19:57:19 UTC
..and of course the line wrapped. I hope you got the idea anyway.
Basically put "round corners" as an alternate choice for feather, so
we dont clutter the options dialog and make it larger.
Comment 2 gsr.bugs 2002-06-23 20:05:20 UTC
Feather and rounded corners should be possible at the same time.
Imagine feather 3 and radius 25. If the thing is removing clutter,
remove feather and make it work only as extra op.

But I do not think it should be removed anyway, it will be
requested back, I am sure. There is a price to pay when lot of
things and in multiple places are desired, and that is that things
become complex. If the dialog is not made poorly, I do not see it
hurting but making things fast (set in one place and do vs set, do
one thing then another).
Comment 3 Sven Neumann 2003-06-11 16:07:05 UTC
BTW, the Round-Selection Script-Fu has been fixed in the meantime:

2003-04-10  Sven Neumann  <sven@gimp.org>

 * plug-ins/script-fu/interp_sliba.c
 * plug-ins/script-fu/scripts/selection-round.scm: applied a patch
 from Pedro Gimeno that adds the trunc() function to our scheme
 interpreter and fixes bug #109475 the right way.

Comment 4 Alan Horkan 2003-07-23 18:40:53 UTC
Changes at the request of Dave Neary on the developer mailing list.  
I am changing many of the bugzilla reports that have not specified a target
milestone to Future milestone.  Hope that is acceptable.  
Comment 5 Sven Neumann 2006-04-25 10:56:51 UTC
This should be relatively simple to implement and it would definitely be more intuitive than to use the Script-Fu for this. Adding the gnome-love keyword, perhaps we can find a volunteer for this.
Comment 6 Carol 2006-04-26 05:48:32 UTC
This bug report is so similar to 88633.
Comment 7 Martin Nordholts 2006-10-16 10:28:30 UTC
Created attachment 74790 [details] [review]
Patch preview

In an attempt to temporarily stop coding on this patch, and to get an preview of what the patch will look like and what code changes it will introduce, I am submitting what I got. I plan on resuming work on this in a week or so.

Things missing:

  * Antialiasing for rounded rectangles and ellipses.
  * Automatic toggle of the Antialias checkbox depending on if Rounded corners is checked.

I have attempted to clarify code byt changing variale names and adding comments, and to lessen the previous nesting in app/core/gimpchannel-combine.c. Since some code changes is rather major, comments on the existing code could already now be topical.
Comment 8 Martin Nordholts 2006-10-18 09:47:48 UTC
Created attachment 74928 [details] [review]
Patch with full antialias support

Here's the patch.

Before commit, don't forget to add automatic toggle of the sensivity of the Antialias checkbox depending on if Rounded corners is checked.
Comment 9 Martin Nordholts 2006-10-18 10:50:24 UTC
Created attachment 74934 [details] [review]
Previous patch with primary feedback applied

Changes include

*  Changed names

   use rounded corners -> round corners
   radius of rounded corners -> round corner radius

   in all appropriate places in the code

*  made gimp_channel_combine_segment() inline

*  ordered prop installation code in gimp_rect_select_options_class_init in the
   same order as the enums
Comment 10 Michael Natterer 2006-10-18 18:54:57 UTC
Fixed in CVS:

2006-10-18  Michael Natterer  <mitch@gimp.org>

	Applied modified patch from Martin Nordholts which adds a "Rounded
	Corners" option to the rectangle select tool. Fixes bug #86279.

	* app/core/gimpchannel-combine.[ch]: added
	gimp_channel_combine_ellipse_rect(). Use it from
	gimp_channel_combine_ellipse().

	* app/core/gimpchannel-select.[ch]: added
	gimp_channel_select_round_rect()

	* app/tools/gimprectangleselectoptions.[ch]: added properties
	"round-corners" and "corner-radius" and GUI for the new propeties.

	* app/tools/gimprectangleselecttool.h: added macro
	GIMP_RECT_SELECT_TOOL_GET_OPTIONS().

	* app/tools/gimprectangleselecttool.c (gimp_rect_select_tool_draw):
	draw round corners if enabled.

	(gimp_rect_select_tool_real_select): use
	gimp_channel_select_round_rect() if enabled.

	* app/tools/gimpselectionoptions.[ch]: added "antialias_toggle"
	to the GimpSelectionOptions struct so the rect select options
	can set its sensitivity.

	Unrelated:

	* app/tools/gimpellipseselecttool.c (gimp_ellipse_select_tool_draw):
	use 360 * 64 instead of 23040.