Difference between revisions of "Color management Gtk4"
(Created page with " == Introduction == Inkscape has supported color management for some time using ICC color profiles. ICC color profiles are used three places in Inkscape: # For specifying a pa...") |
|||
Line 23: | Line 23: | ||
Spec: https://www.burtonini.com/computing/x-icc-profiles-spec-latest.html | Spec: https://www.burtonini.com/computing/x-icc-profiles-spec-latest.html | ||
Darktable | Darktable has a color management test: darktable-cmstest | ||
== A redesigned system== | == A redesigned system== |
Revision as of 11:49, 8 June 2023
Introduction
Inkscape has supported color management for some time using ICC color profiles. ICC color profiles are used three places in Inkscape:
- For specifying a particular color (see Fill and Stroke dialog). The profile and the color value are stored in the SVG file (see the SPObject based ColorProfile class).
- For color adjustment of monitor(s).
- For pre-flighting output.
The latter two uses are controlled by settings in the "Color management" subsection of the Input/Output section of the Preferences dialog.
The current code has some problems, particularly, the monitor adjustment code. These problems include
- Only one profile can be specified even if there are multiple displays that need different corrections.
- Retrieving a profile from a display doesn't appear to work.
- The code for retrieving display profiles relies on X11 functionality that is missing under Wayland or other windowing systems.
- The code was written for Gtk2 which defined a Gdk screen per monitor. In Gtk3, there is only one screen that can have multiple monitors. Gtk4 removes Gdk screen completely.
- Only one color transform can be specified at a time due to the use of global variables.
- The code is quite messy, based on GObject, and is poorly documented.
- The drawing doesn't always update properly.
For per monitor color correction to work under X11, a ICC profile must be attached to each monitor, verify by:
xprop -display :0.0 -len 14 -root _ICC_PROFILE
Spec: https://www.burtonini.com/computing/x-icc-profiles-spec-latest.html
Darktable has a color management test: darktable-cmstest
A redesigned system
Each canvas should have its own color transform. This color transform should be updated when:
- The user changes a preference.
- The canvas is moved to a different monitor.
The color transform is defined as a cmsHTRANSFORM (void *), this is a pointer to a data structure defined by lcms2. We need to track it, not only to avoid recreating it but also to delete it when replaced or no longer needed.
A test program for examining monitor information can be found at: https://gitlab.com/Tavmjong/gtk_sandbox/-/tree/master/gtk_monitor