Bug 461689

Summary: Vector Shapes have shifted colors for API
Product: [Applications] krita Reporter: keyth_qcfx2 <keyth2363214>
Component: Layers/VectorAssignee: Krita Bugs <krita-bugs-null>
Status: REPORTED ---    
Severity: normal CC: griffinvalley
Priority: NOR    
Version First Reported In: 5.1.3   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: pixel layer selecting blue
pixel layer with blue selected on foreground
pixel layer with yellow selected on foreground
vector layer with same blue selected
vector layer with same yellow selected

Description keyth_qcfx2 2022-11-11 07:38:45 UTC
Created attachment 153661 [details]
pixel layer selecting blue

Document is standard : RGB and U8 with sRGB-elle-V2-srgbtrc.icc

I did this test, paint 2 colors on a paint layer and then paint the same 2 colors on a vector shape. they look the same but if I ask Krita through python what color is displayed they will present different results.

REPLICATE
1 - create a new document
2 - create a vector object inside a vector layer and select it
3 - open scripter and and run this code to apply a color to the selected object

"""
from krita import *

d_cm = Krita.instance().activeDocument().colorModel()
d_cd = Krita.instance().activeDocument().colorDepth()
d_cp = Krita.instance().activeDocument().colorProfile()

managed_color = ManagedColor(d_cm, d_cd, d_cp)
comp = managed_color.components()
red   = 0.4
green = 0.5
blue  = 0.6
alpha = 1
comp = [blue, green, red, alpha]
managed_color.setComponents(comp)
Krita.instance().activeWindow().activeView().setForeGroundColor(managed_color)
"""
4 - vector fill of the object will become blue
5 - deselect object and select it again
6 - read object with this code to see if the numbers are the same that you placed in

"""
from krita import *

color_fg = Krita.instance().activeWindow().activeView().foregroundColor()
order_fg = color_fg.componentsOrdered()
r = order_fg[0]
g = order_fg[1]
b = order_fg[2]

print("red " + str(r))
print("green " + str(g))
print("blue " + str(b))
"""

OBSERVED RESULT
you will notice the value are “similar” but it is enough to cause a big shift in the perceived color.

EXPECTED RESULT
read the same color that was placed into the shape object a moment ago.


SOFTWARE/OS VERSIONS
Windows: 10
Qt Version: 5.12.12

ADDITIONAL INFORMATION
Comment 1 keyth_qcfx2 2022-11-11 07:42:58 UTC
Created attachment 153662 [details]
pixel layer with blue selected on foreground
Comment 2 keyth_qcfx2 2022-11-11 07:43:34 UTC
Created attachment 153663 [details]
pixel layer with yellow selected on foreground
Comment 3 keyth_qcfx2 2022-11-11 07:44:08 UTC
Created attachment 153664 [details]
vector layer with same blue selected
Comment 4 keyth_qcfx2 2022-11-11 07:44:48 UTC
Created attachment 153665 [details]
vector layer with same yellow selected
Comment 5 wolthera 2023-01-12 12:52:47 UTC
I cannot reproduce this with the Krita Version: 5.2.0-prealpha (git 5c98a72) Appimage with Qt 5.15.7. However, this is likely a roundtrip error because the colors inside vector shapes are QColors instead of KoColors, which means that there's a conversion happening under the hood.