@poe-platform/safe-bash 0.1.765 → 0.1.766
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 +17 -8
- package/dist/image-ast/index.js +17 -8
- package/dist/pdf-ast/index.js +29 -11
- package/dist/safe-bash/command-chunks/{chunk-DT4MFWV4.js → chunk-DKWMTHU3.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-SVL6HYQL.js → chunk-IOH3F3ZO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KO4PXCNL.js → chunk-XFUFHHLU.js} +17 -8
- package/dist/safe-bash-command-ffmpeg/index.js +199 -192
- 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 +17 -8
- package/dist/safe-bash-command-pdfinfo/index.js +29 -11
- package/dist/safe-bash-command-pdftk/index.js +17 -8
- package/dist/safe-bash-command-pdftoppm/index.js +29 -11
- package/dist/safe-bash-command-pdftotext/index.js +17 -8
- package/dist/safe-bash-command-qpdf/index.js +17 -8
- 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 +17 -8
- package/dist/safe-bash-command-wkhtmltopdf/index.js +17 -8
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +3 -0
|
@@ -43838,10 +43838,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43838
43838
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
43839
43839
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
43840
43840
|
if (patArr) {
|
|
43841
|
-
|
|
43841
|
+
const dashArray = patArr.items.map((it) => {
|
|
43842
43842
|
const r = params.cosDoc.resolve(it);
|
|
43843
43843
|
return r?.kind === "number" ? r.value : 0;
|
|
43844
|
-
}).filter((n) => n
|
|
43844
|
+
}).filter((n) => n >= 0);
|
|
43845
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
43845
43846
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
43846
43847
|
}
|
|
43847
43848
|
}
|
|
@@ -46845,7 +46846,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
46845
46846
|
while (remaining <= 0) {
|
|
46846
46847
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
46847
46848
|
if (index % 2 === 0) {
|
|
46848
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
46849
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
46849
46850
|
flush();
|
|
46850
46851
|
}
|
|
46851
46852
|
index = (index + 1) % pattern.length;
|
|
@@ -46860,7 +46861,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
46860
46861
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
46861
46862
|
}
|
|
46862
46863
|
let distance = 0;
|
|
46863
|
-
while (distance
|
|
46864
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
46864
46865
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
46865
46866
|
advance(point);
|
|
46866
46867
|
const step = Math.min(remaining, length - distance);
|
|
@@ -46975,7 +46976,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
46975
46976
|
let closed = subpath.closed;
|
|
46976
46977
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
46977
46978
|
if (points.length < 3) closed = false;
|
|
46978
|
-
if (points.length === 1 &&
|
|
46979
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
46980
|
+
contour = [];
|
|
46981
|
+
const [x, y] = points[0];
|
|
46982
|
+
add(x - half, y - half);
|
|
46983
|
+
add(x + half, y - half);
|
|
46984
|
+
add(x + half, y + half);
|
|
46985
|
+
add(x - half, y + half);
|
|
46986
|
+
contours.push(contour);
|
|
46987
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
46979
46988
|
contour = [];
|
|
46980
46989
|
const [x, y] = points[0];
|
|
46981
46990
|
addCap([x, y], [x + 1, y]);
|
|
@@ -47767,7 +47776,7 @@ function prepareStroke(path, scale) {
|
|
|
47767
47776
|
}
|
|
47768
47777
|
return { matrix, width, dashArray, dashPhase };
|
|
47769
47778
|
}
|
|
47770
|
-
function
|
|
47779
|
+
function strokeContours(path, pageHeight, scale) {
|
|
47771
47780
|
const stroke = prepareStroke(path, scale);
|
|
47772
47781
|
if (!stroke) return [];
|
|
47773
47782
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -47791,7 +47800,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
47791
47800
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
47792
47801
|
stroke.dashPhase * strokeScale
|
|
47793
47802
|
);
|
|
47794
|
-
return
|
|
47803
|
+
return contours.map((points) => points.map(toScreen));
|
|
47795
47804
|
}
|
|
47796
47805
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
47797
47806
|
const edges = [];
|
|
@@ -48044,7 +48053,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
48044
48053
|
if (path.strokeColor) {
|
|
48045
48054
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
48046
48055
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
48047
|
-
const edges =
|
|
48056
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
48048
48057
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
48049
48058
|
fillEdgesScanline4x4(
|
|
48050
48059
|
rgba,
|
package/dist/image-ast/index.js
CHANGED
|
@@ -43838,10 +43838,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
43838
43838
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
43839
43839
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
43840
43840
|
if (patArr) {
|
|
43841
|
-
|
|
43841
|
+
const dashArray = patArr.items.map((it) => {
|
|
43842
43842
|
const r = params.cosDoc.resolve(it);
|
|
43843
43843
|
return r?.kind === "number" ? r.value : 0;
|
|
43844
|
-
}).filter((n) => n
|
|
43844
|
+
}).filter((n) => n >= 0);
|
|
43845
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
43845
43846
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
43846
43847
|
}
|
|
43847
43848
|
}
|
|
@@ -46845,7 +46846,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
46845
46846
|
while (remaining <= 0) {
|
|
46846
46847
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
46847
46848
|
if (index % 2 === 0) {
|
|
46848
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
46849
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
46849
46850
|
flush();
|
|
46850
46851
|
}
|
|
46851
46852
|
index = (index + 1) % pattern.length;
|
|
@@ -46860,7 +46861,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
46860
46861
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
46861
46862
|
}
|
|
46862
46863
|
let distance = 0;
|
|
46863
|
-
while (distance
|
|
46864
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
46864
46865
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
46865
46866
|
advance(point);
|
|
46866
46867
|
const step = Math.min(remaining, length - distance);
|
|
@@ -46975,7 +46976,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
46975
46976
|
let closed = subpath.closed;
|
|
46976
46977
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
46977
46978
|
if (points.length < 3) closed = false;
|
|
46978
|
-
if (points.length === 1 &&
|
|
46979
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
46980
|
+
contour = [];
|
|
46981
|
+
const [x, y] = points[0];
|
|
46982
|
+
add(x - half, y - half);
|
|
46983
|
+
add(x + half, y - half);
|
|
46984
|
+
add(x + half, y + half);
|
|
46985
|
+
add(x - half, y + half);
|
|
46986
|
+
contours.push(contour);
|
|
46987
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
46979
46988
|
contour = [];
|
|
46980
46989
|
const [x, y] = points[0];
|
|
46981
46990
|
addCap([x, y], [x + 1, y]);
|
|
@@ -47767,7 +47776,7 @@ function prepareStroke(path, scale) {
|
|
|
47767
47776
|
}
|
|
47768
47777
|
return { matrix, width, dashArray, dashPhase };
|
|
47769
47778
|
}
|
|
47770
|
-
function
|
|
47779
|
+
function strokeContours(path, pageHeight, scale) {
|
|
47771
47780
|
const stroke = prepareStroke(path, scale);
|
|
47772
47781
|
if (!stroke) return [];
|
|
47773
47782
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -47791,7 +47800,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
47791
47800
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
47792
47801
|
stroke.dashPhase * strokeScale
|
|
47793
47802
|
);
|
|
47794
|
-
return
|
|
47803
|
+
return contours.map((points) => points.map(toScreen));
|
|
47795
47804
|
}
|
|
47796
47805
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
47797
47806
|
const edges = [];
|
|
@@ -48044,7 +48053,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
48044
48053
|
if (path.strokeColor) {
|
|
48045
48054
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
48046
48055
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
48047
|
-
const edges =
|
|
48056
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
48048
48057
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
48049
48058
|
fillEdgesScanline4x4(
|
|
48050
48059
|
rgba,
|
package/dist/pdf-ast/index.js
CHANGED
|
@@ -36552,10 +36552,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36552
36552
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
36553
36553
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
36554
36554
|
if (patArr) {
|
|
36555
|
-
|
|
36555
|
+
const dashArray = patArr.items.map((it) => {
|
|
36556
36556
|
const r = params.cosDoc.resolve(it);
|
|
36557
36557
|
return r?.kind === "number" ? r.value : 0;
|
|
36558
|
-
}).filter((n) => n
|
|
36558
|
+
}).filter((n) => n >= 0);
|
|
36559
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
36559
36560
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
36560
36561
|
}
|
|
36561
36562
|
}
|
|
@@ -40254,7 +40255,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
40254
40255
|
while (remaining <= 0) {
|
|
40255
40256
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
40256
40257
|
if (index % 2 === 0) {
|
|
40257
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
40258
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
40258
40259
|
flush();
|
|
40259
40260
|
}
|
|
40260
40261
|
index = (index + 1) % pattern.length;
|
|
@@ -40269,7 +40270,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
40269
40270
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
40270
40271
|
}
|
|
40271
40272
|
let distance = 0;
|
|
40272
|
-
while (distance
|
|
40273
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
40273
40274
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
40274
40275
|
advance(point);
|
|
40275
40276
|
const step = Math.min(remaining, length - distance);
|
|
@@ -40384,7 +40385,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
40384
40385
|
let closed = subpath.closed;
|
|
40385
40386
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
40386
40387
|
if (points.length < 3) closed = false;
|
|
40387
|
-
if (points.length === 1 &&
|
|
40388
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
40389
|
+
contour = [];
|
|
40390
|
+
const [x, y] = points[0];
|
|
40391
|
+
add(x - half, y - half);
|
|
40392
|
+
add(x + half, y - half);
|
|
40393
|
+
add(x + half, y + half);
|
|
40394
|
+
add(x - half, y + half);
|
|
40395
|
+
contours.push(contour);
|
|
40396
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
40388
40397
|
contour = [];
|
|
40389
40398
|
const [x, y] = points[0];
|
|
40390
40399
|
addCap([x, y], [x + 1, y]);
|
|
@@ -41574,7 +41583,7 @@ function prepareStroke(path, scale) {
|
|
|
41574
41583
|
}
|
|
41575
41584
|
return { matrix, width, dashArray, dashPhase };
|
|
41576
41585
|
}
|
|
41577
|
-
function
|
|
41586
|
+
function strokeContours(path, pageHeight, scale) {
|
|
41578
41587
|
const stroke = prepareStroke(path, scale);
|
|
41579
41588
|
if (!stroke) return [];
|
|
41580
41589
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -41598,7 +41607,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
41598
41607
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
41599
41608
|
stroke.dashPhase * strokeScale
|
|
41600
41609
|
);
|
|
41601
|
-
return
|
|
41610
|
+
return contours.map((points) => points.map(toScreen));
|
|
41602
41611
|
}
|
|
41603
41612
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
41604
41613
|
const edges = [];
|
|
@@ -41851,7 +41860,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
41851
41860
|
if (path.strokeColor) {
|
|
41852
41861
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
41853
41862
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
41854
|
-
const edges =
|
|
41863
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
41855
41864
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
41856
41865
|
fillEdgesScanline4x4(
|
|
41857
41866
|
rgba,
|
|
@@ -42093,6 +42102,7 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
42093
42102
|
} else if (operation.kind === "path") {
|
|
42094
42103
|
const p = operation.value;
|
|
42095
42104
|
const prepared = p.strokeColor ? prepareStroke(p, Math.max(scaleX, scaleY)) : void 0;
|
|
42105
|
+
const outlineStroke = prepared && p.dashArray?.includes(0);
|
|
42096
42106
|
const matrix = prepared && (prepared.matrix[0] !== 1 || prepared.matrix[1] !== 0 || prepared.matrix[2] !== 0 || prepared.matrix[3] !== 1) ? prepared.matrix : void 0;
|
|
42097
42107
|
const inverse = matrix ? inverseStrokeMatrix(matrix) : void 0;
|
|
42098
42108
|
const pathData = svgPathData(p.segments, inverse ? 0 : displayList.height, inverse);
|
|
@@ -42107,10 +42117,18 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
42107
42117
|
const lineCapAttr = p.lineCap === 1 ? ` stroke-linecap="round"` : p.lineCap === 2 ? ` stroke-linecap="square"` : "";
|
|
42108
42118
|
const lineJoinAttr = p.lineJoin === 1 ? ` stroke-linejoin="round"` : p.lineJoin === 2 ? ` stroke-linejoin="bevel"` : "";
|
|
42109
42119
|
const miterLimitAttr = p.miterLimit !== void 0 && p.miterLimit !== 10 ? ` stroke-miterlimit="${p.miterLimit}"` : "";
|
|
42110
|
-
const dashArrayAttr = prepared?.dashArray?.length ? ` stroke-dasharray="${prepared.dashArray.join(" ")}"` : "";
|
|
42111
|
-
const dashOffsetAttr = prepared?.dashPhase ? ` stroke-dashoffset="${prepared.dashPhase}"` : "";
|
|
42120
|
+
const dashArrayAttr = !outlineStroke && prepared?.dashArray?.length ? ` stroke-dasharray="${prepared.dashArray.join(" ")}"` : "";
|
|
42121
|
+
const dashOffsetAttr = !outlineStroke && prepared?.dashPhase ? ` stroke-dashoffset="${prepared.dashPhase}"` : "";
|
|
42112
42122
|
const labelAttr = original.kind === "glyph" ? ` aria-label="${escapeXmlText(original.value.unicode)}"` : "";
|
|
42113
|
-
|
|
42123
|
+
if (!outlineStroke || p.fillColor) {
|
|
42124
|
+
parts.push(` <path${labelAttr}${transformAttr} d="${pathData}" fill="${fill}"${fillRuleAttr}${fillOpacityAttr} stroke="${outlineStroke ? "none" : stroke}"${strokeOpacityAttr}${strokeWidthAttr}${lineCapAttr}${lineJoinAttr}${miterLimitAttr}${dashArrayAttr}${dashOffsetAttr}/>`);
|
|
42125
|
+
}
|
|
42126
|
+
if (outlineStroke) {
|
|
42127
|
+
const outlineScale = Math.max(scaleX, scaleY);
|
|
42128
|
+
const contours = strokeContours(p, displayList.height, outlineScale);
|
|
42129
|
+
const outlineData = contours.map((points) => points.map(([x, y], i) => `${i === 0 ? "M" : "L"} ${x / outlineScale} ${y / outlineScale}`).join(" ") + " Z").join(" ");
|
|
42130
|
+
if (outlineData) parts.push(` <path${labelAttr} d="${outlineData}" fill="${stroke}" fill-opacity="${p.strokeAlpha ?? 1}"/>`);
|
|
42131
|
+
}
|
|
42114
42132
|
}
|
|
42115
42133
|
} else if (operation.kind === "image") {
|
|
42116
42134
|
parts.push(` ${svgImage(operation.value, displayList.height)}`);
|
|
@@ -48,11 +48,11 @@ import {
|
|
|
48
48
|
trimImage,
|
|
49
49
|
unflattenImage,
|
|
50
50
|
unpremultiplyRgbaImage
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-IOH3F3ZO.js";
|
|
52
52
|
import {
|
|
53
53
|
PdfDocument,
|
|
54
54
|
encodePng
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-XFUFHHLU.js";
|
|
56
56
|
import {
|
|
57
57
|
createLuaFilterCapability
|
|
58
58
|
} from "./chunk-Y2KHC6TZ.js";
|
|
@@ -32347,10 +32347,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
32347
32347
|
const patArr = params.cosDoc.resolveArray(dArr.items[0]);
|
|
32348
32348
|
const phaseNode = params.cosDoc.resolve(dArr.items[1]);
|
|
32349
32349
|
if (patArr) {
|
|
32350
|
-
|
|
32350
|
+
const dashArray = patArr.items.map((it) => {
|
|
32351
32351
|
const r = params.cosDoc.resolve(it);
|
|
32352
32352
|
return r?.kind === "number" ? r.value : 0;
|
|
32353
|
-
}).filter((n) => n
|
|
32353
|
+
}).filter((n) => n >= 0);
|
|
32354
|
+
st.dashArray = dashArray.some((value) => value > 0) ? dashArray : void 0;
|
|
32354
32355
|
st.dashPhase = phaseNode?.kind === "number" ? phaseNode.value : 0;
|
|
32355
32356
|
}
|
|
32356
32357
|
}
|
|
@@ -34145,7 +34146,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
34145
34146
|
while (remaining <= 0) {
|
|
34146
34147
|
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
34147
34148
|
if (index % 2 === 0) {
|
|
34148
|
-
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
34149
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false, zeroLengthDash: true });
|
|
34149
34150
|
flush();
|
|
34150
34151
|
}
|
|
34151
34152
|
index = (index + 1) % pattern.length;
|
|
@@ -34160,7 +34161,7 @@ function dashSubpath(path, pattern, phase) {
|
|
|
34160
34161
|
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
34161
34162
|
}
|
|
34162
34163
|
let distance = 0;
|
|
34163
|
-
while (distance
|
|
34164
|
+
while (length - distance > 8 * Number.EPSILON * Math.max(1, length)) {
|
|
34164
34165
|
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
34165
34166
|
advance(point);
|
|
34166
34167
|
const step = Math.min(remaining, length - distance);
|
|
@@ -34275,7 +34276,15 @@ function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], das
|
|
|
34275
34276
|
let closed = subpath.closed;
|
|
34276
34277
|
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
34277
34278
|
if (points.length < 3) closed = false;
|
|
34278
|
-
if (points.length === 1 &&
|
|
34279
|
+
if (points.length === 1 && cap === 2 && subpath.zeroLengthDash) {
|
|
34280
|
+
contour = [];
|
|
34281
|
+
const [x, y] = points[0];
|
|
34282
|
+
add(x - half, y - half);
|
|
34283
|
+
add(x + half, y - half);
|
|
34284
|
+
add(x + half, y + half);
|
|
34285
|
+
add(x - half, y + half);
|
|
34286
|
+
contours.push(contour);
|
|
34287
|
+
} else if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
34279
34288
|
contour = [];
|
|
34280
34289
|
const [x, y] = points[0];
|
|
34281
34290
|
addCap([x, y], [x + 1, y]);
|
|
@@ -35072,7 +35081,7 @@ function prepareStroke(path, scale) {
|
|
|
35072
35081
|
}
|
|
35073
35082
|
return { matrix, width, dashArray, dashPhase };
|
|
35074
35083
|
}
|
|
35075
|
-
function
|
|
35084
|
+
function strokeContours(path, pageHeight, scale) {
|
|
35076
35085
|
const stroke = prepareStroke(path, scale);
|
|
35077
35086
|
if (!stroke) return [];
|
|
35078
35087
|
const inverse = inverseStrokeMatrix(stroke.matrix);
|
|
@@ -35096,7 +35105,7 @@ function strokeEdges(path, pageHeight, scale) {
|
|
|
35096
35105
|
stroke.dashArray?.map((value) => Math.max(0, value * strokeScale)),
|
|
35097
35106
|
stroke.dashPhase * strokeScale
|
|
35098
35107
|
);
|
|
35099
|
-
return
|
|
35108
|
+
return contours.map((points) => points.map(toScreen));
|
|
35100
35109
|
}
|
|
35101
35110
|
function pathsToEdges(paths, closeSubpaths = false) {
|
|
35102
35111
|
const edges = [];
|
|
@@ -35349,7 +35358,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
35349
35358
|
if (path.strokeColor) {
|
|
35350
35359
|
const rawSw = path.strokeWidth * scale * (path.strokeMatrix ? Math.hypot(path.strokeMatrix[0], path.strokeMatrix[1]) : 1);
|
|
35351
35360
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
35352
|
-
const edges =
|
|
35361
|
+
const edges = pathsToEdges(strokeContours(path, displayList.height, scale).map((points) => ({ points, closed: true })));
|
|
35353
35362
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
35354
35363
|
fillEdgesScanline4x4(
|
|
35355
35364
|
rgba,
|