pdf-raster-cpu 1.0.1 → 1.0.2
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/index.cjs +3 -5
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,6 @@ var CoverageMask = class {
|
|
|
16
16
|
return this.counts[pixelIndex] ?? 0;
|
|
17
17
|
}
|
|
18
18
|
fillPolygons(polygons, fillRule) {
|
|
19
|
-
if (polygons.length === 0) return;
|
|
20
19
|
let minY = Infinity;
|
|
21
20
|
let maxY = -Infinity;
|
|
22
21
|
for (const polygon of polygons) {
|
|
@@ -44,7 +43,6 @@ var CoverageMask = class {
|
|
|
44
43
|
dir: b.y > a.y ? 1 : -1
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
|
-
if (crossings.length === 0) continue;
|
|
48
46
|
crossings.sort((p, q) => p.x - q.x);
|
|
49
47
|
const pixelRowBase = Math.floor(row / 4) * this.widthPx;
|
|
50
48
|
let spanStartX;
|
|
@@ -60,7 +58,7 @@ var CoverageMask = class {
|
|
|
60
58
|
}
|
|
61
59
|
const previous = winding;
|
|
62
60
|
winding += crossing.dir;
|
|
63
|
-
if (previous === 0
|
|
61
|
+
if (previous === 0) spanStartX = crossing.x;
|
|
64
62
|
else if (spanStartX !== void 0 && winding === 0) {
|
|
65
63
|
this.markSpan(pixelRowBase, spanStartX, crossing.x);
|
|
66
64
|
spanStartX = void 0;
|
|
@@ -198,7 +196,7 @@ function strokeOutlinePolygons(subpaths, widthPx, dashPx) {
|
|
|
198
196
|
const first = subpath.points[0];
|
|
199
197
|
if (first === void 0) continue;
|
|
200
198
|
emitPiece(subpath.closed ? [...subpath.points, first] : subpath.points);
|
|
201
|
-
if (subpath.closed
|
|
199
|
+
if (subpath.closed) {
|
|
202
200
|
const last = subpath.points[subpath.points.length - 1];
|
|
203
201
|
const second = subpath.points[1];
|
|
204
202
|
if (last !== void 0 && second !== void 0) emitJoinWedge(polygons, first, last, second, half);
|
|
@@ -235,7 +233,7 @@ function emitJoinWedge(polygons, vertex, before, after, half) {
|
|
|
235
233
|
const dot = n1.x * n2.x + n1.y * n2.y;
|
|
236
234
|
const denominator = 1 + dot;
|
|
237
235
|
let wedge;
|
|
238
|
-
if (
|
|
236
|
+
if (miterRatio(dot) <= 10) {
|
|
239
237
|
const scale = half / denominator;
|
|
240
238
|
wedge = [
|
|
241
239
|
a1,
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var CoverageMask = class {
|
|
|
15
15
|
return this.counts[pixelIndex] ?? 0;
|
|
16
16
|
}
|
|
17
17
|
fillPolygons(polygons, fillRule) {
|
|
18
|
-
if (polygons.length === 0) return;
|
|
19
18
|
let minY = Infinity;
|
|
20
19
|
let maxY = -Infinity;
|
|
21
20
|
for (const polygon of polygons) {
|
|
@@ -43,7 +42,6 @@ var CoverageMask = class {
|
|
|
43
42
|
dir: b.y > a.y ? 1 : -1
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
|
-
if (crossings.length === 0) continue;
|
|
47
45
|
crossings.sort((p, q) => p.x - q.x);
|
|
48
46
|
const pixelRowBase = Math.floor(row / 4) * this.widthPx;
|
|
49
47
|
let spanStartX;
|
|
@@ -59,7 +57,7 @@ var CoverageMask = class {
|
|
|
59
57
|
}
|
|
60
58
|
const previous = winding;
|
|
61
59
|
winding += crossing.dir;
|
|
62
|
-
if (previous === 0
|
|
60
|
+
if (previous === 0) spanStartX = crossing.x;
|
|
63
61
|
else if (spanStartX !== void 0 && winding === 0) {
|
|
64
62
|
this.markSpan(pixelRowBase, spanStartX, crossing.x);
|
|
65
63
|
spanStartX = void 0;
|
|
@@ -197,7 +195,7 @@ function strokeOutlinePolygons(subpaths, widthPx, dashPx) {
|
|
|
197
195
|
const first = subpath.points[0];
|
|
198
196
|
if (first === void 0) continue;
|
|
199
197
|
emitPiece(subpath.closed ? [...subpath.points, first] : subpath.points);
|
|
200
|
-
if (subpath.closed
|
|
198
|
+
if (subpath.closed) {
|
|
201
199
|
const last = subpath.points[subpath.points.length - 1];
|
|
202
200
|
const second = subpath.points[1];
|
|
203
201
|
if (last !== void 0 && second !== void 0) emitJoinWedge(polygons, first, last, second, half);
|
|
@@ -234,7 +232,7 @@ function emitJoinWedge(polygons, vertex, before, after, half) {
|
|
|
234
232
|
const dot = n1.x * n2.x + n1.y * n2.y;
|
|
235
233
|
const denominator = 1 + dot;
|
|
236
234
|
let wedge;
|
|
237
|
-
if (
|
|
235
|
+
if (miterRatio(dot) <= 10) {
|
|
238
236
|
const scale = half / denominator;
|
|
239
237
|
wedge = [
|
|
240
238
|
a1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-raster-cpu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Pure-software reference backend for pdf-codec's PageRasteriser port: an RGBA scanline rasteriser that renders a page (or a located figure region) to PNG bytes with no canvas dependency, on any Worker-isomorphic runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"license": "MIT",
|
|
79
79
|
"packageManager": "pnpm@11.6.0",
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"byte-codec": "1.5.
|
|
82
|
-
"pdf-codec": "4.8.
|
|
81
|
+
"byte-codec": "1.5.2",
|
|
82
|
+
"pdf-codec": "4.8.2"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@arethetypeswrong/cli": "0.18.5",
|