@thi.ng/rasterize 1.0.100 → 1.0.102

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:18Z
3
+ - **Last updated**: 2024-05-08T18:24:32Z
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.
package/draw.js CHANGED
@@ -2,8 +2,7 @@ import { isFunction } from "@thi.ng/checks/is-function";
2
2
  import { isPrimitive } from "@thi.ng/checks/is-primitive";
3
3
  const __draw2D = (pts, grid, val) => isFunction(val) ? __drawShader2D(pts, grid, val) : __drawSolid2D(pts, grid, val);
4
4
  const __drawSolid2D = (pts, grid, val) => {
5
- if (!pts)
6
- return grid;
5
+ if (!pts) return grid;
7
6
  if (isPrimitive(val)) {
8
7
  const {
9
8
  data,
@@ -21,8 +20,7 @@ const __drawSolid2D = (pts, grid, val) => {
21
20
  return grid;
22
21
  };
23
22
  const __drawShader2D = (pts, grid, shader) => {
24
- if (!pts)
25
- return grid;
23
+ if (!pts) return grid;
26
24
  if (isPrimitive(grid.getAtUnsafe(0, 0))) {
27
25
  const {
28
26
  data,
package/line.js CHANGED
@@ -8,8 +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 (let p of pts)
12
- fn(p);
11
+ for (let p of pts) fn(p);
13
12
  }
14
13
  return grid;
15
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/rasterize",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "description": "2D shape drawing & rasterization",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -36,19 +36,19 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.1",
40
- "@thi.ng/checks": "^3.6.3",
41
- "@thi.ng/equiv": "^2.1.57",
42
- "@thi.ng/grid-iterators": "^4.0.72",
43
- "@thi.ng/porter-duff": "^2.1.78",
44
- "@thi.ng/random": "^3.7.5",
45
- "@thi.ng/transducers": "^9.0.3"
39
+ "@thi.ng/api": "^8.11.2",
40
+ "@thi.ng/checks": "^3.6.4",
41
+ "@thi.ng/equiv": "^2.1.58",
42
+ "@thi.ng/grid-iterators": "^4.0.74",
43
+ "@thi.ng/porter-duff": "^2.1.79",
44
+ "@thi.ng/random": "^3.8.0",
45
+ "@thi.ng/transducers": "^9.0.5"
46
46
  },
47
47
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.43.0",
49
- "esbuild": "^0.20.2",
50
- "typedoc": "^0.25.12",
51
- "typescript": "^5.4.3"
48
+ "@microsoft/api-extractor": "^7.43.2",
49
+ "esbuild": "^0.21.1",
50
+ "typedoc": "^0.25.13",
51
+ "typescript": "^5.4.5"
52
52
  },
53
53
  "keywords": [
54
54
  "2d",
@@ -119,5 +119,5 @@
119
119
  "status": "alpha",
120
120
  "year": 2021
121
121
  },
122
- "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
122
+ "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
123
123
  }
package/poly.js CHANGED
@@ -18,8 +18,7 @@ const fillPoly = (grid, pts, val) => {
18
18
  maxX = Math.min(maxX | 0, width - 1);
19
19
  minY = Math.max(minY | 0, 0);
20
20
  maxY = Math.min(maxY | 0, height - 1);
21
- if (minX >= width || maxX < 0 || minY >= height || maxY < 0)
22
- return;
21
+ if (minX >= width || maxX < 0 || minY >= height || maxY < 0) return;
23
22
  let i = 0;
24
23
  let k = 0;
25
24
  let j;
@@ -38,8 +37,7 @@ const fillPoly = (grid, pts, val) => {
38
37
  isec.sort((a, b) => a - b);
39
38
  for (i = 0; i < k; i += 2) {
40
39
  let x1 = isec[i];
41
- if (x1 > maxX)
42
- break;
40
+ if (x1 > maxX) break;
43
41
  let x2 = isec[i + 1];
44
42
  if (x2 > minX) {
45
43
  x1 < minX && (x1 = minX);