Use a black backdrop for Luminosity SMasks when /BC is missing

It fixes #21346.
This commit is contained in:
Calixte Denizet 2026-05-26 22:36:46 +02:00
parent 03eda70d7e
commit a33e06cafb
4 changed files with 13 additions and 0 deletions

View File

@ -544,6 +544,11 @@ class PartialEvaluator {
if (smask?.backdrop) {
colorSpace ||= ColorSpaceUtils.rgb;
smask.backdrop = colorSpace.getRgbHex(smask.backdrop, 0);
} else if (smask?.subtype === "Luminosity") {
// Per PDF spec 11.6.5.2: when /BC is missing the backdrop is the
// initial value of the group colour space, which is black for all
// standard colour spaces.
smask.backdrop = "#000000";
}
newOpList = new CheckedOperatorList();

View File

@ -925,3 +925,4 @@
!issue18548_reduced.pdf
!issue_cff_unsigned_bbox.pdf
!90ms_rksj_h_sample.pdf
!issue21346.pdf

BIN
test/pdfs/issue21346.pdf Normal file

Binary file not shown.

View File

@ -14327,5 +14327,12 @@
"md5": "d2606e2c6cc9e679b8b88c2800c6e1a9",
"rounds": 1,
"type": "eq"
},
{
"id": "issue21346",
"file": "pdfs/issue21346.pdf",
"md5": "16b39d943d268ebfa99ee57f1f470f53",
"rounds": 1,
"type": "eq"
}
]