Commit Graph
1 Commits
Author SHA1 Message Date
a9608afe43 cms: read named-colour (ncl2) profiles and convert their colours (#747)
* cms: read named-colour (ncl2) profiles and convert their colours

A named-colour profile's ncl2 tag (ICC.1:2022 §10.17) was never read, so
a spot-colour library could not be used. Profile::named_colors() returns
its entries: the name joined from prefix, root and suffix, the PCS value
and any device coordinates. NamedColors::to_device(name, dst) converts
one into a destination profile, relative colorimetric, through the Lab
identity profile.

Lab in ncl2 uses the legacy 16-bit encoding (0xFF00 = L* 100) in every
profile version; reading it as v4 puts L* about 0.4 low. Counts are
checked against the tag size before allocating, and more than 15 device
coordinates is refused.

Adapted from icccer's named_color module (MIT, same author), rewritten
onto craft-cms types.

Refs #746

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cms: cap the ncl2 tag-table walk; doc fixes

Cap the tag count at 1024, as Profile::parse does, so the table offsets
cannot overflow on a 32-bit target. Correct the named_colors doc and add
one for is_empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cms: README notes named-colour tables are readable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: KenM76 <KenM76>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 07:12:16 -05:00