Created attachment 134584 [details] Visual comparison of observed (Krita) and expected result (Photoshop). SUMMARY When using the layer style stroke with position outside, there is a transparent gap between any anti-aliased edges of the layer content and the stroke. The same, but opposite is true about using the position inside. However, instead of a transparent gap, the original layer's color shines through where the outer edge of the stroke and the layer content meet. STEPS TO REPRODUCE 0. Create white background layer 1. Create layer with black content with anti-aliased edges to transparency 2. Enable the stroke layer style 3a. Set stroke position to outside with white color 3b. Set stroke position to inside with black color OBSERVED RESULT Inside position: An edge where the color of the content and the stroke mix. Outside position: An edge where the color of the content and the stroke mix. EXPECTED RESULT The same color at the edge as in the stroke. ADDITIONAL INFORMATION Outside can be solved by rendering the stroke as done with center-position, but double thickness and below the layer in question.
Can you also please add a simple small test file for Krita? With one layer showing the problem on the inside and another showing the outside. Thanks in advance!
Created attachment 134585 [details] Krita file with examples of inside and outside
(In reply to Tymond from comment #1) Yes, definitely!
Confirmed.
Git commit 2599be61082982a3d07edb588098f671ecce2ac7 by Dmitry Kazakov. Committed on 06/08/2021 at 10:19. Pushed by dkazakov into branch 'master'. Fix holes in the Stroke layers style The stroke should be applied on maxed out layer's projection to make sure knock-out blending works fine. Stroke merging process is complicated and performs some kind of "knockout" method. First both, the layer and the stroke, are applied to the backdrop independently. Then the result is blended together using the knockout selection (the contour of the stroke). And to fix the border effects we need to either ceil or floor the layer's projection's border opacity. It guarantees that the mixing code mixes the real color, but not it antialiased version. If we try to find a vague analogy with the PDF specification, then the knockout selection will be the "shape" of the stroke. And the opacity value of the layer effect will be "opacity" of the stroke. Therefore we first blend a 100%-alpha versions of the stroke and a layer the backdrop using their corresponding opacity* vallues, and then we blend two results using the "shape" value. M +1 -0 libs/image/CMakeLists.txt M +10 -17 libs/image/kis_layer_projection_plane.cpp M +3 -3 libs/image/kis_layer_projection_plane.h M +45 -0 libs/image/krita_utils.cpp M +10 -0 libs/image/krita_utils.h A +31 -0 libs/image/layerstyles/KisStrokeLayerStyleFilterProjectionPlane.cpp [License: GPL(v2.0+)] A +26 -0 libs/image/layerstyles/KisStrokeLayerStyleFilterProjectionPlane.h [License: GPL(v2.0+)] M +10 -0 libs/image/layerstyles/kis_layer_style_filter_projection_plane.cpp M +6 -0 libs/image/layerstyles/kis_layer_style_filter_projection_plane.h M +29 -7 libs/image/layerstyles/kis_layer_style_projection_plane.cpp M +11 -0 libs/image/layerstyles/kis_ls_stroke_filter.cpp M +3 -0 libs/image/layerstyles/kis_ls_stroke_filter.h https://invent.kde.org/graphics/krita/commit/2599be61082982a3d07edb588098f671ecce2ac7