Bug 395673 - Selection Tools' Transform - Border Selection always gives fuzzy edges.
Summary: Selection Tools' Transform - Border Selection always gives fuzzy edges.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Transform (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: investigated, triaged
Depends on:
Blocks:
 
Reported: 2018-06-21 03:34 UTC by Tyson Tan
Modified: 2020-06-16 01:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fuzzy border selection result (3.72 KB, image/png)
2018-06-21 03:34 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2018-06-21 03:34:31 UTC
Created attachment 113478 [details]
Fuzzy border selection result

The Selections Tools in the toolbox now has a on-canvas context menu. In it, there is "Transform" item that expands and allows user to make Border Selection based on the current selection outline. However, the resulting Border Selection is always fuzzy.

Reproduce:
1) Rectangular Selection Tool, select an rectangular area.
2) Right-click >> Transform >> Border selection
3) Border width: 3 >> OK
4) Fill the result selection area with red
5) It the filled color has fuzzy edges.

I think when we first generate the border selection, it should be always as sharp as possible for it to be really useful. Or better, let user determine how fuzzy the border selection's edges will be. After all, you can always make a sharp selection fuzzy, but you can never make a fuzzy selection sharp.
Comment 1 Tyson Tan 2018-06-21 03:37:17 UTC
BTW I tried in Tool options dockers turning on and off Anti-aliasing and switching between pixel selection and vector selection, but none of those options work.
Comment 2 Tiar 2018-10-02 18:31:52 UTC
Can confirm, border selection always has semi-transparent pixels on the edges.
Comment 3 Dmitry Kazakov 2020-06-03 13:23:31 UTC
To fix this bug, we should refactor our selection filters code not to use old explicit code and use KisGaussianKernel::applyDilate/applyErodeU8() instead.
Comment 4 Dmitry Kazakov 2020-06-15 16:11:17 UTC
Hi, Tyson!

Should border-selection filter be antialiased or not? Or there should be an option?
Comment 5 Tyson Tan 2020-06-15 16:23:35 UTC
Hi Dmitry, I think it should be optional, because you can't use anti-aliasing in pixel art.
Comment 6 Dmitry Kazakov 2020-06-15 19:06:23 UTC
Git commit 40ee22112db68ed3c2c0690d88da93cd7994b19d by Dmitry Kazakov.
Committed on 15/06/2020 at 19:06.
Pushed by dkazakov into branch 'krita/4.3'.

Fix border selection to generate non-fuzzy edges

Border should use erode/dilate kernel instread of a triangular one.

The patch also adds a new option: border seleciton can now do
optional antialiasing of the edge.

M  +54   -18   libs/image/kis_selection_filters.cpp
M  +2    -1    libs/image/kis_selection_filters.h
M  +1    -1    libs/libkis/Selection.cpp
M  +1    -1    libs/libqml/KisSelectionExtras.cpp
M  +24   -0    plugins/extensions/modify_selection/dlg_border_selection.cc
M  +4    -0    plugins/extensions/modify_selection/dlg_border_selection.h
M  +2    -1    plugins/extensions/modify_selection/modify_selection_operations.cpp
M  +63   -56   plugins/extensions/modify_selection/wdg_border_selection.ui

https://invent.kde.org/graphics/krita/commit/40ee22112db68ed3c2c0690d88da93cd7994b19d
Comment 7 Dmitry Kazakov 2020-06-15 19:06:52 UTC
Git commit 18511f5e5b80e82fcc1d6429b6a94487c0e3cc1a by Dmitry Kazakov.
Committed on 15/06/2020 at 19:06.
Pushed by dkazakov into branch 'master'.

Fix border selection to generate non-fuzzy edges

Border should use erode/dilate kernel instread of a triangular one.

The patch also adds a new option: border seleciton can now do
optional antialiasing of the edge.

M  +54   -18   libs/image/kis_selection_filters.cpp
M  +2    -1    libs/image/kis_selection_filters.h
M  +1    -1    libs/libkis/Selection.cpp
M  +1    -1    libs/libqml/KisSelectionExtras.cpp
M  +24   -0    plugins/extensions/modify_selection/dlg_border_selection.cc
M  +4    -0    plugins/extensions/modify_selection/dlg_border_selection.h
M  +2    -1    plugins/extensions/modify_selection/modify_selection_operations.cpp
M  +63   -56   plugins/extensions/modify_selection/wdg_border_selection.ui

https://invent.kde.org/graphics/krita/commit/18511f5e5b80e82fcc1d6429b6a94487c0e3cc1a
Comment 8 Tyson Tan 2020-06-16 01:35:18 UTC
Thank you Dmitry! :D