Improve HDR handling in Krita
Description
===========
Now that we have HDR support on Linux, we should get Krita to work properly with HDR. This comprises 3 goals:
- Functional UI
- Ability to master/export HDR properly.
- Fixing the filters.
```mermaid
flowchart
start;
hdrmetadata["HDR Metadata"] --> start
cicpHandlingInICC["CICP handling in ICC"] --> start
gamutmap["Gamut and Tone Mapping"] --> cicpHandlingInICC
filters --> hdrmetadata
exportToPng["Export CICP/HDR meta to PNG"] --> hdrmetadata
exportToPng["Export CICP/HDR meta to PNG"] --> cicpHandlingInICC
ui["User Interface bugs"] --> start
improveWayland["Improve communication with Wayland CM"] --> hdrmetadata
```
User interface
----------------
- [x] Fix UI to be color managed (see #46 )
- [x] Allow histogram to handle 'hdr' values.
- [x] Show wayland 'preferred colorspace' inside xy-diagram-widget.
- [ ] Improve communication with wayland
+ Zoom seems to reset the preferred colorspace somehow. Can we smooth this over?
+ When drawing a HDR color onto the canvas, it takes a bit before the colors visually render as HDR. Probably some kind of metadata issue??? (Seems to be a driver-trick.)
HDR Metadata
------------
- [ ] Use these to handle filters better.
- [ ] Use these to export file info better.
- [ ] CICP handling for PNG
- [x] CICP handling for ICC???
- [ ] Do something about the recorder docker output for HDR.
Filters
-------
Fix filters to work with HDR. May need a range-selector, or using the generated meta-data as input? The items with ??? behind them are ones I am uncertain about.
- [ ] Auto contrast
- [ ] HSV adjustment (HSL, HSV, HSI, HSY, all these only work in legacy mode)
- [ ] Invert
- [ ] Levels
- [ ] Color Adjustment
- [ ] Threshold
- [ ] Halftone
- [ ] Index colors
- [ ] Posterize
- [ ] Raindrops
- [ ] Fast Color Overlay
- [ ] Color Transfer ???
- [ ] Edge Detection
- [ ] Gausian High Pass ???
- [ ] Height to Normap Map? (probably broken because edge detection is being weird)
- [ ] Emboss (all)
- [ ] Unsharp Mask
- [ ] Wavelet Noise Reducer (???)
- [ ] Gradient map (outputs HDR, but doesn't understand how to interpret it.)
- [ ] Palettize ???
- [ ] Random Noise???
Tonemap/Gamutmap
----------------
See #110
Color Selectors
---------------
Because of the three-way technology transition (Qt5 -> Qt6, X11 -> wayland, qwidgets -> qml), I propose we first get the small color selector to work in all the modern technologies before transitioning the wide-gamut selector and other dockers.
In the worst case, we might be able to use tonemapping to at the very least have the HDR colors display proper in SDR.
Links
=====
- [old phab task for maxfall/maxcll](https://phabricator.kde.org/T10627)
- Official def. maxfall/maxccl: https://ia800707.us.archive.org/27/items/CTA-861-G/CTA-861-G.pdf
- woltherav/krita#63 -- links to tone mapping info, and gamut mapping experiments.
- Probably irrelevant Qt hdr metadata support -- https://doc.qt.io/qt-6/qrhiswapchainhdrinfo.html
- [KA thread](https://krita-artists.org/t/6-1-hdr-development-thread/180642)
Will add more later.
issue