Skip to content

Commit 867af5c

Browse files
committed
Display mask in the tree view in the debugger
1 parent 777251d commit 867af5c

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/core/document.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,10 +2082,13 @@ class PDFDocument {
20822082
const obj = Object.create(null);
20832083
obj.dict = await this.toJSObject(dict, false);
20842084

2085-
if (
2086-
isName(dict.get("Type"), "XObject") &&
2087-
isName(dict.get("Subtype"), "Image")
2088-
) {
2085+
if (isName(dict.get("Subtype"), "Image")) {
2086+
const isImageMask = dict.get("ImageMask") === true;
2087+
if (isImageMask) {
2088+
dict.set("ImageMask", false);
2089+
dict.set("IM", false);
2090+
value.numComps = value.bitsPerComponent = 1;
2091+
}
20892092
try {
20902093
const pdfFunctionFactory = new PDFFunctionFactory({
20912094
xref: this.xref,
@@ -2113,6 +2116,11 @@ class PDFDocument {
21132116
} catch {
21142117
// Fall through to regular byte stream if image decoding fails.
21152118
}
2119+
if (isImageMask) {
2120+
dict.set("ImageMask", true);
2121+
delete value.numComps;
2122+
delete value.bitsPerComponent;
2123+
}
21162124
}
21172125

21182126
if (isName(dict.get("Subtype"), "Form")) {

0 commit comments

Comments
 (0)