Bug 502118 - Transparency lost in vector shapes
Summary: Transparency lost in vector shapes
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layers/Vector (other bugs)
Version First Reported In: 5.2.9
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2025-03-28 10:09 UTC by rbjazbbc
Modified: 2026-01-15 12:34 UTC (History)
2 users (show)

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


Attachments
First photo shows the creation of a vecor shape. Second photo shows lost transparency. Third photo is after a tiny adjustment to the color gradient. (626.19 KB, image/png)
2025-03-28 10:09 UTC, rbjazbbc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rbjazbbc 2025-03-28 10:09:28 UTC
Created attachment 179813 [details]
First photo shows the creation of a vecor shape. Second photo shows lost transparency. Third photo is after a tiny adjustment to the color gradient.

SUMMARY
Transparency in vector shapes become grayish after closing then opening a Krita saved file.

STEPS TO REPRODUCE
1. In a vector layer, make a selection then convert it to shape.
2. In the "Tool Options", select a gradient fill, then select any color.
3. Select the preset "Foreground to Transparent".
4. Save the file, close it, and then open it again.

OBSERVED RESULT
Transparency is lost, showing greyish color (image attached).

EXPECTED RESULT
Transparency should look just like it did before closing the file.

SOFTWARE/OS VERSIONS
Windows: 11

ADDITIONAL INFORMATION
1. Any tiny adjustment to the gradient color bar restores correct transparency immediately (image attached).
2. The "Undo History" records the difference.
3. Artists working with lots of transparency vector layers need to do a tiny adjustment for all the vector shapes in all layers to correct this, which is time consuming and anti-productive. I hope it will be fixed in the next release.
Comment 1 Halla Rempt 2025-03-28 10:42:58 UTC
I can confirm the issue and it is a regression: 4.4.8 doesn't show the issue (so the file gets saved correctly, it's loading that's broken), 5.0.2 does, so it's been there for a long time.
Comment 2 rbjazbbc 2025-04-13 18:08:09 UTC
Crate a vector shape with gradient fill, copy it, then paste it.
The pasted vector shape will show the same bug instantly without closing/opening the file.
A tiny adjustment to the gradient fixes it.
Comment 3 Halla Rempt 2025-04-28 12:59:59 UTC
Wolthera suggested that this is caused by the icc-color parsing for 5.0, as that parses to kocolor and then to qcolor.
Comment 4 rbjazbbc 2025-07-01 20:11:46 UTC
(In reply to Halla Rempt from comment #3)
> Wolthera suggested that this is caused by the icc-color parsing for 5.0, as
> that parses to kocolor and then to qcolor.

I couldn't find icc-color in the settings to modify. What can I do to temporarily mitigate this?
Comment 5 Halla Rempt 2025-07-08 08:48:46 UTC
I'm afraid it really is a problem in our code, and Wolthera and I should sit together to find a fix. The issues is present since Krita 5.0, so it's been there for way too long...
Comment 6 rbjazbbc 2025-09-11 04:22:46 UTC
Is there an estimate to look into this? Please accept my apologies for this question. I know this is an open source project and there are other more important priorities, but vectors make certain tasks much easier.
Comment 7 Dmitry Kazakov 2026-01-15 12:26:31 UTC
Git commit 753107e08aa03dd1949b2043cc1b17e5ce3c85de by Dmitry Kazakov.
Committed on 15/01/2026 at 12:26.
Pushed by dkazakov into branch 'master'.

Force SVG gradients to work in premultiplied alpha mode

WARNING: That is against SVG2 specification!

All internal Krita structures, including GUI editor, expect the gradients to work
in premultiplied alpha mode. The change that happened in SvgParser in 2021
changed the behavior of the loading code only. All GUI controls still create
premultiplied gradients, which caused inconsistencies when loading gradients
created in Krita.

What we need to do is to implement a proper support of non-premultiplied
gradients. That includes the following:

1) All GUI controls should support switching the two modes:

   * Stop Gradient Editor
   * Segment Gradient Editor

2) A proper backward compatibility should be present when loading
    gradients from external buffers:

    * SVG gradients (it is a part of .kra format)
    * ASL gradients (questionable)
    * Gimp gradients (questionable)
    *  XML gradietns saved in Fill Layers and Filters

3) Raster gradients painted with KoMixOp should also support
    non-premultiplied mode

4) FgToTransparent auto-gradient should  properly handle the
    "FgTransparent" option.

CC:kimageshop@kde.org

M  +5    -3    libs/flake/svg/SvgParser.cpp
M  +2    -0    libs/flake/tests/TestSvgParser.cpp

https://invent.kde.org/graphics/krita/-/commit/753107e08aa03dd1949b2043cc1b17e5ce3c85de
Comment 8 Dmitry Kazakov 2026-01-15 12:34:26 UTC
Git commit c82e28995d4a0d8e712b1c6f275fc99b75266b55 by Dmitry Kazakov.
Committed on 15/01/2026 at 12:34.
Pushed by dkazakov into branch 'krita/5.2'.

Force SVG gradients to work in premultiplied alpha mode

WARNING: That is against SVG2 specification!

All internal Krita structures, including GUI editor, expect the gradients to work
in premultiplied alpha mode. The change that happened in SvgParser in 2021
changed the behavior of the loading code only. All GUI controls still create
premultiplied gradients, which caused inconsistencies when loading gradients
created in Krita.

What we need to do is to implement a proper support of non-premultiplied
gradients. That includes the following:

1) All GUI controls should support switching the two modes:

   * Stop Gradient Editor
   * Segment Gradient Editor

2) A proper backward compatibility should be present when loading
    gradients from external buffers:

    * SVG gradients (it is a part of .kra format)
    * ASL gradients (questionable)
    * Gimp gradients (questionable)
    *  XML gradietns saved in Fill Layers and Filters

3) Raster gradients painted with KoMixOp should also support
    non-premultiplied mode

4) FgToTransparent auto-gradient should  properly handle the
    "FgTransparent" option.

CC:kimageshop@kde.org

M  +5    -3    libs/flake/svg/SvgParser.cpp
M  +2    -0    libs/flake/tests/TestSvgParser.cpp

https://invent.kde.org/graphics/krita/-/commit/c82e28995d4a0d8e712b1c6f275fc99b75266b55