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 761060 - Add a "Flood" select action
Add a "Flood" select action
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal enhancement
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
: 763226 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-01-24 21:15 UTC by Ell
Modified: 2016-03-08 14:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Flood demonstration (209.84 KB, image/png)
2016-01-24 21:15 UTC, Ell
  Details
0001-app-Add-gimp-flood-GEGL-operation.patch (15.04 KB, patch)
2016-01-24 21:24 UTC, Ell
committed Details | Review
0002-app-Add-gimp_channel_flood-function.patch (4.83 KB, patch)
2016-01-24 21:24 UTC, Ell
committed Details | Review
0003-app-Add-Flood-select-action.patch (6.48 KB, patch)
2016-01-24 21:24 UTC, Ell
committed Details | Review
0004-pdb-Add-gimp-selection-flood.patch (7.14 KB, patch)
2016-01-24 21:25 UTC, Ell
committed Details | Review

Description Ell 2016-01-24 21:15:07 UTC
Created attachment 319621 [details]
Flood demonstration

When trying to select a tricky area with one of the region select tools, it's
not uncommon for the selection to contain many small "bubbles", as shown in the
attached screenshot.  The following patch set adds a "flood" select action,
which helps getting rid of those.

Conceptually, think of the selection mask as a height map of a hilly terrain,
and imagine this terrain being completely flooded during a storm.  Once the
storm has abated, the remaining water form lakes in the terrain's depressions.
The flood action assigns to each pixel in the selection mask the elevation of (the ground or water level at) that pixel after the flood, hence the name.

To put it in more precise terms, at each pixel, take all the paths from that
pixel to the outside, and find the maximum value of the selection mask along
each of these paths.  The result of the operation at the said pixel is the
minimum of these maxima.
Comment 1 Ell 2016-01-24 21:24:05 UTC
Created attachment 319625 [details] [review]
0001-app-Add-gimp-flood-GEGL-operation.patch
Comment 2 Ell 2016-01-24 21:24:27 UTC
Created attachment 319626 [details] [review]
0002-app-Add-gimp_channel_flood-function.patch
Comment 3 Ell 2016-01-24 21:24:46 UTC
Created attachment 319627 [details] [review]
0003-app-Add-Flood-select-action.patch
Comment 4 Ell 2016-01-24 21:25:13 UTC
Created attachment 319628 [details] [review]
0004-pdb-Add-gimp-selection-flood.patch
Comment 5 Ell 2016-01-24 21:28:23 UTC
The interesting stuff are in patch 1, the rest is boilerplate.
Comment 6 Michael Natterer 2016-01-24 22:16:34 UTC
That looks extremely useful. I think we want this.

About the patches, I didn't find anything wrong.
Comment 7 Jehan 2016-01-25 17:08:16 UTC
Wow that looks cool! The case shown by the screenshot happens to me so many times! :-)
Comment 8 Michael Natterer 2016-01-25 22:18:57 UTC
Pushed to master:

commit b52da8a17e2eb01cee3399b6b0e4b660a22f807d
Author: Ell <ell_se@yahoo.com>
Date:   Sun Jan 24 18:24:51 2016 +0000

    pdb: Add gimp-selection-flood

commit 71119d41c0e6df99094d8b15907283450007918b
Author: Ell <ell_se@yahoo.com>
Date:   Sun Jan 24 17:43:35 2016 +0000

    app: Add "Flood" select action
    
    and associated UI entries.
    
    This action applies the "gimp:flood" operation to the selection.

commit 3f04e349cf7be63b78a261652101bfbc8eea1540
Author: Ell <ell_se@yahoo.com>
Date:   Sun Jan 24 17:38:31 2016 +0000

    app: Add gimp_channel_flood() function
    
    This function applies the "gimp:flood" operation to the channel.

commit c63bee344057343eb5edac23ef996400e23bcafc
Author: Ell <ell_se@yahoo.com>
Date:   Sun Jan 24 17:08:43 2016 +0000

    app: Add "gimp:flood" GEGL operation
    
    This operation assigns to each pixel the minimum of the
    maxima of all paths from it to the outside, as if the
    input image represents a height map, and the operation
    floods it with water.
Comment 9 Michael Schumacher 2016-03-08 14:41:22 UTC
*** Bug 763226 has been marked as a duplicate of this bug. ***