Bug 445135

Summary: “Foreground to background color” in layerstyles
Product: [Applications] krita Reporter: thetwo <thetwo222>
Component: layer stylesAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, halla, tamtamy.tymona
Priority: NOR Keywords: regression, release_blocker
Version: 5.0.0-beta2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: test

Description thetwo 2021-11-07 21:30:05 UTC
SUMMARY
I turned on the gradient in layerstyles and selected "Foreground to background color". It displays the correct color in the interface. But there is an error on the image. It uses a white to black gradient as a blend. 

STEPS TO REPRODUCE
1. turn on layerstyles
2. turn on gradients
3. choose Foreground to background color
Comment 1 thetwo 2021-11-07 23:03:28 UTC
Created attachment 143325 [details]
test

I tested it again: I created a gradient from foreground to foreground. It is red when it is created. So no matter what color I choose, it is always red in layerstyles
Comment 2 Tiar 2021-11-08 08:32:07 UTC
The layer style should use the gradient how it is (which colors are background and foreground) at the moment the layer style is created, not when the gradient is created. I understand that right now it uses the gradient with colors as they were when the gradient was created, not layer style, right?
Comment 3 thetwo 2021-11-08 13:17:55 UTC
"At the moment the layer style is created" is not very accurate. It should be said that every time I click on the gradient with "foreground color" or "background color", it will re-read.
In other words, the gradient in the interface is correct (please see the blue in the previous picture). Just make sure that the gradient effect is consistent with the interface
Comment 4 Bug Janitor Service 2021-12-07 14:09:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1208
Comment 5 Dmitry Kazakov 2021-12-07 16:15:19 UTC
Git commit 46e8344d6fa2deebb9d5e6da59f9b6d9bc7f6f2c by Dmitry Kazakov.
Committed on 07/12/2021 at 14:06.
Pushed by dkazakov into branch 'master'.

Fix layer styles to handle FG->BG gradients correctly

All the dynamic gradients should be baked before assigning to the
layer.

M  +1    -1    libs/image/kis_asl_layer_style_serializer.cpp
M  +79   -9    libs/image/kis_psd_layer_style.cpp
M  +3    -6    libs/image/kis_psd_layer_style.h
M  +16   -6    libs/ui/kis_layer_manager.cc
M  +1    -1    plugins/impex/libkra/kis_kra_loader.cpp
M  +1    -1    plugins/impex/psd/psd_loader.cpp

https://invent.kde.org/graphics/krita/commit/46e8344d6fa2deebb9d5e6da59f9b6d9bc7f6f2c
Comment 6 Dmitry Kazakov 2021-12-08 10:59:14 UTC
Git commit 0d91ebb5f3a69090dec64ea71259ff87ae345a95 by Dmitry Kazakov.
Committed on 08/12/2021 at 10:58.
Pushed by dkazakov into branch 'krita/5.0'.

Fix layer styles to handle FG->BG gradients correctly

All the dynamic gradients should be baked before assigning to the
layer.
(cherry picked from commit 46e8344d6fa2deebb9d5e6da59f9b6d9bc7f6f2c)

M  +1    -1    libs/image/kis_asl_layer_style_serializer.cpp
M  +79   -9    libs/image/kis_psd_layer_style.cpp
M  +3    -6    libs/image/kis_psd_layer_style.h
M  +13   -5    libs/ui/kis_layer_manager.cc
M  +1    -1    plugins/impex/libkra/kis_kra_loader.cpp
M  +1    -1    plugins/impex/psd/psd_loader.cpp

https://invent.kde.org/graphics/krita/commit/0d91ebb5f3a69090dec64ea71259ff87ae345a95