@thi.ng/rasterize 1.0.171 → 1.0.173
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/README.md +1 -1
- package/draw.js +4 -4
- package/line.js +1 -1
- package/package.json +9 -9
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 211 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
|
>
|
package/draw.js
CHANGED
|
@@ -9,11 +9,11 @@ const __drawSolid2D = (pts, grid, val) => {
|
|
|
9
9
|
offset,
|
|
10
10
|
stride: [sx, sy]
|
|
11
11
|
} = grid;
|
|
12
|
-
for (
|
|
12
|
+
for (const p of pts) {
|
|
13
13
|
data[offset + p[0] * sx + p[1] * sy] = val;
|
|
14
14
|
}
|
|
15
15
|
} else {
|
|
16
|
-
for (
|
|
16
|
+
for (const p of pts) {
|
|
17
17
|
grid.setAtUnsafe(p[0], p[1], val);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -27,11 +27,11 @@ const __drawShader2D = (pts, grid, shader) => {
|
|
|
27
27
|
offset,
|
|
28
28
|
stride: [sx, sy]
|
|
29
29
|
} = grid;
|
|
30
|
-
for (
|
|
30
|
+
for (const { 0: x, 1: y } of pts) {
|
|
31
31
|
data[offset + x * sx + y * sy] = shader(grid, x, y);
|
|
32
32
|
}
|
|
33
33
|
} else {
|
|
34
|
-
for (
|
|
34
|
+
for (const { 0: x, 1: y } of pts) {
|
|
35
35
|
grid.setAtUnsafe(x, y, shader(grid, x, y));
|
|
36
36
|
}
|
|
37
37
|
}
|
package/line.js
CHANGED
|
@@ -8,7 +8,7 @@ const drawLine = (grid, x1, y1, x2, y2, val) => __draw2D(
|
|
|
8
8
|
const traceLine = (grid, x1, y1, x2, y2, fn) => {
|
|
9
9
|
const pts = lineClipped(x1, y1, x2, y2, 0, 0, grid.size[0], grid.size[1]);
|
|
10
10
|
if (pts) {
|
|
11
|
-
for (
|
|
11
|
+
for (const p of pts) fn(p);
|
|
12
12
|
}
|
|
13
13
|
return grid;
|
|
14
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rasterize",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.173",
|
|
4
4
|
"description": "Headless 2D shape drawing, filling & rasterization for arbitrary targets/purposes (no canvas required)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/checks": "^3.
|
|
44
|
-
"@thi.ng/equiv": "^2.1.
|
|
45
|
-
"@thi.ng/grid-iterators": "^4.0.
|
|
46
|
-
"@thi.ng/porter-duff": "^2.1.
|
|
47
|
-
"@thi.ng/random": "^4.1.
|
|
48
|
-
"@thi.ng/transducers": "^9.6.
|
|
42
|
+
"@thi.ng/api": "^8.12.10",
|
|
43
|
+
"@thi.ng/checks": "^3.8.0",
|
|
44
|
+
"@thi.ng/equiv": "^2.1.100",
|
|
45
|
+
"@thi.ng/grid-iterators": "^4.0.145",
|
|
46
|
+
"@thi.ng/porter-duff": "^2.1.122",
|
|
47
|
+
"@thi.ng/random": "^4.1.35",
|
|
48
|
+
"@thi.ng/transducers": "^9.6.19"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"esbuild": "^0.27.0",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"status": "alpha",
|
|
127
127
|
"year": 2021
|
|
128
128
|
},
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "8625a1c6383737a8fdbe7a3f96ea3cbabc957fa6\n"
|
|
130
130
|
}
|