Merge lp:~johbjo/qpdfview/invertlight into lp:qpdfview
Status: | Merged |
---|---|
Merged at revision: | 2110 |
Proposed branch: | lp:~johbjo/qpdfview/invertlight |
Merge into: | lp:qpdfview |
Diff against target: |
363 lines (+118/-4) 10 files modified
sources/documentview.cpp (+15/-1) sources/documentview.h (+4/-0) sources/mainwindow.cpp (+25/-1) sources/mainwindow.h (+4/-0) sources/pageitem.cpp (+5/-0) sources/presentationview.cpp (+6/-1) sources/renderparam.h (+5/-1) sources/rendertask.cpp (+40/-0) sources/settings.cpp (+10/-0) sources/settings.h (+4/-0) |
To merge this branch: | bzr merge lp:~johbjo/qpdfview/invertlight |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Adam Reichold | Approve | ||
Review via email: mp+395618@code.launchpad.net |
This proposal supersedes a proposal from 2020-12-26.
Description of the change
Changed named to "Invert lightness" and fixed tab indentations. There seems to exist various definition of "lightness" related to various colour spaces, but this transformation probably inverts it either way.
Here is the comment I wrote about how this works:
"This is a transformation in RGB space that mirrors the color coordinates about the plane that intersects the mid point of the cube (0.5, 0.5, 0.5) and is perpendicular to the diagonal vector (1,1,1).
"Each color-coordinate is moved along the (1,1,1)-vector twice its distance from this mid plane.
"Moving a color-coordinate along (1,1,1) preserves the "hue" but changes the "lightness" of the color."
The absolute differences between the components are preserved, which means the "hue" is preserved.
Here are the calculations:
The mid plane is: r + g + b = 1.5
To find the distance t for a given point (r,g,b), we can plug in: r+t + g+t + b+t = 1.5 => t = (1.5 - r - g - b) / 3
The mirrored point is then (r+2*t, g+2*t, b+2*t). When the range is 0-255, we have 1.5*255 = 382.5.
I simplified to: d = (382.5 - r - g - b) / 1.5
Hello Johan,
thank you very much for your contribution!
I have to admit that I do not yet fully understand how this works. I am therefore also slightly uncomfortable with the name.
Is the idea to transform RGB into HSL and there invert the lightness component but keep hue and saturation intact? If so, wouldn't maybe "Invert lightness" be a more precise name?
Best regards,
Adam