Bug 365372 - HSY' square color selector does not display the correct square content for a given hue
Summary: HSY' square color selector does not display the correct square content for a ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Color Selectors (show other bugs)
Version: 3.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Jasper
URL: http://orig07.deviantart.net/3e67/f/2...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-11 17:11 UTC by Aliciane
Modified: 2021-12-15 01:29 UTC (History)
5 users (show)

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


Attachments
shifting hue of advanced color selector (3.03 MB, video/mp4)
2019-05-29 20:43 UTC, toniw
Details
wrong hues of hsy color selectors (1.04 MB, video/mp4)
2019-08-26 17:45 UTC, toniw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aliciane 2016-07-11 17:11:05 UTC
The color selector is set to HSY' with the square shape (saturation / luma). When selecting a hue on the hue circle, the hue shown in the square is actually shifted toward hue 180° (cyan). 

In the following image : http://orig07.deviantart.net/3e67/f/2016/193/b/4/kritahsycolorselectorbug_by_aliciane-da9q3wv.png I have eye-balled on the circle the hue that should correspond to this square.

If I apply that colour on the canvas, and then use the eye-dropper tool to pick it, the hue cursor on the circle moves to the correct position. However, the content of the square also moves and is still shifted, resulting in the color selector not displaying the actual eye-dropped colour.

It wasn't happening on version 2.9.7.

Reproducible: Always

Steps to Reproduce:
1. Set-up the color selector to HSY' and choose the square shape (second one)
2. Select a specific hue on the hue circle

Actual Results:  
The content of the square doesn't have the same hue as the one selected on the circle.

Expected Results:  
The two hues should be the same.
Comment 1 wolthera 2016-07-11 18:59:09 UTC
Yes, that's true, and I noticed it recently as well... Not sure what is causing it :/
Comment 2 toniw 2019-05-29 20:43:37 UTC
Created attachment 120381 [details]
shifting hue of advanced color selector

The exact same problem persists in Krita 4.2.0

I added a quick video that shows the resulting problem of shifting hues when picking up and slightly modifying a color. In the video, all the resulting colors should be more or less the exact same color.

Steps:

1. Choose a color and paint a stroke
2. Pick up the color from the painted stroke
3. Notice the sudden Jump of hue in the advanced color selector
4. Tweaking the color slightly (e.g. clicking in the same spot at the value slider) updates the current brush color
5. Paint a stroke with the new color again and notice the wrong hue

This works for most of the advanced color selectors (round and square) as long as they are in HSY' mode.
The new artistic color selector does not seem to be affected by this bug. I do however prefer the countinous selectability of the advanced selector (currenty not possible with all dimensions of the artistic one) and would love to see this bug adressed some day as well. HSY is a great model for picking color for paintings, but so far I always fall back to HSI because of this bug.

OS: Antergos/Arch Linux
Krita Version: 4.2.0 (blank default profile)
Comment 3 wolthera 2019-08-26 16:07:49 UTC
toniw: It's caused by this section: https://invent.kde.org/kde/krita/blob/master/libs/ui/canvas/kis_display_color_converter.cpp#L678
lines 676 to 678 and 693 to 695
Comment 4 toniw 2019-08-26 17:45:54 UTC
Created attachment 122375 [details]
wrong hues of hsy color selectors

@wolthera

So the hue shift is a result of the (de)linearization of the color space.

An example indeed shows that the RGB values result in a different hue (far less green) after linearization (I guess the same goes for delinearization):
    before linearization: r=0.823529, g=0.196078, b=0
    after linearization: r=0.64448, g=0.0319066, b=0

I suppose, as soon as the HSY values are computed correctly, this workaround is obsolete too (wheel and simple selector):
https://invent.kde.org/kde/krita/blob/master/plugins/dockers/advancedcolorselector/kis_color_selector_wheel.cpp#L120

This, in addition to the angle of the color wheel using the HSV-Hue seems to cause the shifting when the color selector is updated. The (clicked) angle just does not match the HSY-Hue after being delinearized, but all of the other (non-linearized) hues match.
https://invent.kde.org/kde/krita/blob/master/plugins/dockers/advancedcolorselector/kis_color_selector_wheel.cpp#L298

The problem affects the Artistic Color Selector too: The picked color hue does not equal the hue inside the wheel. In the attached video, you can also see that the color distribution on the artistic color selector wheel is not very "linear": The Green-Value increases steadily in the RGB-Slider but the position in the wheel only moves very little and then makes bigger steps as it gets closer towards pure yellow. The resulting hues seem to be "squashed" together at pure red, green and blue
Comment 5 Jasper 2020-07-18 18:24:43 UTC
I'm unable to reproduce this bug in the latest release (4.3.0).
Can anybody confirm that this bug is still present in the latest release?

When I draw a shape with a color selected on the color circle and pick it up with the eye-dropper the color of the color circle doesn't change.

(This may be another bug, but seems related)
When a color is selected on the color wheel, and the color model type is changed the square inside the color wheel is moved. Although this is the case for all the color model types.
Comment 6 toniw 2020-07-19 11:42:42 UTC
(In reply to Jasper from comment #5)
> I'm unable to reproduce this bug in the latest release (4.3.0).
> Can anybody confirm that this bug is still present in the latest release?

Yes, the bug is still present. If you take the HSY' Square as suggested in the original report, the steps are:

1. Draw some shape with color A (best visible when it's very saturated)
2. Pick up any other color with the eye-dropper (e.g. from the background)
3. Try to pick up color A, and notice the shifted hue in the color wheel and square

Slight color adjustments are not possible that way. As soon as you move anything in the color selector, the wrong hue also gets applied to the brush/current tool.

This happens for all HSY' color selectors (maybe except the triangular one). All other models (HSV, HSL, HSI) work just fine.
Comment 7 Bug Janitor Service 2020-08-17 17:48:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/471