Bug 458913

Summary: Changing colours of vector objects - colour picker goes crazy
Product: [Applications] krita Reporter: Hologram <intuos5>
Component: Color SelectorsAssignee: sh_zam <shzam>
Status: RESOLVED FIXED    
Severity: normal CC: michaelknubben, shzam
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hologram 2022-09-09 08:29:14 UTC
SUMMARY
***

STEPS TO REPRODUCE
1. Create a vector layer
2. Create a vector object
3. Go to the toolbar and change the fore- or background colour.

Alternatively, use two mid-grey colours and swap the fore- and background colour in the toolbar. Notice how the colour becomes darker. 

OBSERVED RESULT
Notice that the picked colour no longer corresponds to the initial input.


EXPECTED RESULT
The colour should remain unaffected. 

SOFTWARE/OS VERSIONS
Windows: 10 19044
Krita has: 5.1 plus, has: ee19b42cab

For videos, see the Krita artists thread here: 
https://krita-artists.org/t/bug-colour-picker-is-behaving-weird-with-vector-shapes/46535
Comment 1 Hologram 2022-09-09 08:32:59 UTC
Oops, accidentally forgot the summary. 

Summary
***

When changing the colour of a vector object, the picked colour does not correspond to that the object acquires. The colour picker widget moves across the colour picker in the advanced colour selector. 

There are a multitude of ways to invoke this bug, so please refer to the Krita artists thread, where I posted the videos: https://krita-artists.org/t/bug-colour-picker-is-behaving-weird-with-vector-shapes/46535

I can even go to configure Krita and the vector object's colour will change.
Comment 2 sh_zam 2022-09-15 10:52:05 UTC
If you change to Edit Shapes tool, does any of this happen if you switch foreground-to-background color and vice versa?
Comment 3 Hologram 2022-09-20 10:51:34 UTC
Yes it does, as mentioned in the Krita-artists thread. The colour picker issue spiralling towards black seems to be related to the use of the Pigment.O plugin.
Comment 4 sh_zam 2022-10-11 07:37:06 UTC
Git commit 2264a44becad163a94ba26bdea3f054d205295b1 by Sharaf Zaman.
Committed on 11/10/2022 at 07:36.
Pushed by szaman into branch 'master'.

Fix Foreground-to-Background color switching of vector objects

If the fg-bg color was swapped rapidly enough, the resulting shape would
often have the same color (rather than it being swapped).

The reason for this being resourceManager would send us signal to change
both fg and bg, but if the delay between them is less than
colorChangedCompressor's timeout, the latter signal would be ignored.
Which would prevent the swapping from happening. The proper solutions
seem to be to either have a compressor at the source (which there does
seem to be) or have separate channel (ie different timers) for different
resources (bg, fg and gradient in *this* case).

M  +1    -1    libs/ui/widgets/KoFillConfigWidget.cpp

https://invent.kde.org/graphics/krita/commit/2264a44becad163a94ba26bdea3f054d205295b1
Comment 5 sh_zam 2022-10-12 09:39:51 UTC
*** Bug 459062 has been marked as a duplicate of this bug. ***
Comment 6 sh_zam 2022-10-24 05:01:00 UTC
Git commit 231726c6d7b3c5f9764b52d4d43c3c26b2d65ea4 by Sharaf Zaman.
Committed on 24/10/2022 at 04:51.
Pushed by szaman into branch 'krita/5.1'.

Fix Foreground-to-Background color switching of vector objects

If the fg-bg color was swapped rapidly enough, the resulting shape would
often have the same color (rather than it being swapped).

The reason for this being resourceManager would send us signal to change
both fg and bg, but if the delay between them is less than
colorChangedCompressor's timeout, the latter signal would be ignored.
Which would prevent the swapping from happening. The proper solutions
seem to be to either have a compressor at the source (which there does
seem to be) or have separate channel (ie different timers) for different
resources (bg, fg and gradient in *this* case).
(cherry picked from commit 2264a44becad163a94ba26bdea3f054d205295b1)

M  +1    -1    libs/ui/widgets/KoFillConfigWidget.cpp

https://invent.kde.org/graphics/krita/commit/231726c6d7b3c5f9764b52d4d43c3c26b2d65ea4