JFLib

plat/icc.rs#

Source: lib/plat/icc.rs

icc -- the colour profile of the monitor a window is on
         [src/plat/win/win_icc.s, src/plat/linux/lx_icc.s; docs/modules/COLOR_MANAGEMENT.md]

  monitor_icc(w) -> profile bytes / None
       Windows: the ICC profile of the monitor that shows window w (0 = the main window;
       other windows use the main window's monitor; ICC_MON_PRIMARY (-1) = the primary
       monitor, no window needed): GetMonitorInfoW -> CreateDCW(device) -> GetICMProfileW
       -> the file.  No window (headless) -> None.
       Linux X11: the root window property _ICC_PROFILE (ICC Profiles in X Specification;
       set by colord / xiccd / dispwin for screen 0); profiles above 1 MB are ignored.
       Wayland: None -- the core protocol has no colour management (the compositor shows
       sRGB), so callers assume sRGB.  No display (headless): None.
       Every profile is validated (icc_check: header, 'acsp', version 2..5, tag table).
  monitor_key(w) -> u64   Windows: the HMONITOR of that monitor (0 = none) -- cheap; poll
       it every frame and query the profile again when it changes (window moved to another
       monitor).  Linux: 0 (the X11 property is per screen, not per monitor).

icc_check is a private copy of img_core::icc::icc_check (plat does not depend on the image
crates).  Linux: the X11 requests go through linux_x11.rs (x11s::root_property, marked
plat-shared there).
/// monitor_icc / monitor_key: the primary monitor instead of a window's
ICC_MON_PRIMARY: i32 = -1
  • fn monitor_icc(w: i32) -> Option<Vec<u8>> the ICC profile of the monitor showing window w (validated), None = assume sRGB [plat_monitor_icc]

  • fn monitor_key(w: i32) -> u64 a cheap key of the monitor showing window w (poll it every frame; 0 = unknown) [plat_monitor_key]

Source: docs/API.md in the JFLib repository.