Skip to content

NSColorSpace: return ICC profile data for the generic RGB space (prototype)#508

Open
DTW-Thalion wants to merge 2 commits into
gnustep:masterfrom
DTW-Thalion:fix/nscolorspace-icc-profile
Open

NSColorSpace: return ICC profile data for the generic RGB space (prototype)#508
DTW-Thalion wants to merge 2 commits into
gnustep:masterfrom
DTW-Thalion:fix/nscolorspace-icc-profile

Conversation

@DTW-Thalion

@DTW-Thalion DTW-Thalion commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Prototype. NSColorSpace stored ICC data only when one was passed to initWithICCProfileData:; the standard colour spaces returned nil, where AppKit returns a profile for the generic spaces.

This adds the ICC sRGB v2 reference profile (sRGB2014.icc) as a gui library resource and loads it for +genericRGBColorSpace, so -ICCProfileData returns a valid profile. The profile is the International Color Consortium reference profile from https://registry.color.org/rgb-registry/srgbprofiles, redistributed unmodified under the ICC licence ("may be copied, distributed, embedded, made, used, and sold without restriction"); its provenance and licence are recorded in Resources/ColorSpaces/README. No Apple profile data is used (for obvious reasons).

Scope: only the generic RGB space is wired up, and this is deliberate. I looked at extending it to the generic gray and CMYK spaces and found no cleanly-licensed ICC-registry source for either:

  • The ICC registry has no generic grayscale profile.
  • Its CMYK profiles are all third-party (APTEC, ECI, Idealliance) with no stated permissive licence, so they are not safe to embed here. The only ICC-owned CMYK-adjacent profile, PRMG, is a reference-gamut exchange profile rather than a CMYK output space, so it is the wrong fit for genericCMYK.

So gray and CMYK are left returning nil for now. They could be added later either from a suitably-licensed profile or by synthesising minimal profiles, which is a maintainer call. The device spaces are also left without a profile, matching AppKit.

Whether sRGB is the right mapping for the generic RGB space, and whether to take on colour management more generally (e.g. via lcms2), is a design decision for the GNUStep team, but this at least puts the fraamework in place using a fully permissive licensed file.

Stacked on #507 (adds an assertion to its NSColorSpace test); merge that first.

Cover the model enum values, and the colour space model, component
count, name and singleton identity of the standard colour spaces.
The generic RGB colour space now reports an ICC profile, loaded from the
ICC sRGB v2 reference profile that ships as a gui library resource. This
is a first step; the generic gray and CMYK spaces can follow the same
pattern with their own reference profiles.
@DTW-Thalion
DTW-Thalion requested a review from fredkiefer as a code owner July 13, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant