@thi.ng/pixel-dither 1.1.129 → 1.1.131
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 +7 -1
- package/README.md +2 -2
- package/dither.js +1 -2
- package/ordered.js +8 -8
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [1.1.131](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-dither@1.1.131) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
17
|
+
|
|
12
18
|
### [1.1.109](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-dither@1.1.109) (2024-02-22)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -75,7 +75,7 @@ For Node.js REPL:
|
|
|
75
75
|
const pd = await import("@thi.ng/pixel-dither");
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 1.
|
|
78
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 1.05 KB
|
|
79
79
|
|
|
80
80
|
## Dependencies
|
|
81
81
|
|
package/dither.js
CHANGED
|
@@ -15,8 +15,7 @@ const ditherWith = (kernel, img, opts = {}) => {
|
|
|
15
15
|
p = data[i] < $thresh ? 0 : $max;
|
|
16
16
|
err = (data[i] - p) * bleed;
|
|
17
17
|
data[i] = p;
|
|
18
|
-
if (!err)
|
|
19
|
-
continue;
|
|
18
|
+
if (!err) continue;
|
|
20
19
|
for (let j = ox.length; j-- > 0; ) {
|
|
21
20
|
const xx = x + ox[j];
|
|
22
21
|
const yy = y + oy[j];
|
package/ordered.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNumber } from "@thi.ng/checks/is-number";
|
|
2
2
|
import { clamp } from "@thi.ng/math/interval";
|
|
3
|
-
const
|
|
3
|
+
const __init = (x, y, size, val, step, mat) => {
|
|
4
4
|
if (size === 1) {
|
|
5
5
|
!mat[y] && (mat[y] = []);
|
|
6
6
|
mat[y][x] = val;
|
|
@@ -8,18 +8,18 @@ const init = (x, y, size, val, step, mat) => {
|
|
|
8
8
|
}
|
|
9
9
|
size >>= 1;
|
|
10
10
|
const step4 = step << 2;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
__init(x, y, size, val, step4, mat);
|
|
12
|
+
__init(x + size, y + size, size, val + step, step4, mat);
|
|
13
|
+
__init(x + size, y, size, val + step * 2, step4, mat);
|
|
14
|
+
__init(x, y + size, size, val + step * 3, step4, mat);
|
|
15
15
|
return mat;
|
|
16
16
|
};
|
|
17
17
|
const defBayer = (size) => ({
|
|
18
|
-
mat:
|
|
18
|
+
mat: __init(0, 0, size, 0, 1, []),
|
|
19
19
|
invSize: 1 / (size * size),
|
|
20
20
|
mask: size - 1
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const __orderedDither1 = ({ mat, mask, invSize }, dsteps, drange, srange, x, y, val) => {
|
|
23
23
|
val = dsteps * (val / srange) + mat[y & mask][x & mask] * invSize - 0.5 | 0;
|
|
24
24
|
dsteps--;
|
|
25
25
|
return clamp(val, 0, dsteps) * ((drange - 1) / dsteps);
|
|
@@ -36,7 +36,7 @@ const orderedDither = (img, size, numColors) => {
|
|
|
36
36
|
const cs = steps[j];
|
|
37
37
|
cs > 0 && (col = ch.setInt(
|
|
38
38
|
col,
|
|
39
|
-
|
|
39
|
+
__orderedDither1(mat, cs, num, num, x, y, ch.int(col))
|
|
40
40
|
));
|
|
41
41
|
}
|
|
42
42
|
data[i] = col;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/pixel-dither",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.131",
|
|
4
4
|
"description": "Extensible image dithering w/ various algorithm presets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/pixel-dither",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/checks": "^3.6.
|
|
40
|
-
"@thi.ng/math": "^5.
|
|
41
|
-
"@thi.ng/pixel": "^6.1.
|
|
39
|
+
"@thi.ng/checks": "^3.6.5",
|
|
40
|
+
"@thi.ng/math": "^5.11.0",
|
|
41
|
+
"@thi.ng/pixel": "^6.1.33"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@microsoft/api-extractor": "^7.
|
|
45
|
-
"esbuild": "^0.
|
|
46
|
-
"typedoc": "^0.25.
|
|
47
|
-
"typescript": "^5.
|
|
44
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
45
|
+
"esbuild": "^0.21.5",
|
|
46
|
+
"typedoc": "^0.25.13",
|
|
47
|
+
"typescript": "^5.5.2"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"typescript"
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"parent": "@thi.ng/pixel",
|
|
106
106
|
"year": 2021
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
109
109
|
}
|