Skip to content

fix: honor PDF color component ranges - #1162

Merged
andiwand merged 2 commits into
mainfrom
review/144-pdf-color-ranges
Oct 6, 2026
Merged

andiwand merged 2 commits into
mainfrom
review/144-pdf-color-ranges

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

PDF Lab palettes and image samples were decoded as 0–1 values, so even a white palette entry could render nearly black. ICC Range arrays were ignored, and direct Lab colors were not clipped to their declared ranges.

Share component ranges across direct conversion, initial colors, palette scaling and default image decoding. Validate Lab white points and Lab/ICC range arrays, keeping the defaults for invalid values as before, and use stable interpolation for sample decoding. Shorten the color-space contracts and document the shared conversion rule. ICC profiles still use the existing alternate-space approximation.

Validation: three regressions expose 16 parent failures. All 184 color/image/parser/shading/extraction tests and 50 PDF corpus HTML-generation tests pass. Both changed implementations pass LLVM 22 clang-tidy and object builds for NDK 28.1, emsdk 3.1.73 and iOS 15. Rules follow ISO 32000-1 §§8.6.5.4–5, 8.6.6.3 and Table 90.

@andiwand
andiwand force-pushed the review/143-release-validation branch from e3bf9b1 to 4fd5f32 Compare October 6, 2026 18:49
Base automatically changed from review/143-release-validation to main October 6, 2026 18:50
andiwand and others added 2 commits October 6, 2026 20:52
An invalid ICC Range, an invalid Lab WhitePoint or Range, or a Lab space
without parameters rejected the whole colour space. scn then read the
three Lab components as RGB. Main used the defaults in all these cases,
and they stay valid: the white point and the ranges are only taken when
they pass the checks that protect the conversion.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
@andiwand
andiwand force-pushed the review/144-pdf-color-ranges branch from 7ddc641 to 32d0291 Compare October 6, 2026 18:57
@andiwand
andiwand merged commit ca7b0d6 into main Oct 6, 2026
21 of 23 checks passed
@andiwand
andiwand deleted the review/144-pdf-color-ranges branch October 6, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant