@poe-platform/safe-bash 0.1.766 → 0.1.767
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-ast/index.browser.js +25 -10
- package/dist/image-ast/index.js +25 -10
- package/dist/pdf-ast/ast.d.ts +1 -1
- package/dist/pdf-ast/index.js +27 -10
- package/dist/safe-bash/command-chunks/{chunk-XFUFHHLU.js → chunk-2JQONXIY.js} +25 -10
- package/dist/safe-bash/command-chunks/{chunk-IOH3F3ZO.js → chunk-A5S6M37L.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-DKWMTHU3.js → chunk-G55GHZV2.js} +2 -2
- package/dist/safe-bash-command-ffmpeg/index.js +4356 -4349
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +25 -10
- package/dist/safe-bash-command-pdfinfo/index.js +27 -10
- package/dist/safe-bash-command-pdftk/index.js +25 -10
- package/dist/safe-bash-command-pdftoppm/index.js +27 -10
- package/dist/safe-bash-command-pdftotext/index.js +25 -10
- package/dist/safe-bash-command-qpdf/index.js +25 -10
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +31 -19
- package/dist/safe-bash-command-wkhtmltopdf/index.js +25 -10
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +9 -0
|
@@ -43897,8 +43897,9 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43897
43897
|
const st = curState();
|
|
43898
43898
|
const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
|
|
43899
43899
|
const groupType = group ? params.cosDoc.resolve(dictGet(group, "S")) : void 0;
|
|
43900
|
-
const
|
|
43901
|
-
const
|
|
43900
|
+
const isolation = group ? params.cosDoc.resolve(dictGet(group, "I")) : void 0;
|
|
43901
|
+
const isolated = isolation?.kind === "boolean" && isolation.value;
|
|
43902
|
+
const compositeGroup = !maskGroup && groupType?.kind === "name" && groupType.decoded === "Transparency" && (isolated || st.fillAlpha !== 1 || !!st.softMask || st.blendMode !== "Normal" && st.blendMode !== "Compatible");
|
|
43902
43903
|
const formStreamBytes = params.cosDoc.decodeStream(form);
|
|
43903
43904
|
const formNodes = parseContentStream(formStreamBytes);
|
|
43904
43905
|
const formResDict = params.cosDoc.resolveDict(dictGet(form.dict, "Resources")) ?? activeResources;
|
|
@@ -43916,8 +43917,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43916
43917
|
const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
|
|
43917
43918
|
nextCtm = multiplyMatrices(formMat, nextCtm);
|
|
43918
43919
|
}
|
|
43919
|
-
let nextClip = !
|
|
43920
|
-
let nextClipPaths =
|
|
43920
|
+
let nextClip = !compositeGroup && st.clipRect ? [...st.clipRect] : void 0;
|
|
43921
|
+
let nextClipPaths = compositeGroup ? void 0 : st.clipPaths;
|
|
43921
43922
|
const bboxArr = params.cosDoc.resolveArray(dictGet(form.dict, "BBox"));
|
|
43922
43923
|
if (bboxArr && bboxArr.items.length >= 4) {
|
|
43923
43924
|
const bn = (idx, fb = 0) => {
|
|
@@ -43951,7 +43952,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43951
43952
|
const parentOperations = capturedOperations;
|
|
43952
43953
|
const children = [];
|
|
43953
43954
|
const nextState = { ...st, ctm: nextCtm };
|
|
43954
|
-
if (
|
|
43955
|
+
if (compositeGroup) {
|
|
43955
43956
|
capturedOperations = children;
|
|
43956
43957
|
nextState.fillAlpha = nextState.strokeAlpha = 1;
|
|
43957
43958
|
nextState.blendMode = "Normal";
|
|
@@ -43969,7 +43970,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43969
43970
|
stateStack.pop();
|
|
43970
43971
|
capturedOperations = parentOperations;
|
|
43971
43972
|
}
|
|
43972
|
-
if (
|
|
43973
|
+
if (compositeGroup) emit({ kind: "group", value: { operations: children, alpha: st.fillAlpha, blendMode: st.blendMode, clipRect: st.clipRect } });
|
|
43973
43974
|
};
|
|
43974
43975
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
43975
43976
|
for (const node of nodes) {
|
|
@@ -47947,6 +47948,9 @@ function renderSoftMask(mask, displayList, scale) {
|
|
|
47947
47948
|
}
|
|
47948
47949
|
return bitmap;
|
|
47949
47950
|
}
|
|
47951
|
+
function hasBlendModes(operations) {
|
|
47952
|
+
return operations.some((operation) => !!operation.value.blendMode && operation.value.blendMode !== "Normal" && operation.value.blendMode !== "Compatible" || operation.kind === "group" && hasBlendModes(operation.value.operations));
|
|
47953
|
+
}
|
|
47950
47954
|
function renderDisplayListToBitmap(displayList, options = {}) {
|
|
47951
47955
|
const baseScale = options.scale ?? (options.dpi ? options.dpi / 72 : 1.5);
|
|
47952
47956
|
const scaleX = options.dpiX !== void 0 ? options.dpiX / 72 : baseScale;
|
|
@@ -47955,11 +47959,13 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
47955
47959
|
const width = Math.max(1, Math.round(displayList.width * scale));
|
|
47956
47960
|
const height = Math.max(1, Math.round(displayList.height * scale));
|
|
47957
47961
|
const rgba = new Uint8Array(width * height * 4);
|
|
47962
|
+
const deferBackground = !options.transparent && hasBlendModes(paintOperations(displayList));
|
|
47963
|
+
const transparent = options.transparent || deferBackground;
|
|
47958
47964
|
const bg = options.background ?? { r: 1, g: 1, b: 1 };
|
|
47959
|
-
const bgR =
|
|
47960
|
-
const bgG =
|
|
47961
|
-
const bgB =
|
|
47962
|
-
const bgA =
|
|
47965
|
+
const bgR = transparent ? 0 : Math.round(bg.r * 255);
|
|
47966
|
+
const bgG = transparent ? 0 : Math.round(bg.g * 255);
|
|
47967
|
+
const bgB = transparent ? 0 : Math.round(bg.b * 255);
|
|
47968
|
+
const bgA = transparent ? 0 : 255;
|
|
47963
47969
|
for (let i = 0; i < width * height; i++) {
|
|
47964
47970
|
rgba[i * 4] = bgR;
|
|
47965
47971
|
rgba[i * 4 + 1] = bgG;
|
|
@@ -48136,6 +48142,15 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
48136
48142
|
}
|
|
48137
48143
|
}
|
|
48138
48144
|
}
|
|
48145
|
+
if (deferBackground) {
|
|
48146
|
+
for (let i = 0; i < rgba.length; i += 4) {
|
|
48147
|
+
const alpha = rgba[i + 3] / 255;
|
|
48148
|
+
rgba[i] = Math.round(rgba[i] * alpha + bg.r * 255 * (1 - alpha));
|
|
48149
|
+
rgba[i + 1] = Math.round(rgba[i + 1] * alpha + bg.g * 255 * (1 - alpha));
|
|
48150
|
+
rgba[i + 2] = Math.round(rgba[i + 2] * alpha + bg.b * 255 * (1 - alpha));
|
|
48151
|
+
rgba[i + 3] = 255;
|
|
48152
|
+
}
|
|
48153
|
+
}
|
|
48139
48154
|
let result = { width, height, data: rgba };
|
|
48140
48155
|
if (Math.abs(scaleX - scaleY) > 1e-6) {
|
|
48141
48156
|
const targetW = Math.max(1, Math.round(displayList.width * scaleX));
|
package/dist/image-ast/index.js
CHANGED
|
@@ -43897,8 +43897,9 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43897
43897
|
const st = curState();
|
|
43898
43898
|
const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
|
|
43899
43899
|
const groupType = group ? params.cosDoc.resolve(dictGet(group, "S")) : void 0;
|
|
43900
|
-
const
|
|
43901
|
-
const
|
|
43900
|
+
const isolation = group ? params.cosDoc.resolve(dictGet(group, "I")) : void 0;
|
|
43901
|
+
const isolated = isolation?.kind === "boolean" && isolation.value;
|
|
43902
|
+
const compositeGroup = !maskGroup && groupType?.kind === "name" && groupType.decoded === "Transparency" && (isolated || st.fillAlpha !== 1 || !!st.softMask || st.blendMode !== "Normal" && st.blendMode !== "Compatible");
|
|
43902
43903
|
const formStreamBytes = params.cosDoc.decodeStream(form);
|
|
43903
43904
|
const formNodes = parseContentStream(formStreamBytes);
|
|
43904
43905
|
const formResDict = params.cosDoc.resolveDict(dictGet(form.dict, "Resources")) ?? activeResources;
|
|
@@ -43916,8 +43917,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43916
43917
|
const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
|
|
43917
43918
|
nextCtm = multiplyMatrices(formMat, nextCtm);
|
|
43918
43919
|
}
|
|
43919
|
-
let nextClip = !
|
|
43920
|
-
let nextClipPaths =
|
|
43920
|
+
let nextClip = !compositeGroup && st.clipRect ? [...st.clipRect] : void 0;
|
|
43921
|
+
let nextClipPaths = compositeGroup ? void 0 : st.clipPaths;
|
|
43921
43922
|
const bboxArr = params.cosDoc.resolveArray(dictGet(form.dict, "BBox"));
|
|
43922
43923
|
if (bboxArr && bboxArr.items.length >= 4) {
|
|
43923
43924
|
const bn = (idx, fb = 0) => {
|
|
@@ -43951,7 +43952,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43951
43952
|
const parentOperations = capturedOperations;
|
|
43952
43953
|
const children = [];
|
|
43953
43954
|
const nextState = { ...st, ctm: nextCtm };
|
|
43954
|
-
if (
|
|
43955
|
+
if (compositeGroup) {
|
|
43955
43956
|
capturedOperations = children;
|
|
43956
43957
|
nextState.fillAlpha = nextState.strokeAlpha = 1;
|
|
43957
43958
|
nextState.blendMode = "Normal";
|
|
@@ -43969,7 +43970,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43969
43970
|
stateStack.pop();
|
|
43970
43971
|
capturedOperations = parentOperations;
|
|
43971
43972
|
}
|
|
43972
|
-
if (
|
|
43973
|
+
if (compositeGroup) emit({ kind: "group", value: { operations: children, alpha: st.fillAlpha, blendMode: st.blendMode, clipRect: st.clipRect } });
|
|
43973
43974
|
};
|
|
43974
43975
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
43975
43976
|
for (const node of nodes) {
|
|
@@ -47947,6 +47948,9 @@ function renderSoftMask(mask, displayList, scale) {
|
|
|
47947
47948
|
}
|
|
47948
47949
|
return bitmap;
|
|
47949
47950
|
}
|
|
47951
|
+
function hasBlendModes(operations) {
|
|
47952
|
+
return operations.some((operation) => !!operation.value.blendMode && operation.value.blendMode !== "Normal" && operation.value.blendMode !== "Compatible" || operation.kind === "group" && hasBlendModes(operation.value.operations));
|
|
47953
|
+
}
|
|
47950
47954
|
function renderDisplayListToBitmap(displayList, options = {}) {
|
|
47951
47955
|
const baseScale = options.scale ?? (options.dpi ? options.dpi / 72 : 1.5);
|
|
47952
47956
|
const scaleX = options.dpiX !== void 0 ? options.dpiX / 72 : baseScale;
|
|
@@ -47955,11 +47959,13 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
47955
47959
|
const width = Math.max(1, Math.round(displayList.width * scale));
|
|
47956
47960
|
const height = Math.max(1, Math.round(displayList.height * scale));
|
|
47957
47961
|
const rgba = new Uint8Array(width * height * 4);
|
|
47962
|
+
const deferBackground = !options.transparent && hasBlendModes(paintOperations(displayList));
|
|
47963
|
+
const transparent = options.transparent || deferBackground;
|
|
47958
47964
|
const bg = options.background ?? { r: 1, g: 1, b: 1 };
|
|
47959
|
-
const bgR =
|
|
47960
|
-
const bgG =
|
|
47961
|
-
const bgB =
|
|
47962
|
-
const bgA =
|
|
47965
|
+
const bgR = transparent ? 0 : Math.round(bg.r * 255);
|
|
47966
|
+
const bgG = transparent ? 0 : Math.round(bg.g * 255);
|
|
47967
|
+
const bgB = transparent ? 0 : Math.round(bg.b * 255);
|
|
47968
|
+
const bgA = transparent ? 0 : 255;
|
|
47963
47969
|
for (let i = 0; i < width * height; i++) {
|
|
47964
47970
|
rgba[i * 4] = bgR;
|
|
47965
47971
|
rgba[i * 4 + 1] = bgG;
|
|
@@ -48136,6 +48142,15 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
48136
48142
|
}
|
|
48137
48143
|
}
|
|
48138
48144
|
}
|
|
48145
|
+
if (deferBackground) {
|
|
48146
|
+
for (let i = 0; i < rgba.length; i += 4) {
|
|
48147
|
+
const alpha = rgba[i + 3] / 255;
|
|
48148
|
+
rgba[i] = Math.round(rgba[i] * alpha + bg.r * 255 * (1 - alpha));
|
|
48149
|
+
rgba[i + 1] = Math.round(rgba[i + 1] * alpha + bg.g * 255 * (1 - alpha));
|
|
48150
|
+
rgba[i + 2] = Math.round(rgba[i + 2] * alpha + bg.b * 255 * (1 - alpha));
|
|
48151
|
+
rgba[i + 3] = 255;
|
|
48152
|
+
}
|
|
48153
|
+
}
|
|
48139
48154
|
let result = { width, height, data: rgba };
|
|
48140
48155
|
if (Math.abs(scaleX - scaleY) > 1e-6) {
|
|
48141
48156
|
const targetW = Math.max(1, Math.round(displayList.width * scaleX));
|
package/dist/pdf-ast/ast.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ export type PdfPaintOperation = {
|
|
|
294
294
|
readonly kind: "group";
|
|
295
295
|
readonly value: PdfPaintGroup;
|
|
296
296
|
};
|
|
297
|
-
/**
|
|
297
|
+
/** A transparency Form, composited after painting its children. */
|
|
298
298
|
export interface PdfPaintGroup {
|
|
299
299
|
readonly operations: readonly PdfPaintOperation[];
|
|
300
300
|
readonly alpha: number;
|
package/dist/pdf-ast/index.js
CHANGED
|
@@ -36611,8 +36611,9 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36611
36611
|
const st = curState();
|
|
36612
36612
|
const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
|
|
36613
36613
|
const groupType = group ? params.cosDoc.resolve(dictGet(group, "S")) : void 0;
|
|
36614
|
-
const
|
|
36615
|
-
const
|
|
36614
|
+
const isolation = group ? params.cosDoc.resolve(dictGet(group, "I")) : void 0;
|
|
36615
|
+
const isolated = isolation?.kind === "boolean" && isolation.value;
|
|
36616
|
+
const compositeGroup = !maskGroup && groupType?.kind === "name" && groupType.decoded === "Transparency" && (isolated || st.fillAlpha !== 1 || !!st.softMask || st.blendMode !== "Normal" && st.blendMode !== "Compatible");
|
|
36616
36617
|
const formStreamBytes = params.cosDoc.decodeStream(form);
|
|
36617
36618
|
const formNodes = parseContentStream(formStreamBytes);
|
|
36618
36619
|
const formResDict = params.cosDoc.resolveDict(dictGet(form.dict, "Resources")) ?? activeResources;
|
|
@@ -36630,8 +36631,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36630
36631
|
const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
|
|
36631
36632
|
nextCtm = multiplyMatrices(formMat, nextCtm);
|
|
36632
36633
|
}
|
|
36633
|
-
let nextClip = !
|
|
36634
|
-
let nextClipPaths =
|
|
36634
|
+
let nextClip = !compositeGroup && st.clipRect ? [...st.clipRect] : void 0;
|
|
36635
|
+
let nextClipPaths = compositeGroup ? void 0 : st.clipPaths;
|
|
36635
36636
|
const bboxArr = params.cosDoc.resolveArray(dictGet(form.dict, "BBox"));
|
|
36636
36637
|
if (bboxArr && bboxArr.items.length >= 4) {
|
|
36637
36638
|
const bn = (idx, fb = 0) => {
|
|
@@ -36665,7 +36666,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36665
36666
|
const parentOperations = capturedOperations;
|
|
36666
36667
|
const children = [];
|
|
36667
36668
|
const nextState = { ...st, ctm: nextCtm };
|
|
36668
|
-
if (
|
|
36669
|
+
if (compositeGroup) {
|
|
36669
36670
|
capturedOperations = children;
|
|
36670
36671
|
nextState.fillAlpha = nextState.strokeAlpha = 1;
|
|
36671
36672
|
nextState.blendMode = "Normal";
|
|
@@ -36683,7 +36684,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36683
36684
|
stateStack.pop();
|
|
36684
36685
|
capturedOperations = parentOperations;
|
|
36685
36686
|
}
|
|
36686
|
-
if (
|
|
36687
|
+
if (compositeGroup) emit({ kind: "group", value: { operations: children, alpha: st.fillAlpha, blendMode: st.blendMode, clipRect: st.clipRect } });
|
|
36687
36688
|
};
|
|
36688
36689
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
36689
36690
|
for (const node of nodes) {
|
|
@@ -41754,6 +41755,9 @@ function renderSoftMask(mask, displayList, scale) {
|
|
|
41754
41755
|
}
|
|
41755
41756
|
return bitmap;
|
|
41756
41757
|
}
|
|
41758
|
+
function hasBlendModes(operations) {
|
|
41759
|
+
return operations.some((operation) => !!operation.value.blendMode && operation.value.blendMode !== "Normal" && operation.value.blendMode !== "Compatible" || operation.kind === "group" && hasBlendModes(operation.value.operations));
|
|
41760
|
+
}
|
|
41757
41761
|
function renderDisplayListToBitmap(displayList, options = {}) {
|
|
41758
41762
|
const baseScale = options.scale ?? (options.dpi ? options.dpi / 72 : 1.5);
|
|
41759
41763
|
const scaleX = options.dpiX !== void 0 ? options.dpiX / 72 : baseScale;
|
|
@@ -41762,11 +41766,13 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
41762
41766
|
const width = Math.max(1, Math.round(displayList.width * scale));
|
|
41763
41767
|
const height = Math.max(1, Math.round(displayList.height * scale));
|
|
41764
41768
|
const rgba = new Uint8Array(width * height * 4);
|
|
41769
|
+
const deferBackground = !options.transparent && hasBlendModes(paintOperations(displayList));
|
|
41770
|
+
const transparent = options.transparent || deferBackground;
|
|
41765
41771
|
const bg = options.background ?? { r: 1, g: 1, b: 1 };
|
|
41766
|
-
const bgR =
|
|
41767
|
-
const bgG =
|
|
41768
|
-
const bgB =
|
|
41769
|
-
const bgA =
|
|
41772
|
+
const bgR = transparent ? 0 : Math.round(bg.r * 255);
|
|
41773
|
+
const bgG = transparent ? 0 : Math.round(bg.g * 255);
|
|
41774
|
+
const bgB = transparent ? 0 : Math.round(bg.b * 255);
|
|
41775
|
+
const bgA = transparent ? 0 : 255;
|
|
41770
41776
|
for (let i = 0; i < width * height; i++) {
|
|
41771
41777
|
rgba[i * 4] = bgR;
|
|
41772
41778
|
rgba[i * 4 + 1] = bgG;
|
|
@@ -41943,6 +41949,15 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
41943
41949
|
}
|
|
41944
41950
|
}
|
|
41945
41951
|
}
|
|
41952
|
+
if (deferBackground) {
|
|
41953
|
+
for (let i = 0; i < rgba.length; i += 4) {
|
|
41954
|
+
const alpha = rgba[i + 3] / 255;
|
|
41955
|
+
rgba[i] = Math.round(rgba[i] * alpha + bg.r * 255 * (1 - alpha));
|
|
41956
|
+
rgba[i + 1] = Math.round(rgba[i + 1] * alpha + bg.g * 255 * (1 - alpha));
|
|
41957
|
+
rgba[i + 2] = Math.round(rgba[i + 2] * alpha + bg.b * 255 * (1 - alpha));
|
|
41958
|
+
rgba[i + 3] = 255;
|
|
41959
|
+
}
|
|
41960
|
+
}
|
|
41946
41961
|
let result = { width, height, data: rgba };
|
|
41947
41962
|
if (Math.abs(scaleX - scaleY) > 1e-6) {
|
|
41948
41963
|
const targetW = Math.max(1, Math.round(displayList.width * scaleX));
|
|
@@ -42051,6 +42066,7 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
42051
42066
|
if (!options.transparent) {
|
|
42052
42067
|
parts.push(` <rect x="${vbX}" y="${vbY}" width="${vbW}" height="${vbH}" fill="#ffffff"/>`);
|
|
42053
42068
|
}
|
|
42069
|
+
parts.push('<g style="isolation:isolate">');
|
|
42054
42070
|
if (displayList.rotation) {
|
|
42055
42071
|
const [a, b, c, d, e, f] = viewport.transform;
|
|
42056
42072
|
parts.push(`<g transform="matrix(${a} ${b} ${-c} ${-d} ${e + c * displayList.height} ${f + d * displayList.height})">`);
|
|
@@ -42138,6 +42154,7 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
42138
42154
|
};
|
|
42139
42155
|
appendOperations(paintOperations(displayList));
|
|
42140
42156
|
if (displayList.rotation) parts.push("</g>");
|
|
42157
|
+
parts.push("</g>");
|
|
42141
42158
|
parts.push("</svg>\n");
|
|
42142
42159
|
return parts.join("\n");
|
|
42143
42160
|
}
|
|
@@ -32406,8 +32406,9 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32406
32406
|
const st = curState();
|
|
32407
32407
|
const group = params.cosDoc.resolveDict(dictGet(form.dict, "Group"));
|
|
32408
32408
|
const groupType = group ? params.cosDoc.resolve(dictGet(group, "S")) : void 0;
|
|
32409
|
-
const
|
|
32410
|
-
const
|
|
32409
|
+
const isolation = group ? params.cosDoc.resolve(dictGet(group, "I")) : void 0;
|
|
32410
|
+
const isolated = isolation?.kind === "boolean" && isolation.value;
|
|
32411
|
+
const compositeGroup = !maskGroup && groupType?.kind === "name" && groupType.decoded === "Transparency" && (isolated || st.fillAlpha !== 1 || !!st.softMask || st.blendMode !== "Normal" && st.blendMode !== "Compatible");
|
|
32411
32412
|
const formStreamBytes = params.cosDoc.decodeStream(form);
|
|
32412
32413
|
const formNodes = parseContentStream(formStreamBytes);
|
|
32413
32414
|
const formResDict = params.cosDoc.resolveDict(dictGet(form.dict, "Resources")) ?? activeResources;
|
|
@@ -32425,8 +32426,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32425
32426
|
const formMat = [mn(0, 1), mn(1, 0), mn(2, 0), mn(3, 1), mn(4, 0), mn(5, 0)];
|
|
32426
32427
|
nextCtm = multiplyMatrices(formMat, nextCtm);
|
|
32427
32428
|
}
|
|
32428
|
-
let nextClip = !
|
|
32429
|
-
let nextClipPaths =
|
|
32429
|
+
let nextClip = !compositeGroup && st.clipRect ? [...st.clipRect] : void 0;
|
|
32430
|
+
let nextClipPaths = compositeGroup ? void 0 : st.clipPaths;
|
|
32430
32431
|
const bboxArr = params.cosDoc.resolveArray(dictGet(form.dict, "BBox"));
|
|
32431
32432
|
if (bboxArr && bboxArr.items.length >= 4) {
|
|
32432
32433
|
const bn = (idx, fb = 0) => {
|
|
@@ -32460,7 +32461,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32460
32461
|
const parentOperations = capturedOperations;
|
|
32461
32462
|
const children = [];
|
|
32462
32463
|
const nextState = { ...st, ctm: nextCtm };
|
|
32463
|
-
if (
|
|
32464
|
+
if (compositeGroup) {
|
|
32464
32465
|
capturedOperations = children;
|
|
32465
32466
|
nextState.fillAlpha = nextState.strokeAlpha = 1;
|
|
32466
32467
|
nextState.blendMode = "Normal";
|
|
@@ -32478,7 +32479,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32478
32479
|
stateStack.pop();
|
|
32479
32480
|
capturedOperations = parentOperations;
|
|
32480
32481
|
}
|
|
32481
|
-
if (
|
|
32482
|
+
if (compositeGroup) emit({ kind: "group", value: { operations: children, alpha: st.fillAlpha, blendMode: st.blendMode, clipRect: st.clipRect } });
|
|
32482
32483
|
};
|
|
32483
32484
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
32484
32485
|
for (const node of nodes) {
|
|
@@ -35252,6 +35253,9 @@ function renderSoftMask(mask, displayList, scale) {
|
|
|
35252
35253
|
}
|
|
35253
35254
|
return bitmap;
|
|
35254
35255
|
}
|
|
35256
|
+
function hasBlendModes(operations) {
|
|
35257
|
+
return operations.some((operation) => !!operation.value.blendMode && operation.value.blendMode !== "Normal" && operation.value.blendMode !== "Compatible" || operation.kind === "group" && hasBlendModes(operation.value.operations));
|
|
35258
|
+
}
|
|
35255
35259
|
function renderDisplayListToBitmap(displayList, options = {}) {
|
|
35256
35260
|
const baseScale = options.scale ?? (options.dpi ? options.dpi / 72 : 1.5);
|
|
35257
35261
|
const scaleX = options.dpiX !== void 0 ? options.dpiX / 72 : baseScale;
|
|
@@ -35260,11 +35264,13 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
35260
35264
|
const width = Math.max(1, Math.round(displayList.width * scale));
|
|
35261
35265
|
const height = Math.max(1, Math.round(displayList.height * scale));
|
|
35262
35266
|
const rgba = new Uint8Array(width * height * 4);
|
|
35267
|
+
const deferBackground = !options.transparent && hasBlendModes(paintOperations(displayList));
|
|
35268
|
+
const transparent = options.transparent || deferBackground;
|
|
35263
35269
|
const bg = options.background ?? { r: 1, g: 1, b: 1 };
|
|
35264
|
-
const bgR =
|
|
35265
|
-
const bgG =
|
|
35266
|
-
const bgB =
|
|
35267
|
-
const bgA =
|
|
35270
|
+
const bgR = transparent ? 0 : Math.round(bg.r * 255);
|
|
35271
|
+
const bgG = transparent ? 0 : Math.round(bg.g * 255);
|
|
35272
|
+
const bgB = transparent ? 0 : Math.round(bg.b * 255);
|
|
35273
|
+
const bgA = transparent ? 0 : 255;
|
|
35268
35274
|
for (let i = 0; i < width * height; i++) {
|
|
35269
35275
|
rgba[i * 4] = bgR;
|
|
35270
35276
|
rgba[i * 4 + 1] = bgG;
|
|
@@ -35441,6 +35447,15 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
35441
35447
|
}
|
|
35442
35448
|
}
|
|
35443
35449
|
}
|
|
35450
|
+
if (deferBackground) {
|
|
35451
|
+
for (let i = 0; i < rgba.length; i += 4) {
|
|
35452
|
+
const alpha = rgba[i + 3] / 255;
|
|
35453
|
+
rgba[i] = Math.round(rgba[i] * alpha + bg.r * 255 * (1 - alpha));
|
|
35454
|
+
rgba[i + 1] = Math.round(rgba[i + 1] * alpha + bg.g * 255 * (1 - alpha));
|
|
35455
|
+
rgba[i + 2] = Math.round(rgba[i + 2] * alpha + bg.b * 255 * (1 - alpha));
|
|
35456
|
+
rgba[i + 3] = 255;
|
|
35457
|
+
}
|
|
35458
|
+
}
|
|
35444
35459
|
let result = { width, height, data: rgba };
|
|
35445
35460
|
if (Math.abs(scaleX - scaleY) > 1e-6) {
|
|
35446
35461
|
const targetW = Math.max(1, Math.round(displayList.width * scaleX));
|
|
@@ -48,11 +48,11 @@ import {
|
|
|
48
48
|
trimImage,
|
|
49
49
|
unflattenImage,
|
|
50
50
|
unpremultiplyRgbaImage
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-A5S6M37L.js";
|
|
52
52
|
import {
|
|
53
53
|
PdfDocument,
|
|
54
54
|
encodePng
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-2JQONXIY.js";
|
|
56
56
|
import {
|
|
57
57
|
createLuaFilterCapability
|
|
58
58
|
} from "./chunk-Y2KHC6TZ.js";
|