Bug 447484

Summary: Smudge engine does not work with grayscale images
Product: [Applications] krita Reporter: John <crazyjerick>
Component: Brush enginesAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73
Priority: NOR Keywords: regression
Version: 5.0.0   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Video demonstrating bug

Description John 2021-12-24 18:03:51 UTC
Created attachment 144839 [details]
Video demonstrating bug

Smudge engine paints hard black squares on a grayscale image surrounding the layer's alpha.


STEPS TO REPRODUCE
1. create/convert image to grayscale using default color profile OR convert a layer's color profile to grayscale
2. paint with any brush that smudges on the grayscale image or layer.

OBSERVED RESULT
Big black squares surrounding the brush

EXPECTED RESULT
Smudging as seen in an RGB image

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Dmitry Kazakov 2021-12-25 10:35:31 UTC
Hi, John!

Thank you for your report. I'll take a look at this bug.
Comment 2 Dmitry Kazakov 2022-03-18 14:37:35 UTC
The bug is somehow related to the conversion algorithm graya8 -> graya16. For some reason, the alpha is set to 100% during this conversion. It might be that the conversion takes the path via alpha color space :(
Comment 3 Bug Janitor Service 2022-03-23 10:43:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1386
Comment 4 Dmitry Kazakov 2022-03-28 07:12:28 UTC
Git commit 5b3b1de7fcbc033b1bf9dfbcd20a0dd53a5a98a3 by Dmitry Kazakov.
Committed on 28/03/2022 at 06:19.
Pushed by dkazakov into branch 'master'.

Fix conversions between GRAYA8<->GRAYA16

The color conversion system had a bug, which caused the conversion
to happen via ALPHA8 color space (GRAYA8<->ALPHA16<->GRAYA16). That
basically dropped the alpha channel of the GRAYA color space. It
was caused by the presence of custom connections in the alpha color
space.

The patch changes the way how connection path is searched. It implements
NodeCapabilities structure, which tracks capabilities of the nodes
used in the connection path.

M  +0    -32   libs/pigment/KoColorConversionAlphaTransformation.cpp
M  +0    -4    libs/pigment/KoColorConversionAlphaTransformation.h
M  +13   -27   libs/pigment/KoColorConversionSystem.cpp
M  +0    -10   libs/pigment/KoColorConversionSystem.h
M  +73   -50   libs/pigment/KoColorConversionSystem_p.h
M  +1    -11   libs/pigment/KoColorConversionTransformationFactory.h
M  +0    -8    libs/pigment/KoCopyColorConversionTransformation.cpp
M  +0    -2    libs/pigment/KoCopyColorConversionTransformation.h
M  +103  -20   libs/pigment/tests/TestColorConversionSystem.cpp
M  +8    -0    libs/pigment/tests/TestColorConversionSystem.h
M  +4    -0    plugins/color/lcms2engine/LcmsRGBP2020PQColorSpace.h
M  +0    -30   plugins/color/lcms2engine/LcmsRGBP2020PQColorSpaceTransformation.h

https://invent.kde.org/graphics/krita/commit/5b3b1de7fcbc033b1bf9dfbcd20a0dd53a5a98a3
Comment 5 Dmitry Kazakov 2022-03-31 13:45:51 UTC
Git commit 83a4e3010777f5c1c2b7ae385a0c2f096ae6a676 by Dmitry Kazakov.
Committed on 31/03/2022 at 13:43.
Pushed by dkazakov into branch 'krita/5.0'.

Fix conversions between GRAYA8<->GRAYA16

The color conversion system had a bug, which caused the conversion
to happen via ALPHA8 color space (GRAYA8<->ALPHA16<->GRAYA16). That
basically dropped the alpha channel of the GRAYA color space. It
was caused by the presence of custom connections in the alpha color
space.

The patch changes the way how connection path is searched. It implements
NodeCapabilities structure, which tracks capabilities of the nodes
used in the connection path.

M  +0    -32   libs/pigment/KoColorConversionAlphaTransformation.cpp
M  +0    -4    libs/pigment/KoColorConversionAlphaTransformation.h
M  +13   -27   libs/pigment/KoColorConversionSystem.cpp
M  +0    -10   libs/pigment/KoColorConversionSystem.h
M  +73   -50   libs/pigment/KoColorConversionSystem_p.h
M  +1    -11   libs/pigment/KoColorConversionTransformationFactory.h
M  +0    -8    libs/pigment/KoCopyColorConversionTransformation.cpp
M  +0    -2    libs/pigment/KoCopyColorConversionTransformation.h
M  +103  -20   libs/pigment/tests/TestColorConversionSystem.cpp
M  +8    -0    libs/pigment/tests/TestColorConversionSystem.h
M  +4    -0    plugins/color/lcms2engine/LcmsRGBP2020PQColorSpace.h
M  +0    -30   plugins/color/lcms2engine/LcmsRGBP2020PQColorSpaceTransformation.h

https://invent.kde.org/graphics/krita/commit/83a4e3010777f5c1c2b7ae385a0c2f096ae6a676