@thi.ng/pixel-io-netpbm 2.1.129 → 2.1.130
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/CHANGELOG.md +1 -1
- package/package.json +9 -9
- package/read.js +1 -2
- package/write.js +3 -6
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/pixel-io-netpbm",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.130",
|
|
4
4
|
"description": "Multi-format NetPBM reader & writer support for @thi.ng/pixel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/errors": "^2.5.
|
|
41
|
-
"@thi.ng/pixel": "^6.1.
|
|
39
|
+
"@thi.ng/api": "^8.11.2",
|
|
40
|
+
"@thi.ng/errors": "^2.5.7",
|
|
41
|
+
"@thi.ng/pixel": "^6.1.32"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@microsoft/api-extractor": "^7.43.
|
|
45
|
-
"esbuild": "^0.
|
|
46
|
-
"typedoc": "^0.25.
|
|
47
|
-
"typescript": "^5.4.
|
|
44
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
45
|
+
"esbuild": "^0.21.1",
|
|
46
|
+
"typedoc": "^0.25.13",
|
|
47
|
+
"typescript": "^5.4.5"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"1bit",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"parent": "@thi.ng/pixel",
|
|
88
88
|
"year": 2021
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
91
91
|
}
|
package/read.js
CHANGED
|
@@ -74,8 +74,7 @@ const readPBM = (src, i, width, height) => {
|
|
|
74
74
|
for (let y = 0, j = 0; y < height; y++) {
|
|
75
75
|
for (let x = 0; x < width; x++, j++) {
|
|
76
76
|
data[j] = src[i] & 1 << (~x & 7) ? 0 : 255;
|
|
77
|
-
if ((x & 7) === 7 || x === w1)
|
|
78
|
-
i++;
|
|
77
|
+
if ((x & 7) === 7 || x === w1) i++;
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
return buf;
|
package/write.js
CHANGED
|
@@ -4,12 +4,10 @@ const initHeader = (magic, limits, size, buf, comments) => {
|
|
|
4
4
|
const { width, height } = buf;
|
|
5
5
|
let header = magic + "\n";
|
|
6
6
|
const comm = formatComments(comments);
|
|
7
|
-
if (comm.length)
|
|
8
|
-
header += comm + "\n";
|
|
7
|
+
if (comm.length) header += comm + "\n";
|
|
9
8
|
header += `${width} ${height}
|
|
10
9
|
`;
|
|
11
|
-
if (limits > 0)
|
|
12
|
-
header += limits + "\n";
|
|
10
|
+
if (limits > 0) header += limits + "\n";
|
|
13
11
|
const dest = new Uint8Array(size + header.length);
|
|
14
12
|
dest.set([...header].map((x) => x.charCodeAt(0)));
|
|
15
13
|
return { dest, start: header.length, abgr: buf.format.toABGR };
|
|
@@ -53,8 +51,7 @@ const asPGM = (buf, comments) => {
|
|
|
53
51
|
return dest;
|
|
54
52
|
};
|
|
55
53
|
const asPGM16 = (buf, comments) => {
|
|
56
|
-
if (buf.format !== GRAY16)
|
|
57
|
-
buf = buf.as(GRAY16);
|
|
54
|
+
if (buf.format !== GRAY16) buf = buf.as(GRAY16);
|
|
58
55
|
const { data, width, height } = buf;
|
|
59
56
|
const { dest, start } = initHeader(
|
|
60
57
|
"P5",
|