@poe-platform/safe-bash 0.1.761 → 0.1.762
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 +69 -7
- package/dist/image-ast/index.js +69 -7
- package/dist/pdf-ast/index.js +71 -7
- package/dist/safe-bash/command-chunks/{chunk-6VX5ZQL5.js → chunk-D4GXXV65.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-GR725WRX.js → chunk-F7MJRXQ2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OSMLVM7P.js → chunk-P3Q2QSCA.js} +72 -7
- package/dist/safe-bash/commands/csvcut/index.d.ts +1 -1
- package/dist/safe-bash/commands/csvcut/index.js +3 -1
- package/dist/safe-bash/commands/csvgrep/index.d.ts +1 -1
- package/dist/safe-bash/commands/csvgrep/index.js +3 -1
- package/dist/safe-bash/core.browser.js +7 -5
- package/dist/safe-bash/shell/runtime.js +4 -4
- package/dist/safe-bash-command-ffmpeg/index.js +1423 -1388
- 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 +69 -7
- package/dist/safe-bash-command-pdfinfo/index.js +69 -7
- package/dist/safe-bash-command-pdftk/index.js +69 -7
- package/dist/safe-bash-command-pdftoppm/index.js +69 -7
- package/dist/safe-bash-command-pdftotext/index.js +69 -7
- package/dist/safe-bash-command-qpdf/index.js +69 -7
- 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 +69 -7
- package/dist/safe-bash-command-wkhtmltopdf/index.js +69 -7
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +10 -0
|
@@ -38818,6 +38818,47 @@ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
|
38818
38818
|
points.push([x4, y4]);
|
|
38819
38819
|
return points;
|
|
38820
38820
|
}
|
|
38821
|
+
function sampleImageLinear(image, x, y, out) {
|
|
38822
|
+
x = Math.max(0, Math.min(image.width - 1, x));
|
|
38823
|
+
y = Math.max(0, Math.min(image.height - 1, y));
|
|
38824
|
+
const x0 = Math.floor(x), y0 = Math.floor(y);
|
|
38825
|
+
const fx = x - x0, fy = y - y0;
|
|
38826
|
+
out.fill(0);
|
|
38827
|
+
for (let j = 0; j < 2; j++) {
|
|
38828
|
+
for (let i = 0; i < 2; i++) {
|
|
38829
|
+
const offset = (Math.min(image.height - 1, y0 + j) * image.width + Math.min(image.width - 1, x0 + i)) * 4;
|
|
38830
|
+
const alpha = image.data[offset + 3] * (i ? fx : 1 - fx) * (j ? fy : 1 - fy);
|
|
38831
|
+
out[0] = out[0] + image.data[offset] * alpha;
|
|
38832
|
+
out[1] = out[1] + image.data[offset + 1] * alpha;
|
|
38833
|
+
out[2] = out[2] + image.data[offset + 2] * alpha;
|
|
38834
|
+
out[3] = out[3] + alpha;
|
|
38835
|
+
}
|
|
38836
|
+
}
|
|
38837
|
+
if (out[3] > 0) {
|
|
38838
|
+
out[0] = out[0] / out[3];
|
|
38839
|
+
out[1] = out[1] / out[3];
|
|
38840
|
+
out[2] = out[2] / out[3];
|
|
38841
|
+
}
|
|
38842
|
+
}
|
|
38843
|
+
function downscaleImage(image, widthScale, heightScale) {
|
|
38844
|
+
const sample = new Float64Array(4);
|
|
38845
|
+
while (widthScale > 2 && image.width > 1 || heightScale > 2 && image.height > 1) {
|
|
38846
|
+
const width = widthScale > 2 ? Math.ceil(image.width / 2) : image.width;
|
|
38847
|
+
const height = heightScale > 2 ? Math.ceil(image.height / 2) : image.height;
|
|
38848
|
+
const data = new Uint8Array(width * height * 4);
|
|
38849
|
+
for (let y = 0; y < height; y++) {
|
|
38850
|
+
for (let x = 0; x < width; x++) {
|
|
38851
|
+
sampleImageLinear(image, (x + 0.5) * image.width / width - 0.5, (y + 0.5) * image.height / height - 0.5, sample);
|
|
38852
|
+
const offset = (y * width + x) * 4;
|
|
38853
|
+
for (let c = 0; c < 4; c++) data[offset + c] = Math.round(sample[c]);
|
|
38854
|
+
}
|
|
38855
|
+
}
|
|
38856
|
+
widthScale /= image.width / width;
|
|
38857
|
+
heightScale /= image.height / height;
|
|
38858
|
+
image = { width, height, data };
|
|
38859
|
+
}
|
|
38860
|
+
return image;
|
|
38861
|
+
}
|
|
38821
38862
|
function decodePng(pngBytes) {
|
|
38822
38863
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
38823
38864
|
throw new Error("Invalid PNG signature");
|
|
@@ -39870,6 +39911,17 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39870
39911
|
const maxPx = Math.min(width - 1, clipMaxPx, Math.ceil(Math.max(...cornersPx)) - 1);
|
|
39871
39912
|
const minPy = Math.max(0, clipMinPy, Math.floor(Math.min(...cornersPy)));
|
|
39872
39913
|
const maxPy = Math.min(height - 1, clipMaxPy, Math.ceil(Math.max(...cornersPy)) - 1);
|
|
39914
|
+
if (minPx > maxPx || minPy > maxPy) continue;
|
|
39915
|
+
const source = downscaleImage(
|
|
39916
|
+
{ width: img.width, height: img.height, data: img.decodedRgba },
|
|
39917
|
+
Math.hypot(d, c) * img.width / Math.abs(det * scale),
|
|
39918
|
+
Math.hypot(b, a) * img.height / Math.abs(det * scale)
|
|
39919
|
+
);
|
|
39920
|
+
const ax = a * scale / img.width, ay = b * scale / img.width;
|
|
39921
|
+
const bx = c * scale / img.height, by = d * scale / img.height;
|
|
39922
|
+
const s1 = ax * ax + ay * ay, s2 = bx * bx + by * by, cross = ax * bx + ay * by;
|
|
39923
|
+
const smooth = Math.fround((s1 + s2 + Math.hypot(s1 - s2, 2 * cross)) / 2) <= 1;
|
|
39924
|
+
const sample = new Float64Array(4);
|
|
39873
39925
|
for (let py = minPy; py <= maxPy; py++) {
|
|
39874
39926
|
const yPdf = displayList.height - (py + 0.5) / scale;
|
|
39875
39927
|
if (img.clipRect && (yPdf < img.clipRect[1] || yPdf > img.clipRect[3])) continue;
|
|
@@ -39881,9 +39933,14 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39881
39933
|
const u = (d * dxPdf - c * dyPdf) / det;
|
|
39882
39934
|
const v = (-b * dxPdf + a * dyPdf) / det;
|
|
39883
39935
|
if (u < 0 || u > 1 || v < 0 || v > 1) continue;
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
|
|
39936
|
+
if (smooth) {
|
|
39937
|
+
sampleImageLinear(source, u * source.width - 0.5, (1 - v) * source.height - 0.5, sample);
|
|
39938
|
+
} else {
|
|
39939
|
+
const sx = Math.min(source.width - 1, Math.max(0, Math.floor(u * source.width)));
|
|
39940
|
+
const sy = Math.min(source.height - 1, Math.max(0, Math.floor((1 - v) * source.height)));
|
|
39941
|
+
const sIdx = (sy * source.width + sx) * 4;
|
|
39942
|
+
for (let c2 = 0; c2 < 4; c2++) sample[c2] = source.data[sIdx + c2];
|
|
39943
|
+
}
|
|
39887
39944
|
blendPixel(
|
|
39888
39945
|
rgba,
|
|
39889
39946
|
width,
|
|
@@ -39891,11 +39948,11 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39891
39948
|
px,
|
|
39892
39949
|
py,
|
|
39893
39950
|
{
|
|
39894
|
-
r:
|
|
39895
|
-
g:
|
|
39896
|
-
b:
|
|
39951
|
+
r: sample[0] / 255,
|
|
39952
|
+
g: sample[1] / 255,
|
|
39953
|
+
b: sample[2] / 255
|
|
39897
39954
|
},
|
|
39898
|
-
|
|
39955
|
+
sample[3] / 255,
|
|
39899
39956
|
img.blendMode,
|
|
39900
39957
|
clipMask
|
|
39901
39958
|
);
|
|
@@ -43124,3 +43181,8 @@ export {
|
|
|
43124
43181
|
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
43125
43182
|
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
43126
43183
|
*/
|
|
43184
|
+
/*!
|
|
43185
|
+
* Staged image reduction adapted from Mozilla PDF.js CanvasGraphics._scaleImage.
|
|
43186
|
+
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
43187
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
43188
|
+
*/
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
readImageMetadata,
|
|
12
12
|
resizeImage,
|
|
13
13
|
rotateImage
|
|
14
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
15
|
-
import "../safe-bash/command-chunks/chunk-
|
|
14
|
+
} from "../safe-bash/command-chunks/chunk-F7MJRXQ2.js";
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-P3Q2QSCA.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -212215,6 +212215,47 @@ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
|
212215
212215
|
points.push([x4, y4]);
|
|
212216
212216
|
return points;
|
|
212217
212217
|
}
|
|
212218
|
+
function sampleImageLinear(image, x, y, out) {
|
|
212219
|
+
x = Math.max(0, Math.min(image.width - 1, x));
|
|
212220
|
+
y = Math.max(0, Math.min(image.height - 1, y));
|
|
212221
|
+
const x0 = Math.floor(x), y0 = Math.floor(y);
|
|
212222
|
+
const fx = x - x0, fy = y - y0;
|
|
212223
|
+
out.fill(0);
|
|
212224
|
+
for (let j = 0; j < 2; j++) {
|
|
212225
|
+
for (let i = 0; i < 2; i++) {
|
|
212226
|
+
const offset = (Math.min(image.height - 1, y0 + j) * image.width + Math.min(image.width - 1, x0 + i)) * 4;
|
|
212227
|
+
const alpha = image.data[offset + 3] * (i ? fx : 1 - fx) * (j ? fy : 1 - fy);
|
|
212228
|
+
out[0] = out[0] + image.data[offset] * alpha;
|
|
212229
|
+
out[1] = out[1] + image.data[offset + 1] * alpha;
|
|
212230
|
+
out[2] = out[2] + image.data[offset + 2] * alpha;
|
|
212231
|
+
out[3] = out[3] + alpha;
|
|
212232
|
+
}
|
|
212233
|
+
}
|
|
212234
|
+
if (out[3] > 0) {
|
|
212235
|
+
out[0] = out[0] / out[3];
|
|
212236
|
+
out[1] = out[1] / out[3];
|
|
212237
|
+
out[2] = out[2] / out[3];
|
|
212238
|
+
}
|
|
212239
|
+
}
|
|
212240
|
+
function downscaleImage(image, widthScale, heightScale) {
|
|
212241
|
+
const sample2 = new Float64Array(4);
|
|
212242
|
+
while (widthScale > 2 && image.width > 1 || heightScale > 2 && image.height > 1) {
|
|
212243
|
+
const width2 = widthScale > 2 ? Math.ceil(image.width / 2) : image.width;
|
|
212244
|
+
const height = heightScale > 2 ? Math.ceil(image.height / 2) : image.height;
|
|
212245
|
+
const data3 = new Uint8Array(width2 * height * 4);
|
|
212246
|
+
for (let y = 0; y < height; y++) {
|
|
212247
|
+
for (let x = 0; x < width2; x++) {
|
|
212248
|
+
sampleImageLinear(image, (x + 0.5) * image.width / width2 - 0.5, (y + 0.5) * image.height / height - 0.5, sample2);
|
|
212249
|
+
const offset = (y * width2 + x) * 4;
|
|
212250
|
+
for (let c4 = 0; c4 < 4; c4++) data3[offset + c4] = Math.round(sample2[c4]);
|
|
212251
|
+
}
|
|
212252
|
+
}
|
|
212253
|
+
widthScale /= image.width / width2;
|
|
212254
|
+
heightScale /= image.height / height;
|
|
212255
|
+
image = { width: width2, height, data: data3 };
|
|
212256
|
+
}
|
|
212257
|
+
return image;
|
|
212258
|
+
}
|
|
212218
212259
|
function decodePng2(pngBytes) {
|
|
212219
212260
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
212220
212261
|
throw new Error("Invalid PNG signature");
|
|
@@ -213267,6 +213308,17 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213267
213308
|
const maxPx = Math.min(width2 - 1, clipMaxPx, Math.ceil(Math.max(...cornersPx)) - 1);
|
|
213268
213309
|
const minPy = Math.max(0, clipMinPy, Math.floor(Math.min(...cornersPy)));
|
|
213269
213310
|
const maxPy = Math.min(height - 1, clipMaxPy, Math.ceil(Math.max(...cornersPy)) - 1);
|
|
213311
|
+
if (minPx > maxPx || minPy > maxPy) continue;
|
|
213312
|
+
const source = downscaleImage(
|
|
213313
|
+
{ width: img.width, height: img.height, data: img.decodedRgba },
|
|
213314
|
+
Math.hypot(d2, c4) * img.width / Math.abs(det * scale2),
|
|
213315
|
+
Math.hypot(b3, a3) * img.height / Math.abs(det * scale2)
|
|
213316
|
+
);
|
|
213317
|
+
const ax = a3 * scale2 / img.width, ay = b3 * scale2 / img.width;
|
|
213318
|
+
const bx = c4 * scale2 / img.height, by = d2 * scale2 / img.height;
|
|
213319
|
+
const s1 = ax * ax + ay * ay, s2 = bx * bx + by * by, cross = ax * bx + ay * by;
|
|
213320
|
+
const smooth = Math.fround((s1 + s2 + Math.hypot(s1 - s2, 2 * cross)) / 2) <= 1;
|
|
213321
|
+
const sample2 = new Float64Array(4);
|
|
213270
213322
|
for (let py = minPy; py <= maxPy; py++) {
|
|
213271
213323
|
const yPdf = displayList.height - (py + 0.5) / scale2;
|
|
213272
213324
|
if (img.clipRect && (yPdf < img.clipRect[1] || yPdf > img.clipRect[3])) continue;
|
|
@@ -213278,9 +213330,14 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213278
213330
|
const u = (d2 * dxPdf - c4 * dyPdf) / det;
|
|
213279
213331
|
const v = (-b3 * dxPdf + a3 * dyPdf) / det;
|
|
213280
213332
|
if (u < 0 || u > 1 || v < 0 || v > 1) continue;
|
|
213281
|
-
|
|
213282
|
-
|
|
213283
|
-
|
|
213333
|
+
if (smooth) {
|
|
213334
|
+
sampleImageLinear(source, u * source.width - 0.5, (1 - v) * source.height - 0.5, sample2);
|
|
213335
|
+
} else {
|
|
213336
|
+
const sx = Math.min(source.width - 1, Math.max(0, Math.floor(u * source.width)));
|
|
213337
|
+
const sy = Math.min(source.height - 1, Math.max(0, Math.floor((1 - v) * source.height)));
|
|
213338
|
+
const sIdx = (sy * source.width + sx) * 4;
|
|
213339
|
+
for (let c22 = 0; c22 < 4; c22++) sample2[c22] = source.data[sIdx + c22];
|
|
213340
|
+
}
|
|
213284
213341
|
blendPixel(
|
|
213285
213342
|
rgba,
|
|
213286
213343
|
width2,
|
|
@@ -213288,11 +213345,11 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213288
213345
|
px,
|
|
213289
213346
|
py,
|
|
213290
213347
|
{
|
|
213291
|
-
r:
|
|
213292
|
-
g:
|
|
213293
|
-
b:
|
|
213348
|
+
r: sample2[0] / 255,
|
|
213349
|
+
g: sample2[1] / 255,
|
|
213350
|
+
b: sample2[2] / 255
|
|
213294
213351
|
},
|
|
213295
|
-
|
|
213352
|
+
sample2[3] / 255,
|
|
213296
213353
|
img.blendMode,
|
|
213297
213354
|
clipMask
|
|
213298
213355
|
);
|
|
@@ -234018,6 +234075,11 @@ export {
|
|
|
234018
234075
|
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
234019
234076
|
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
234020
234077
|
*/
|
|
234078
|
+
/*!
|
|
234079
|
+
* Staged image reduction adapted from Mozilla PDF.js CanvasGraphics._scaleImage.
|
|
234080
|
+
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
234081
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
234082
|
+
*/
|
|
234021
234083
|
/*! Bundled license information:
|
|
234022
234084
|
|
|
234023
234085
|
tslib/tslib.js:
|
|
@@ -13961,6 +13961,47 @@ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
|
13961
13961
|
points.push([x4, y4]);
|
|
13962
13962
|
return points;
|
|
13963
13963
|
}
|
|
13964
|
+
function sampleImageLinear(image, x, y, out) {
|
|
13965
|
+
x = Math.max(0, Math.min(image.width - 1, x));
|
|
13966
|
+
y = Math.max(0, Math.min(image.height - 1, y));
|
|
13967
|
+
const x0 = Math.floor(x), y0 = Math.floor(y);
|
|
13968
|
+
const fx = x - x0, fy = y - y0;
|
|
13969
|
+
out.fill(0);
|
|
13970
|
+
for (let j = 0; j < 2; j++) {
|
|
13971
|
+
for (let i = 0; i < 2; i++) {
|
|
13972
|
+
const offset = (Math.min(image.height - 1, y0 + j) * image.width + Math.min(image.width - 1, x0 + i)) * 4;
|
|
13973
|
+
const alpha = image.data[offset + 3] * (i ? fx : 1 - fx) * (j ? fy : 1 - fy);
|
|
13974
|
+
out[0] = out[0] + image.data[offset] * alpha;
|
|
13975
|
+
out[1] = out[1] + image.data[offset + 1] * alpha;
|
|
13976
|
+
out[2] = out[2] + image.data[offset + 2] * alpha;
|
|
13977
|
+
out[3] = out[3] + alpha;
|
|
13978
|
+
}
|
|
13979
|
+
}
|
|
13980
|
+
if (out[3] > 0) {
|
|
13981
|
+
out[0] = out[0] / out[3];
|
|
13982
|
+
out[1] = out[1] / out[3];
|
|
13983
|
+
out[2] = out[2] / out[3];
|
|
13984
|
+
}
|
|
13985
|
+
}
|
|
13986
|
+
function downscaleImage(image, widthScale, heightScale) {
|
|
13987
|
+
const sample = new Float64Array(4);
|
|
13988
|
+
while (widthScale > 2 && image.width > 1 || heightScale > 2 && image.height > 1) {
|
|
13989
|
+
const width = widthScale > 2 ? Math.ceil(image.width / 2) : image.width;
|
|
13990
|
+
const height = heightScale > 2 ? Math.ceil(image.height / 2) : image.height;
|
|
13991
|
+
const data = new Uint8Array(width * height * 4);
|
|
13992
|
+
for (let y = 0; y < height; y++) {
|
|
13993
|
+
for (let x = 0; x < width; x++) {
|
|
13994
|
+
sampleImageLinear(image, (x + 0.5) * image.width / width - 0.5, (y + 0.5) * image.height / height - 0.5, sample);
|
|
13995
|
+
const offset = (y * width + x) * 4;
|
|
13996
|
+
for (let c = 0; c < 4; c++) data[offset + c] = Math.round(sample[c]);
|
|
13997
|
+
}
|
|
13998
|
+
}
|
|
13999
|
+
widthScale /= image.width / width;
|
|
14000
|
+
heightScale /= image.height / height;
|
|
14001
|
+
image = { width, height, data };
|
|
14002
|
+
}
|
|
14003
|
+
return image;
|
|
14004
|
+
}
|
|
13964
14005
|
function decodePng(pngBytes) {
|
|
13965
14006
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
13966
14007
|
throw new Error("Invalid PNG signature");
|
|
@@ -14701,6 +14742,17 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14701
14742
|
const maxPx = Math.min(width - 1, clipMaxPx, Math.ceil(Math.max(...cornersPx)) - 1);
|
|
14702
14743
|
const minPy = Math.max(0, clipMinPy, Math.floor(Math.min(...cornersPy)));
|
|
14703
14744
|
const maxPy = Math.min(height - 1, clipMaxPy, Math.ceil(Math.max(...cornersPy)) - 1);
|
|
14745
|
+
if (minPx > maxPx || minPy > maxPy) continue;
|
|
14746
|
+
const source = downscaleImage(
|
|
14747
|
+
{ width: img.width, height: img.height, data: img.decodedRgba },
|
|
14748
|
+
Math.hypot(d, c) * img.width / Math.abs(det * scale),
|
|
14749
|
+
Math.hypot(b, a) * img.height / Math.abs(det * scale)
|
|
14750
|
+
);
|
|
14751
|
+
const ax = a * scale / img.width, ay = b * scale / img.width;
|
|
14752
|
+
const bx = c * scale / img.height, by = d * scale / img.height;
|
|
14753
|
+
const s1 = ax * ax + ay * ay, s2 = bx * bx + by * by, cross = ax * bx + ay * by;
|
|
14754
|
+
const smooth = Math.fround((s1 + s2 + Math.hypot(s1 - s2, 2 * cross)) / 2) <= 1;
|
|
14755
|
+
const sample = new Float64Array(4);
|
|
14704
14756
|
for (let py = minPy; py <= maxPy; py++) {
|
|
14705
14757
|
const yPdf = displayList.height - (py + 0.5) / scale;
|
|
14706
14758
|
if (img.clipRect && (yPdf < img.clipRect[1] || yPdf > img.clipRect[3])) continue;
|
|
@@ -14712,9 +14764,14 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14712
14764
|
const u = (d * dxPdf - c * dyPdf) / det;
|
|
14713
14765
|
const v = (-b * dxPdf + a * dyPdf) / det;
|
|
14714
14766
|
if (u < 0 || u > 1 || v < 0 || v > 1) continue;
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14767
|
+
if (smooth) {
|
|
14768
|
+
sampleImageLinear(source, u * source.width - 0.5, (1 - v) * source.height - 0.5, sample);
|
|
14769
|
+
} else {
|
|
14770
|
+
const sx = Math.min(source.width - 1, Math.max(0, Math.floor(u * source.width)));
|
|
14771
|
+
const sy = Math.min(source.height - 1, Math.max(0, Math.floor((1 - v) * source.height)));
|
|
14772
|
+
const sIdx = (sy * source.width + sx) * 4;
|
|
14773
|
+
for (let c2 = 0; c2 < 4; c2++) sample[c2] = source.data[sIdx + c2];
|
|
14774
|
+
}
|
|
14718
14775
|
blendPixel(
|
|
14719
14776
|
rgba,
|
|
14720
14777
|
width,
|
|
@@ -14722,11 +14779,11 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14722
14779
|
px,
|
|
14723
14780
|
py,
|
|
14724
14781
|
{
|
|
14725
|
-
r:
|
|
14726
|
-
g:
|
|
14727
|
-
b:
|
|
14782
|
+
r: sample[0] / 255,
|
|
14783
|
+
g: sample[1] / 255,
|
|
14784
|
+
b: sample[2] / 255
|
|
14728
14785
|
},
|
|
14729
|
-
|
|
14786
|
+
sample[3] / 255,
|
|
14730
14787
|
img.blendMode,
|
|
14731
14788
|
clipMask
|
|
14732
14789
|
);
|
|
@@ -43344,3 +43401,8 @@ export {
|
|
|
43344
43401
|
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
43345
43402
|
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
43346
43403
|
*/
|
|
43404
|
+
/*!
|
|
43405
|
+
* Staged image reduction adapted from Mozilla PDF.js CanvasGraphics._scaleImage.
|
|
43406
|
+
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
43407
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
43408
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.762",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"access": "public"
|
|
842
842
|
},
|
|
843
843
|
"dependencies": {
|
|
844
|
-
"@poe-platform/safe-fs": "0.1.
|
|
844
|
+
"@poe-platform/safe-fs": "0.1.762",
|
|
845
845
|
"pdf-lib": "1.17.1",
|
|
846
846
|
"@noble/hashes": "2.4.0",
|
|
847
847
|
"pako": "3.0.1",
|
|
@@ -349,6 +349,16 @@ The source fixture and hashes are recorded in `src/fixtures/SOURCES.md`.
|
|
|
349
349
|
The one-pixel gradient expectation is independently verified by Poppler and
|
|
350
350
|
MuPDF; PDF.js's `paintSolidColorImageMask` optimization loses that pattern.
|
|
351
351
|
|
|
352
|
+
`src/render/image-sampling.ts` adapts `CanvasGraphics._scaleImage` from the same
|
|
353
|
+
pinned PDF.js revision (Copyright 2012 Mozilla Foundation, Apache-2.0). The
|
|
354
|
+
successive half-size canvas draws use local bilinear sampling with premultiplied
|
|
355
|
+
alpha; only the current reduction level is retained. Source-axis footprints
|
|
356
|
+
come from the inverse image transform to preserve rotated anisotropic reductions.
|
|
357
|
+
Final downscaling uses smoothing, as in `getImageSmoothingEnabled`, with one
|
|
358
|
+
device pixel as the enlargement threshold. `image-downsampling.test.ts` adds
|
|
359
|
+
memory-only stripe, alpha, transform, stencil, and save/reopen regressions;
|
|
360
|
+
the unchanged upstream issue13372 fixture also covers reduced patterned masks.
|
|
361
|
+
|
|
352
362
|
Malformed dictionary-key recovery follows PDF.js `Parser.getObj`, skipping
|
|
353
363
|
stray non-Name tokens only in local repair mode. Damaged optional ToUnicode
|
|
354
364
|
streams follow `PartialEvaluator.readToUnicode` error recovery while retaining
|