Repository navigation
Convert CalGray, CalRGB and Lab colors without white point tints - #579
Merged
Merged
Conversation
CalGray now uses its gray level directly, CalRGB converts XYZ through sRGB primaries rescaled to the space's white point, and Lab converts against a fixed daylight reference white. A non-D65 WhitePoint no longer tints these colors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CIE-based color spaces with a non-D65
WhitePoint(e.g.[0.5 1 0.5]) were tinted because XYZ was scaled by the white point and then converted with the fixed D65 matrix.Matrixgive XYZ, which is converted through sRGB primaries rescaled so RGB (1,1,1) maps to the space's white point.[0.957, 1.0, 1.0889]instead ofWhitePoint.These now match PDFium: a CalGray
0.2fill is#333333, CalRGB0.4 0.3 0.2is navy and Lab60 40 20is salmon, where Safe-PDF previously drew green, dark red and olive.Test plan
cargo conformance renderon the repro PDF: the CalGray, CalRGB and Lab squares now match PDFiumcargo test -p pdf-color-space -p pdf-graphics -p pdf-imagecargo clippy --all --workspace,cargo fmt --check🤖 Generated with Claude Code