Bug 398691 - Layer Style: Stroke effect does not match the correct value; comes out as much thicker than it should be
Summary: Layer Style: Stroke effect does not match the correct value; comes out as muc...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: layer styles (show other bugs)
Version: 4.1.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-16 04:14 UTC by Alex
Modified: 2019-10-14 15:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Example of a 2px stroke showing up as 3px (122.29 KB, image/png)
2018-09-16 04:14 UTC, Alex
Details
Example of a 3px stroke showing up as 5px (122.92 KB, image/png)
2018-09-16 04:15 UTC, Alex
Details
Example of a 4px stroke showing up as 8px (123.16 KB, image/png)
2018-09-16 04:16 UTC, Alex
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2018-09-16 04:14:29 UTC
Created attachment 114989 [details]
Example of a 2px stroke showing up as 3px

The "Stroke" tool in the Layer Styles window does not apply the correct value onto the image. For example, shapes in a layer with a style of a 2px stroke will actually come out as 3px on the image; strokes with a 3px value will show up as 5px on the image, and strokes with a value of 4px will show up as 8px on the image. 

The difference seems minor, but is very noticeable from afar. This bug should be triggered by creating a new layer, making any shape using a color or brush, applying a layer style, and zooming in to see if the stroke is correct.

I use Arch Linux to use Krita; I tested this on a different device (Windows 10) using the most recent version of Krita, and the same problem occurred; after, I used an older version of Krita and it worked correctly; the amount of pixels matched the value I put in. 

Unfortunately, I do not remember when I first encountered the bug, as it has been several months before I began to see if anyone else had this bug, but I am extremely confident that it occurs on versions past 4.0.4.
Comment 1 Alex 2018-09-16 04:15:17 UTC
Created attachment 114990 [details]
Example of a 3px stroke showing up as 5px
Comment 2 Alex 2018-09-16 04:16:01 UTC
Created attachment 114991 [details]
Example of a 4px stroke showing up as 8px
Comment 3 wkg28406 2018-09-21 23:31:56 UTC
krita-4.2.0-pre-alpha-127857b-x86_64.appimage

confirming

This does not happen with stroke position set to 'center'. It seems to double the value when set to 'outside'. Don't know how to test 'inside'. Happens with or without aliasing.
Comment 4 Dmitry Kazakov 2019-10-10 09:17:25 UTC
Git commit 227782b46d72d82d4aeb6e016f62d81ea3c0ab57 by Dmitry Kazakov.
Committed on 02/10/2019 at 19:41.
Pushed by dkazakov into branch 'master'.

Fix "Stroke" Layer Style width not to be doubled

Stroke still doesn't generate exactly the same result as in PS,
because in PS it uses a bit different way of blending (it removes
the part of the original layer, or just uses COMPOSITE_COPY).

M  +2    -2    libs/image/kis_gaussian_kernel.cpp
M  +13   -6    libs/image/layerstyles/kis_ls_stroke_filter.cpp

https://invent.kde.org/kde/krita/commit/227782b46d72d82d4aeb6e016f62d81ea3c0ab57
Comment 5 Dmitry Kazakov 2019-10-10 09:17:25 UTC
Git commit d3f2c8f26517d0d08cd10c2c9e939cc0a7a0a553 by Dmitry Kazakov.
Committed on 03/10/2019 at 12:49.
Pushed by dkazakov into branch 'master'.

Fix Stroke layer style to be applies directly onto backround

In ASL imlementation Stroke is applied to the background, not
to the layer itself.

M  +1    -0    libs/image/CMakeLists.txt
A  +46   -0    libs/image/layerstyles/KisLayerStyleKnockoutBlower.cpp     [License: GPL (v2+)]
A  +40   -0    libs/image/layerstyles/KisLayerStyleKnockoutBlower.h     [License: GPL (v2+)]
M  +2    -0    libs/image/layerstyles/kis_layer_style_filter.h
M  +8    -0    libs/image/layerstyles/kis_layer_style_filter_projection_plane.cpp
M  +3    -0    libs/image/layerstyles/kis_layer_style_filter_projection_plane.h
M  +65   -22   libs/image/layerstyles/kis_layer_style_projection_plane.cpp
M  +5    -3    libs/image/layerstyles/kis_ls_bevel_emboss_filter.cpp
M  +1    -0    libs/image/layerstyles/kis_ls_bevel_emboss_filter.h
M  +2    -0    libs/image/layerstyles/kis_ls_drop_shadow_filter.cpp
M  +1    -0    libs/image/layerstyles/kis_ls_drop_shadow_filter.h
M  +2    -0    libs/image/layerstyles/kis_ls_overlay_filter.cpp
M  +1    -0    libs/image/layerstyles/kis_ls_overlay_filter.h
M  +2    -0    libs/image/layerstyles/kis_ls_satin_filter.cpp
M  +1    -0    libs/image/layerstyles/kis_ls_satin_filter.h
M  +14   -12   libs/image/layerstyles/kis_ls_stroke_filter.cpp
M  +2    -0    libs/image/layerstyles/kis_ls_stroke_filter.h

https://invent.kde.org/kde/krita/commit/d3f2c8f26517d0d08cd10c2c9e939cc0a7a0a553
Comment 6 Dmitry Kazakov 2019-10-14 15:59:15 UTC
The bug is not fixed in master :)