GNOME Bugzilla – Bug 86279
Rectangle selection could have "Round corners" as an alternative to "Feather"
Last modified: 2006-10-18 18:54:57 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?
..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.
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).
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.
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.
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.
This bug report is so similar to 88633.
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.
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.
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
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.