@poe-platform/safe-bash 0.1.763 → 0.1.764
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 +268 -153
- package/dist/image-ast/index.js +268 -153
- package/dist/pdf-ast/index.js +270 -153
- package/dist/safe-bash/chunks/{chunk-CRQDMBQA.js → chunk-FSH7QRIC.js} +10 -1
- package/dist/safe-bash/command-chunks/{chunk-4XHONGIU.js → chunk-B7YLGJRF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-S3G2B4OX.js → chunk-G3IIEU2N.js} +271 -153
- package/dist/safe-bash/command-chunks/{chunk-S5EX6UP5.js → chunk-RDPJGIQF.js} +1 -1
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/llm-module.js +3 -1
- package/dist/safe-bash/commands/python/shell-module.js +7 -0
- package/dist/safe-bash/core.browser.js +32 -12
- package/dist/safe-bash/shell/runtime.js +43 -11
- package/dist/safe-bash-command-ffmpeg/index.js +5649 -5565
- 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 +268 -153
- package/dist/safe-bash-command-pdfinfo/index.js +268 -153
- package/dist/safe-bash-command-pdftk/index.js +268 -153
- package/dist/safe-bash-command-pdftoppm/index.js +268 -153
- package/dist/safe-bash-command-pdftotext/index.js +268 -153
- package/dist/safe-bash-command-qpdf/index.js +268 -153
- 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 +265 -150
- package/dist/safe-bash-command-wkhtmltopdf/index.js +269 -153
- package/dist/safe-playwright-cloudflare/browser-snapshot-labels.d.ts +14 -0
- package/dist/safe-playwright-cloudflare/browser-snapshot-labels.js +62 -0
- package/dist/safe-playwright-cloudflare/browser-snapshot-scheduler.js +8 -1
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +14 -0
|
@@ -212332,6 +212332,184 @@ function downscaleImage(image, widthScale, heightScale) {
|
|
|
212332
212332
|
}
|
|
212333
212333
|
return image;
|
|
212334
212334
|
}
|
|
212335
|
+
var MAX_STROKE_VERTICES = 1e6;
|
|
212336
|
+
function dashSubpath(path2, pattern, phase) {
|
|
212337
|
+
const cycle = pattern.reduce((sum2, value3) => sum2 + value3, 0);
|
|
212338
|
+
if (!(cycle > 0)) return [path2];
|
|
212339
|
+
let offset = (phase % cycle + cycle) % cycle, index2 = 0;
|
|
212340
|
+
while (offset > 0) {
|
|
212341
|
+
if (offset < pattern[index2]) break;
|
|
212342
|
+
offset -= pattern[index2];
|
|
212343
|
+
index2 = (index2 + 1) % pattern.length;
|
|
212344
|
+
}
|
|
212345
|
+
let remaining = pattern[index2] - offset;
|
|
212346
|
+
const points = path2.closed ? [...path2.points, path2.points[0]] : path2.points;
|
|
212347
|
+
const result2 = [];
|
|
212348
|
+
let current = [];
|
|
212349
|
+
let steps = 0;
|
|
212350
|
+
const flush = () => {
|
|
212351
|
+
if (current.length) result2.push({ points: current, closed: false });
|
|
212352
|
+
current = [];
|
|
212353
|
+
};
|
|
212354
|
+
const advance2 = (point) => {
|
|
212355
|
+
while (remaining <= 0) {
|
|
212356
|
+
if (++steps > MAX_STROKE_VERTICES) throw new PdfError2("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
212357
|
+
if (index2 % 2 === 0) {
|
|
212358
|
+
if (pattern[index2] === 0) result2.push({ points: [point, point], closed: false });
|
|
212359
|
+
flush();
|
|
212360
|
+
}
|
|
212361
|
+
index2 = (index2 + 1) % pattern.length;
|
|
212362
|
+
remaining = pattern[index2];
|
|
212363
|
+
}
|
|
212364
|
+
};
|
|
212365
|
+
for (let i = 1; i < points.length; i++) {
|
|
212366
|
+
const start = points[i - 1], end2 = points[i];
|
|
212367
|
+
const dx = end2[0] - start[0], dy = end2[1] - start[1];
|
|
212368
|
+
const length = Math.hypot(dx, dy);
|
|
212369
|
+
if (!Number.isFinite(length) || length / cycle * pattern.length > MAX_STROKE_VERTICES) {
|
|
212370
|
+
throw new PdfError2("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
212371
|
+
}
|
|
212372
|
+
let distance2 = 0;
|
|
212373
|
+
while (distance2 < length) {
|
|
212374
|
+
const point = [start[0] + dx * distance2 / length, start[1] + dy * distance2 / length];
|
|
212375
|
+
advance2(point);
|
|
212376
|
+
const step = Math.min(remaining, length - distance2);
|
|
212377
|
+
if (distance2 + step === distance2 || ++steps > MAX_STROKE_VERTICES) throw new PdfError2("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
212378
|
+
distance2 += step;
|
|
212379
|
+
remaining -= step;
|
|
212380
|
+
if (index2 % 2 === 0) {
|
|
212381
|
+
if (!current.length) current.push(point);
|
|
212382
|
+
current.push([start[0] + dx * distance2 / length, start[1] + dy * distance2 / length]);
|
|
212383
|
+
}
|
|
212384
|
+
}
|
|
212385
|
+
}
|
|
212386
|
+
flush();
|
|
212387
|
+
if (path2.closed && result2.length) {
|
|
212388
|
+
const first = result2[0], last = result2[result2.length - 1];
|
|
212389
|
+
const start = path2.points[0];
|
|
212390
|
+
const firstPoint = first.points[0], lastPoint = last.points[last.points.length - 1];
|
|
212391
|
+
if (firstPoint[0] === start[0] && firstPoint[1] === start[1] && lastPoint[0] === start[0] && lastPoint[1] === start[1]) {
|
|
212392
|
+
if (first === last) result2[0] = { points: first.points, closed: true };
|
|
212393
|
+
else {
|
|
212394
|
+
result2[0] = { points: [...last.points, ...first.points.slice(1)], closed: false };
|
|
212395
|
+
result2.pop();
|
|
212396
|
+
}
|
|
212397
|
+
}
|
|
212398
|
+
}
|
|
212399
|
+
return result2;
|
|
212400
|
+
}
|
|
212401
|
+
function strokeOutlines(paths, width2, cap, join3, miterLimit, dashArray = [], dashPhase = 0) {
|
|
212402
|
+
const half = width2 / 2;
|
|
212403
|
+
const contours = [];
|
|
212404
|
+
const pattern = dashArray.length % 2 ? [...dashArray, ...dashArray] : dashArray;
|
|
212405
|
+
let count = 0;
|
|
212406
|
+
let contour = [];
|
|
212407
|
+
const add5 = (x, y) => {
|
|
212408
|
+
if (++count > MAX_STROKE_VERTICES) throw new PdfError2("E_LIMIT", "Stroke outline exceeds the vertex limit");
|
|
212409
|
+
contour.push([x, y]);
|
|
212410
|
+
};
|
|
212411
|
+
const arc = (point, dx1, dy1, dx2, dy2) => {
|
|
212412
|
+
let a1 = Math.atan2(dy1, dx1), a22 = Math.atan2(dy2, dx2);
|
|
212413
|
+
const ccw = a1 - a22 > 0 && a1 - a22 < Math.PI;
|
|
212414
|
+
const step = Math.acos(half / (half + 0.125)) * 2;
|
|
212415
|
+
add5(point[0] + dx1, point[1] + dy1);
|
|
212416
|
+
if (step > 0) {
|
|
212417
|
+
if (!ccw) {
|
|
212418
|
+
if (a1 > a22) a22 += 2 * Math.PI;
|
|
212419
|
+
a22 -= step / 4;
|
|
212420
|
+
if ((a22 - a1) / step > MAX_STROKE_VERTICES - count) throw new PdfError2("E_LIMIT", "Stroke arc exceeds the vertex limit");
|
|
212421
|
+
for (a1 += step; a1 < a22; a1 += step) add5(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
|
|
212422
|
+
} else {
|
|
212423
|
+
if (a1 < a22) a22 -= 2 * Math.PI;
|
|
212424
|
+
a22 += step / 4;
|
|
212425
|
+
if ((a1 - a22) / step > MAX_STROKE_VERTICES - count) throw new PdfError2("E_LIMIT", "Stroke arc exceeds the vertex limit");
|
|
212426
|
+
for (a1 -= step; a1 > a22; a1 -= step) add5(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
|
|
212427
|
+
}
|
|
212428
|
+
}
|
|
212429
|
+
add5(point[0] + dx2, point[1] + dy2);
|
|
212430
|
+
};
|
|
212431
|
+
const addCap = (point, next) => {
|
|
212432
|
+
const length = Math.hypot(next[0] - point[0], next[1] - point[1]);
|
|
212433
|
+
const dx = half * (next[1] - point[1]) / length;
|
|
212434
|
+
const dy = half * (next[0] - point[0]) / length;
|
|
212435
|
+
if (cap !== 1) {
|
|
212436
|
+
const sx = cap === 2 ? dy : 0, sy = cap === 2 ? dx : 0;
|
|
212437
|
+
add5(point[0] - dx - sx, point[1] + dy - sy);
|
|
212438
|
+
add5(point[0] + dx - sx, point[1] - dy - sy);
|
|
212439
|
+
} else {
|
|
212440
|
+
const angle = Math.atan2(dy, -dx);
|
|
212441
|
+
const step = Math.max(1e-3, Math.acos(half / (half + 0.125)) * 2);
|
|
212442
|
+
add5(point[0] - dx, point[1] + dy);
|
|
212443
|
+
for (let a3 = angle + step; a3 < angle + Math.PI - step / 4; a3 += step) add5(point[0] + half * Math.cos(a3), point[1] + half * Math.sin(a3));
|
|
212444
|
+
add5(point[0] + dx, point[1] - dy);
|
|
212445
|
+
}
|
|
212446
|
+
};
|
|
212447
|
+
const addJoin = (prev, point, next) => {
|
|
212448
|
+
const len1 = Math.hypot(point[0] - prev[0], point[1] - prev[1]);
|
|
212449
|
+
const len2 = Math.hypot(next[0] - point[0], next[1] - point[1]);
|
|
212450
|
+
const dx1 = half * (point[1] - prev[1]) / len1, dy1 = half * (point[0] - prev[0]) / len1;
|
|
212451
|
+
const dx2 = half * (next[1] - point[1]) / len2, dy2 = half * (next[0] - point[0]) / len2;
|
|
212452
|
+
const inner = (next[0] - point[0]) * (point[1] - prev[1]) - (next[1] - point[1]) * (point[0] - prev[0]) > 0;
|
|
212453
|
+
if (!inner && join3 === 1) {
|
|
212454
|
+
arc(point, dx1, -dy1, dx2, -dy2);
|
|
212455
|
+
return;
|
|
212456
|
+
}
|
|
212457
|
+
if (inner || join3 === 0) {
|
|
212458
|
+
const ax = prev[0] + dx1, ay = prev[1] - dy1;
|
|
212459
|
+
const bx = point[0] + dx1, by = point[1] - dy1;
|
|
212460
|
+
const cx = point[0] + dx2, cy = point[1] - dy2;
|
|
212461
|
+
const dx = next[0] + dx2, dy = next[1] - dy2;
|
|
212462
|
+
const den = (bx - ax) * (dy - cy) - (by - ay) * (dx - cx);
|
|
212463
|
+
if (Math.abs(den) >= 1e-30) {
|
|
212464
|
+
const t = ((ay - cy) * (dx - cx) - (ax - cx) * (dy - cy)) / den;
|
|
212465
|
+
const x = ax + (bx - ax) * t, y = ay + (by - ay) * t;
|
|
212466
|
+
if (Math.hypot(x - point[0], y - point[1]) <= half * (inner ? 1.01 : miterLimit)) {
|
|
212467
|
+
add5(x, y);
|
|
212468
|
+
return;
|
|
212469
|
+
}
|
|
212470
|
+
} else if ((bx - prev[0]) * dy1 - (prev[1] - by) * dx1 < 0 !== (bx - next[0]) * dy1 - (next[1] - by) * dx1 < 0) {
|
|
212471
|
+
add5(bx, by);
|
|
212472
|
+
return;
|
|
212473
|
+
}
|
|
212474
|
+
}
|
|
212475
|
+
add5(point[0] + dx1, point[1] - dy1);
|
|
212476
|
+
add5(point[0] + dx2, point[1] - dy2);
|
|
212477
|
+
};
|
|
212478
|
+
for (const path2 of paths) {
|
|
212479
|
+
for (const subpath of pattern.length ? dashSubpath(path2, pattern, dashPhase) : [path2]) {
|
|
212480
|
+
const points = [];
|
|
212481
|
+
for (const point of subpath.points) {
|
|
212482
|
+
const prev = points[points.length - 1];
|
|
212483
|
+
if (!prev || Math.hypot(prev[0] - point[0], prev[1] - point[1]) > 1e-14) points.push(point);
|
|
212484
|
+
}
|
|
212485
|
+
let closed = subpath.closed;
|
|
212486
|
+
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();
|
|
212487
|
+
if (points.length < 3) closed = false;
|
|
212488
|
+
if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
212489
|
+
contour = [];
|
|
212490
|
+
const [x, y] = points[0];
|
|
212491
|
+
addCap([x, y], [x + 1, y]);
|
|
212492
|
+
addCap([x, y], [x - 1, y]);
|
|
212493
|
+
contours.push(contour);
|
|
212494
|
+
} else if (points.length >= 2) {
|
|
212495
|
+
contour = [];
|
|
212496
|
+
if (!closed) addCap(points[0], points[1]);
|
|
212497
|
+
for (let i = closed ? 0 : 1; i < points.length - (closed ? 0 : 1); i++) {
|
|
212498
|
+
addJoin(points[(i + points.length - 1) % points.length], points[i], points[(i + 1) % points.length]);
|
|
212499
|
+
}
|
|
212500
|
+
if (closed) {
|
|
212501
|
+
contours.push(contour);
|
|
212502
|
+
contour = [];
|
|
212503
|
+
} else addCap(points[points.length - 1], points[points.length - 2]);
|
|
212504
|
+
for (let i = points.length - (closed ? 1 : 2); i >= (closed ? 0 : 1); i--) {
|
|
212505
|
+
addJoin(points[(i + 1) % points.length], points[i], points[(i + points.length - 1) % points.length]);
|
|
212506
|
+
}
|
|
212507
|
+
contours.push(contour);
|
|
212508
|
+
}
|
|
212509
|
+
}
|
|
212510
|
+
}
|
|
212511
|
+
return contours;
|
|
212512
|
+
}
|
|
212335
212513
|
function decodePng2(pngBytes) {
|
|
212336
212514
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
212337
212515
|
throw new Error("Invalid PNG signature");
|
|
@@ -213026,111 +213204,60 @@ function blendPixel(rgba, width2, height, px, py, color5, alpha, blendMode, clip
|
|
|
213026
213204
|
rgba[idx + 2] = Math.round((effB * a3 + cbB * dstA * (1 - a3)) / outA * 255);
|
|
213027
213205
|
rgba[idx + 3] = Math.round(outA * 255);
|
|
213028
213206
|
}
|
|
213029
|
-
function
|
|
213030
|
-
const
|
|
213031
|
-
|
|
213032
|
-
|
|
213033
|
-
const
|
|
213034
|
-
const
|
|
213035
|
-
|
|
213036
|
-
|
|
213037
|
-
|
|
213038
|
-
|
|
213039
|
-
|
|
213040
|
-
|
|
213041
|
-
|
|
213042
|
-
|
|
213043
|
-
|
|
213044
|
-
if (
|
|
213045
|
-
|
|
213046
|
-
|
|
213047
|
-
|
|
213048
|
-
|
|
213049
|
-
|
|
213050
|
-
|
|
213051
|
-
|
|
213052
|
-
|
|
213053
|
-
|
|
213054
|
-
|
|
213055
|
-
|
|
213056
|
-
|
|
213057
|
-
|
|
213058
|
-
|
|
213059
|
-
|
|
213060
|
-
|
|
213061
|
-
|
|
213062
|
-
|
|
213063
|
-
|
|
213064
|
-
|
|
213065
|
-
|
|
213066
|
-
|
|
213067
|
-
}
|
|
213207
|
+
function segmentsToScreenPaths(segments, pageHeight, scale2) {
|
|
213208
|
+
const paths = [];
|
|
213209
|
+
let points = [];
|
|
213210
|
+
let current = [0, 0];
|
|
213211
|
+
const toScreen = (x, y) => [x * scale2, (pageHeight - y) * scale2];
|
|
213212
|
+
for (const segment of segments) {
|
|
213213
|
+
if (segment.kind === "move") {
|
|
213214
|
+
if (points.length) paths.push({ points, closed: false });
|
|
213215
|
+
current = toScreen(segment.x, segment.y);
|
|
213216
|
+
points = [current];
|
|
213217
|
+
} else if (segment.kind === "line") {
|
|
213218
|
+
if (!points.length) points = [current];
|
|
213219
|
+
current = toScreen(segment.x, segment.y);
|
|
213220
|
+
points.push(current);
|
|
213221
|
+
} else if (segment.kind === "cubic") {
|
|
213222
|
+
if (!points.length) points = [current];
|
|
213223
|
+
const a3 = toScreen(segment.x1, segment.y1), b3 = toScreen(segment.x2, segment.y2);
|
|
213224
|
+
const end2 = toScreen(segment.x, segment.y);
|
|
213225
|
+
const curve = flattenCubic(current[0], current[1], a3[0], a3[1], b3[0], b3[1], end2[0], end2[1]);
|
|
213226
|
+
for (let i = 1; i < curve.length; i++) points.push(curve[i]);
|
|
213227
|
+
current = end2;
|
|
213228
|
+
} else if (segment.kind === "close") {
|
|
213229
|
+
if (points.length) {
|
|
213230
|
+
paths.push({ points, closed: true });
|
|
213231
|
+
current = points[0];
|
|
213232
|
+
points = [];
|
|
213233
|
+
}
|
|
213234
|
+
} else if (segment.kind === "rect") {
|
|
213235
|
+
if (points.length) paths.push({ points, closed: false });
|
|
213236
|
+
const first = toScreen(segment.x, segment.y);
|
|
213237
|
+
paths.push({ points: [
|
|
213238
|
+
first,
|
|
213239
|
+
toScreen(segment.x + segment.width, segment.y),
|
|
213240
|
+
toScreen(segment.x + segment.width, segment.y + segment.height),
|
|
213241
|
+
toScreen(segment.x, segment.y + segment.height)
|
|
213242
|
+
], closed: true });
|
|
213243
|
+
current = first;
|
|
213244
|
+
points = [];
|
|
213068
213245
|
}
|
|
213069
213246
|
}
|
|
213247
|
+
if (points.length) paths.push({ points, closed: false });
|
|
213248
|
+
return paths;
|
|
213070
213249
|
}
|
|
213071
|
-
function
|
|
213250
|
+
function pathsToEdges(paths, closeSubpaths = false) {
|
|
213072
213251
|
const edges2 = [];
|
|
213073
|
-
|
|
213074
|
-
|
|
213075
|
-
|
|
213076
|
-
|
|
213077
|
-
|
|
213078
|
-
|
|
213079
|
-
|
|
213080
|
-
|
|
213081
|
-
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
213082
|
-
edges2.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
213083
|
-
}
|
|
213084
|
-
[curX, curY] = toScreen(seg.x, seg.y);
|
|
213085
|
-
startX = curX;
|
|
213086
|
-
startY = curY;
|
|
213087
|
-
hasOpenSubpath = false;
|
|
213088
|
-
} else if (seg.kind === "line") {
|
|
213089
|
-
const [nx, ny] = toScreen(seg.x, seg.y);
|
|
213090
|
-
edges2.push({ x0: curX, y0: curY, x1: nx, y1: ny });
|
|
213091
|
-
curX = nx;
|
|
213092
|
-
curY = ny;
|
|
213093
|
-
hasOpenSubpath = true;
|
|
213094
|
-
} else if (seg.kind === "cubic") {
|
|
213095
|
-
const [p1x, p1y] = toScreen(seg.x1, seg.y1);
|
|
213096
|
-
const [p2x, p2y] = toScreen(seg.x2, seg.y2);
|
|
213097
|
-
const [p3x, p3y] = toScreen(seg.x, seg.y);
|
|
213098
|
-
const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
|
|
213099
|
-
let px = curX;
|
|
213100
|
-
let py = curY;
|
|
213101
|
-
for (let i = 1; i < points.length; i++) {
|
|
213102
|
-
const [qx, qy] = points[i];
|
|
213103
|
-
edges2.push({ x0: px, y0: py, x1: qx, y1: qy });
|
|
213104
|
-
px = qx;
|
|
213105
|
-
py = qy;
|
|
213106
|
-
}
|
|
213107
|
-
curX = p3x;
|
|
213108
|
-
curY = p3y;
|
|
213109
|
-
hasOpenSubpath = true;
|
|
213110
|
-
} else if (seg.kind === "close") {
|
|
213111
|
-
if (curX !== startX || curY !== startY) {
|
|
213112
|
-
edges2.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
213113
|
-
curX = startX;
|
|
213114
|
-
curY = startY;
|
|
213115
|
-
}
|
|
213116
|
-
hasOpenSubpath = false;
|
|
213117
|
-
} else if (seg.kind === "rect") {
|
|
213118
|
-
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
213119
|
-
edges2.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
213120
|
-
}
|
|
213121
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
213122
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
213123
|
-
edges2.push(
|
|
213124
|
-
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
213125
|
-
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
213126
|
-
{ x0: rx1, y0: ry1, x1: rx0, y1: ry1 },
|
|
213127
|
-
{ x0: rx0, y0: ry1, x1: rx0, y1: ry0 }
|
|
213128
|
-
);
|
|
213129
|
-
hasOpenSubpath = false;
|
|
213252
|
+
for (const { points, closed } of paths) {
|
|
213253
|
+
for (let i = 1; i < points.length; i++) {
|
|
213254
|
+
const a3 = points[i - 1], b3 = points[i];
|
|
213255
|
+
edges2.push({ x0: a3[0], y0: a3[1], x1: b3[0], y1: b3[1] });
|
|
213256
|
+
}
|
|
213257
|
+
if ((closed || closeSubpaths) && points.length > 1) {
|
|
213258
|
+
const a3 = points[points.length - 1], b3 = points[0];
|
|
213259
|
+
edges2.push({ x0: a3[0], y0: a3[1], x1: b3[0], y1: b3[1] });
|
|
213130
213260
|
}
|
|
213131
|
-
}
|
|
213132
|
-
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
213133
|
-
edges2.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
213134
213261
|
}
|
|
213135
213262
|
return edges2;
|
|
213136
213263
|
}
|
|
@@ -213317,7 +213444,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213317
213444
|
for (const clip2 of clips) {
|
|
213318
213445
|
const { segments, fillRule } = "segments" in clip2 ? clip2 : { segments: clip2, fillRule: "nonzero" };
|
|
213319
213446
|
const layer = new Uint8Array(width2 * height * 4);
|
|
213320
|
-
fillEdgesScanline4x4(layer, width2, height,
|
|
213447
|
+
fillEdgesScanline4x4(layer, width2, height, pathsToEdges(segmentsToScreenPaths(segments, displayList.height, scale2), true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
213321
213448
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
213322
213449
|
}
|
|
213323
213450
|
cachedClips = clips;
|
|
@@ -213364,62 +213491,38 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213364
213491
|
if (operation.kind === "path") {
|
|
213365
213492
|
const path2 = operation.value;
|
|
213366
213493
|
if (path2.fillColor) {
|
|
213367
|
-
const edges2 =
|
|
213494
|
+
const edges2 = pathsToEdges(segmentsToScreenPaths(path2.segments, displayList.height, scale2), true);
|
|
213368
213495
|
const clipScreen = path2.clipRect ? [path2.clipRect[0] * scale2, (displayList.height - path2.clipRect[3]) * scale2, path2.clipRect[2] * scale2, (displayList.height - path2.clipRect[1]) * scale2] : void 0;
|
|
213369
213496
|
fillEdgesScanline4x4(rgba, width2, height, edges2, path2.fillColor, path2.fillAlpha ?? 1, path2.fillRule ?? "nonzero", clipScreen, original.kind === "glyph" ? aaTxt : aaVec, path2.blendMode, clipMask);
|
|
213370
213497
|
}
|
|
213371
213498
|
if (path2.strokeColor) {
|
|
213372
|
-
const edges2 = segmentsToScreenEdges(path2.segments, displayList.height, scale2, false);
|
|
213373
213499
|
const rawSw = path2.strokeWidth * scale2;
|
|
213374
213500
|
const sw = Math.max(1, rawSw);
|
|
213375
213501
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path2.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path2.strokeAlpha ?? 1;
|
|
213376
|
-
const
|
|
213377
|
-
|
|
213378
|
-
|
|
213379
|
-
|
|
213380
|
-
|
|
213381
|
-
|
|
213382
|
-
|
|
213383
|
-
|
|
213384
|
-
|
|
213385
|
-
|
|
213386
|
-
|
|
213387
|
-
|
|
213388
|
-
|
|
213389
|
-
|
|
213390
|
-
|
|
213391
|
-
|
|
213392
|
-
|
|
213393
|
-
|
|
213394
|
-
|
|
213395
|
-
|
|
213396
|
-
|
|
213397
|
-
|
|
213398
|
-
|
|
213399
|
-
|
|
213400
|
-
const t1 = (pos + step) / edgeLen;
|
|
213401
|
-
drawAntiAliasedSegment(
|
|
213402
|
-
rgba,
|
|
213403
|
-
width2,
|
|
213404
|
-
height,
|
|
213405
|
-
e.x0 + dx * t0,
|
|
213406
|
-
e.y0 + dy * t0,
|
|
213407
|
-
e.x0 + dx * t1,
|
|
213408
|
-
e.y0 + dy * t1,
|
|
213409
|
-
sw,
|
|
213410
|
-
path2.strokeColor,
|
|
213411
|
-
strokeAlpha,
|
|
213412
|
-
path2.lineCap ?? 0,
|
|
213413
|
-
original.kind === "glyph" ? aaTxt : aaVec,
|
|
213414
|
-
path2.blendMode,
|
|
213415
|
-
clipMask
|
|
213416
|
-
);
|
|
213417
|
-
}
|
|
213418
|
-
pos += step;
|
|
213419
|
-
dashDist = (dashDist + step) % dashCycle;
|
|
213420
|
-
}
|
|
213421
|
-
}
|
|
213422
|
-
}
|
|
213502
|
+
const contours = strokeOutlines(
|
|
213503
|
+
segmentsToScreenPaths(path2.segments, displayList.height, scale2),
|
|
213504
|
+
sw,
|
|
213505
|
+
path2.lineCap ?? 0,
|
|
213506
|
+
path2.lineJoin ?? 0,
|
|
213507
|
+
path2.miterLimit ?? 10,
|
|
213508
|
+
path2.dashArray?.map((value3) => Math.max(0, value3 * scale2)),
|
|
213509
|
+
(path2.dashPhase ?? 0) * scale2
|
|
213510
|
+
);
|
|
213511
|
+
const edges2 = pathsToEdges(contours.map((points) => ({ points, closed: true })));
|
|
213512
|
+
const clipScreen = path2.clipRect ? [path2.clipRect[0] * scale2, (displayList.height - path2.clipRect[3]) * scale2, path2.clipRect[2] * scale2, (displayList.height - path2.clipRect[1]) * scale2] : void 0;
|
|
213513
|
+
fillEdgesScanline4x4(
|
|
213514
|
+
rgba,
|
|
213515
|
+
width2,
|
|
213516
|
+
height,
|
|
213517
|
+
edges2,
|
|
213518
|
+
path2.strokeColor,
|
|
213519
|
+
strokeAlpha,
|
|
213520
|
+
"nonzero",
|
|
213521
|
+
clipScreen,
|
|
213522
|
+
original.kind === "glyph" ? aaTxt : aaVec,
|
|
213523
|
+
path2.blendMode,
|
|
213524
|
+
clipMask
|
|
213525
|
+
);
|
|
213423
213526
|
}
|
|
213424
213527
|
} else if (operation.kind === "image") {
|
|
213425
213528
|
const img = operation.value;
|
|
@@ -234271,6 +234374,18 @@ export {
|
|
|
234271
234374
|
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
234272
234375
|
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
234273
234376
|
*/
|
|
234377
|
+
/*!
|
|
234378
|
+
* Anti-Grain Geometry - Version 2.3
|
|
234379
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
234380
|
+
*
|
|
234381
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
234382
|
+
* is granted provided this copyright notice appears in all copies.
|
|
234383
|
+
* This software is provided "as is" without express or implied
|
|
234384
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
234385
|
+
*
|
|
234386
|
+
* Adapted from PDFium agg_math_stroke.h and agg_vcgen_stroke.cpp.
|
|
234387
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
234388
|
+
*/
|
|
234274
234389
|
/*! Bundled license information:
|
|
234275
234390
|
|
|
234276
234391
|
tslib/tslib.js:
|