Merge pull request #20982 from calixteman/debugger_images_preview

Display mask in the tree view in the debugger
This commit is contained in:
Tim van der Meij 2026-03-26 20:29:42 +01:00 committed by GitHub
commit d3fd72e7e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2082,10 +2082,13 @@ class PDFDocument {
const obj = Object.create(null);
obj.dict = await this.toJSObject(dict, false);
if (
isName(dict.get("Type"), "XObject") &&
isName(dict.get("Subtype"), "Image")
) {
if (isName(dict.get("Subtype"), "Image")) {
const isImageMask = dict.get("ImageMask") === true;
if (isImageMask) {
dict.set("ImageMask", false);
dict.set("IM", false);
value.numComps = value.bitsPerComponent = 1;
}
try {
const pdfFunctionFactory = new PDFFunctionFactory({
xref: this.xref,
@ -2113,6 +2116,11 @@ class PDFDocument {
} catch {
// Fall through to regular byte stream if image decoding fails.
}
if (isImageMask) {
dict.set("ImageMask", true);
delete value.numComps;
delete value.bitsPerComponent;
}
}
if (isName(dict.get("Subtype"), "Form")) {