Bug 402196 - “Shrink from image border” option doesn't work when shrinking selection.
Summary: “Shrink from image border” option doesn't work when shrinking selection.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Selection (show other bugs)
Version: 4.1.7
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-16 16:34 UTC by some dude
Modified: 2020-06-15 13:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description some dude 2018-12-16 16:34:57 UTC
SUMMARY
“Shrink from image border” option does nothing when shrinking selection.

STEPS TO REPRODUCE
1. Select all image
2. Use "Shrink selection" operation
3. Uncheck “Shrink from image border” option in pop-up window
4. Click OK

OBSERVED RESULT
Selection is shrinked

EXPECTED RESULT
Selection should not be changed

SOFTWARE/OS VERSIONS
Windows: Windows 7
MacOS: 
Linux/KDE Plasma: OpenSUSE Tumbleweed
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 mvowada 2018-12-17 10:12:15 UTC
Hi some,

I'm not sure about your steps: is the selection running "across" the canvas border?

If that option is intended to do the same as in Gimp: "Shrink from image border" option should affect selections which run along the edge of the image" (https://docs.gimp.org/en/gimp-selection-shrink.html#idp24762880).
Comment 2 mvowada 2018-12-17 10:20:31 UTC
(Changing Status to "needsinfo/waitingforinfo")
Comment 3 some dude 2018-12-17 12:57:06 UTC
Hi mvowada,

It's the first step in description: select all image (Ctrl+A) - so we're absolutely sure that selection touches the edge of canvas.
Comment 4 some dude 2018-12-17 13:36:57 UTC
Additional information: in Krita you can extend selection across the canvas border - the global selection mask adapts to a bigger selection size. Shrinking this selection with “Shrink from image border” option turned ON should crop it to canvas size and then shrink. But it just shrinks it as a whole, including the out-of-canvas parts.
Comment 5 mvowada 2018-12-17 14:40:12 UTC
(In reply to some dude from comment #3)
> It's the first step in description: select all image (Ctrl+A) - so we're
> absolutely sure that selection touches the edge of canvas.
(In reply to some dude from comment #0)
> 3. Uncheck “Shrink from image border” option in pop-up window
> 4. Click OK
> 
> OBSERVED RESULT
> Selection is shrinked
> 
> EXPECTED RESULT
> Selection should not be changed

Hm. I think that selection is expected to shrink regardless that option (sorry if I'm misunderstanding).

(In reply to some dude from comment #4)
> Additional information: in Krita you can extend selection across the canvas
> border - the global selection mask adapts to a bigger selection size.
> Shrinking this selection with “Shrink from image border” option turned ON
> should crop it to canvas size and then shrink. But it just shrinks it as a
> whole, including the out-of-canvas parts.

Yes, I can confirm. It sounds like the bug in the title (Krita 4.2.0-pre-alpha (git 95b09ea) on Ubuntu 14.04)?
Comment 6 some dude 2018-12-17 16:04:05 UTC
I tested 4.1.5 and 4.1.7 on Windows 7 and OpenSUSE Tumbleweed. Probably, this option never worked correctly.

> I think that selection is expected to shrink regardless that option
It shouldn't. That's how shrinking works in Photoshop (its called "contract" there). Anyway, this option definitely has no effect.
Comment 7 mvowada 2018-12-17 23:07:23 UTC
(In reply to some dude from comment #6)
> > I think that selection is expected to shrink regardless that option
> It shouldn't.

Right, I was reading from the link "exceed" instead of "extend to" and I got it all wrong.

(In reply to some dude from comment #6)
> Anyway, this option definitely has no effect.

Confirming (Krita 4.2.0-pre-alpha (git 95b09ea) - Ubuntu 14.04).
Comment 8 Dmitry Kazakov 2020-06-15 13:58:13 UTC
Git commit 46c361a53688d3f209b6c864b01282c9ce21fcd0 by Dmitry Kazakov.
Committed on 15/06/2020 at 13:57.
Pushed by dkazakov into branch 'krita/4.3'.

Fix “Shrink from image border” wrapping

The patch implements a separate KisDefaultBoundsBase::imageBorderRect(),
which always returns the bounds of the image, even for selections.

See more explanations in docs in kis_default_bounds_base.h

M  +1    -1    libs/image/KisPrecisePaintDeviceWrapper.cpp
M  +7    -0    libs/image/kis_convolution_painter.cc
M  +7    -1    libs/image/kis_default_bounds.cpp
M  +1    -0    libs/image/kis_default_bounds.h
M  +5    -0    libs/image/kis_default_bounds_base.cpp
M  +28   -0    libs/image/kis_default_bounds_base.h
M  +5    -0    libs/image/kis_default_bounds_node_wrapper.cpp
M  +1    -0    libs/image/kis_default_bounds_node_wrapper.h
M  +1    -1    libs/image/kis_paint_device.cc
M  +1    -2    libs/image/kis_selection_filters.cpp
M  +1    -1    libs/ui/processing/fill_processing_visitor.cpp
M  +2    -2    libs/ui/tool/kis_resources_snapshot.cpp
M  +1    -1    libs/ui/tool/strokes/freehand_stroke.cpp
M  +1    -1    plugins/filters/roundcorners/kis_round_corners_filter.cpp
M  +1    -1    plugins/paintops/defaultpaintops/brush/kis_brushop.cpp
M  +4    -0    sdk/tests/lod_override.h

https://invent.kde.org/graphics/krita/commit/46c361a53688d3f209b6c864b01282c9ce21fcd0
Comment 9 Dmitry Kazakov 2020-06-15 13:58:31 UTC
Git commit 0bdea1b350a35c0ff894dc51829065cdd23cf830 by Dmitry Kazakov.
Committed on 15/06/2020 at 13:58.
Pushed by dkazakov into branch 'master'.

Fix “Shrink from image border” wrapping

The patch implements a separate KisDefaultBoundsBase::imageBorderRect(),
which always returns the bounds of the image, even for selections.

See more explanations in docs in kis_default_bounds_base.h

M  +1    -1    libs/image/KisPrecisePaintDeviceWrapper.cpp
M  +7    -0    libs/image/kis_convolution_painter.cc
M  +7    -1    libs/image/kis_default_bounds.cpp
M  +1    -0    libs/image/kis_default_bounds.h
M  +5    -0    libs/image/kis_default_bounds_base.cpp
M  +28   -0    libs/image/kis_default_bounds_base.h
M  +5    -0    libs/image/kis_default_bounds_node_wrapper.cpp
M  +1    -0    libs/image/kis_default_bounds_node_wrapper.h
M  +1    -1    libs/image/kis_paint_device.cc
M  +1    -2    libs/image/kis_selection_filters.cpp
M  +1    -1    libs/ui/processing/fill_processing_visitor.cpp
M  +2    -2    libs/ui/tool/kis_resources_snapshot.cpp
M  +1    -1    libs/ui/tool/strokes/freehand_stroke.cpp
M  +1    -1    plugins/filters/roundcorners/kis_round_corners_filter.cpp
M  +1    -1    plugins/paintops/defaultpaintops/brush/kis_brushop.cpp
M  +4    -0    sdk/tests/lod_override.h

https://invent.kde.org/graphics/krita/commit/0bdea1b350a35c0ff894dc51829065cdd23cf830