@4bitlabs/sci0-renderer 0.1.1 → 1.0.0

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.
Files changed (85) hide show
  1. package/dist/filters/loop-padding-filter.d.ts +6 -3
  2. package/dist/filters/loop-padding-filter.d.ts.map +1 -1
  3. package/dist/filters/loop-padding-filter.js +25 -30
  4. package/dist/filters/loop-padding-filter.js.map +1 -1
  5. package/dist/filters/menu-text-filter.d.ts +10 -7
  6. package/dist/filters/menu-text-filter.d.ts.map +1 -1
  7. package/dist/filters/menu-text-filter.js +22 -35
  8. package/dist/filters/menu-text-filter.js.map +1 -1
  9. package/dist/index.d.ts +7 -8
  10. package/dist/index.js +5 -12
  11. package/dist/pic/default-palette.js +45 -9
  12. package/dist/pic/default-palette.js.map +1 -1
  13. package/dist/pic/default-palettes.js +9 -9
  14. package/dist/pic/default-palettes.js.map +1 -1
  15. package/dist/pic/generate-pic.d.ts +7 -4
  16. package/dist/pic/generate-pic.d.ts.map +1 -1
  17. package/dist/pic/generate-pic.js +22 -40
  18. package/dist/pic/generate-pic.js.map +1 -1
  19. package/dist/pic/pic-step.js +42 -43
  20. package/dist/pic/pic-step.js.map +1 -1
  21. package/dist/pic/render-pic-options.d.ts +18 -15
  22. package/dist/pic/render-pic-options.d.ts.map +1 -1
  23. package/dist/pic/render-pic.d.ts +7 -4
  24. package/dist/pic/render-pic.d.ts.map +1 -1
  25. package/dist/pic/render-pic.js +18 -40
  26. package/dist/pic/render-pic.js.map +1 -1
  27. package/dist/pic/render-result.d.ts +9 -6
  28. package/dist/pic/render-result.d.ts.map +1 -1
  29. package/dist/pic/screen-buffer.js +64 -67
  30. package/dist/pic/screen-buffer.js.map +1 -1
  31. package/dist/pic/tools/circles.js +82 -84
  32. package/dist/pic/tools/circles.js.map +1 -1
  33. package/dist/pic/tools/create-blitter.js +14 -19
  34. package/dist/pic/tools/create-blitter.js.map +1 -1
  35. package/dist/pic/tools/create-brush.js +22 -34
  36. package/dist/pic/tools/create-brush.js.map +1 -1
  37. package/dist/pic/tools/create-flood-fill.js +43 -60
  38. package/dist/pic/tools/create-flood-fill.js.map +1 -1
  39. package/dist/pic/tools/create-line.js +37 -43
  40. package/dist/pic/tools/create-line.js.map +1 -1
  41. package/dist/pic/tools/index.js +5 -14
  42. package/dist/pic/tools/noise.js +160 -22
  43. package/dist/pic/tools/noise.js.map +1 -1
  44. package/dist/utils/exhaustive.js +5 -4
  45. package/dist/utils/exhaustive.js.map +1 -1
  46. package/package.json +16 -15
  47. package/dist/index.d.ts.map +0 -1
  48. package/dist/index.js.map +0 -1
  49. package/dist/pic/default-palette.d.ts +0 -2
  50. package/dist/pic/default-palette.d.ts.map +0 -1
  51. package/dist/pic/default-palettes.d.ts +0 -3
  52. package/dist/pic/default-palettes.d.ts.map +0 -1
  53. package/dist/pic/pic-step.d.ts +0 -4
  54. package/dist/pic/pic-step.d.ts.map +0 -1
  55. package/dist/pic/render-pic-options.js +0 -3
  56. package/dist/pic/render-pic-options.js.map +0 -1
  57. package/dist/pic/render-result.js +0 -3
  58. package/dist/pic/render-result.js.map +0 -1
  59. package/dist/pic/screen-buffer.d.ts +0 -7
  60. package/dist/pic/screen-buffer.d.ts.map +0 -1
  61. package/dist/pic/tools/circles.d.ts +0 -3
  62. package/dist/pic/tools/circles.d.ts.map +0 -1
  63. package/dist/pic/tools/create-blitter.d.ts +0 -5
  64. package/dist/pic/tools/create-blitter.d.ts.map +0 -1
  65. package/dist/pic/tools/create-brush.d.ts +0 -4
  66. package/dist/pic/tools/create-brush.d.ts.map +0 -1
  67. package/dist/pic/tools/create-flood-fill.d.ts +0 -4
  68. package/dist/pic/tools/create-flood-fill.d.ts.map +0 -1
  69. package/dist/pic/tools/create-line.d.ts +0 -3
  70. package/dist/pic/tools/create-line.d.ts.map +0 -1
  71. package/dist/pic/tools/create-marker.d.ts +0 -3
  72. package/dist/pic/tools/create-marker.d.ts.map +0 -1
  73. package/dist/pic/tools/create-marker.js +0 -11
  74. package/dist/pic/tools/create-marker.js.map +0 -1
  75. package/dist/pic/tools/index.d.ts +0 -6
  76. package/dist/pic/tools/index.d.ts.map +0 -1
  77. package/dist/pic/tools/index.js.map +0 -1
  78. package/dist/pic/tools/noise.d.ts +0 -3
  79. package/dist/pic/tools/noise.d.ts.map +0 -1
  80. package/dist/pic/tools/screen.d.ts +0 -16
  81. package/dist/pic/tools/screen.d.ts.map +0 -1
  82. package/dist/pic/tools/screen.js +0 -3
  83. package/dist/pic/tools/screen.js.map +0 -1
  84. package/dist/utils/exhaustive.d.ts +0 -2
  85. package/dist/utils/exhaustive.d.ts.map +0 -1
@@ -1,63 +1,46 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFloodFill = void 0;
4
- const numeric_deque_1 = require("@4bitlabs/numeric-deque");
1
+ import { NumericDeque } from "@4bitlabs/numeric-deque";
2
+ //#region src/pic/tools/create-flood-fill.ts
5
3
  const createFloodFill = (plot, isLegal, [width, height]) => {
6
- const visited = new Uint8ClampedArray(width * height);
7
- const stack = new numeric_deque_1.NumericDeque(width * height, Uint32Array);
8
- return function floodFill(ix, iy, drawMode, drawCodes) {
9
- visited.fill(0);
10
- stack.clear();
11
- const start = iy * width + ix;
12
- stack.push(start);
13
- do {
14
- const i = stack.shift();
15
- if (visited[i])
16
- continue;
17
- visited[i] = 0xff;
18
- const x = i % width;
19
- const y = (i / width) >>> 0;
20
- if (!isLegal(x, y, drawMode))
21
- continue;
22
- plot(x, y, drawMode, drawCodes);
23
- const initialAbove = y - 1 >= 0 && !visited[i - width] && isLegal(x, y - 1, drawMode);
24
- const initialBelow = y + 1 < height && !visited[i + width] && isLegal(x, y + 1, drawMode);
25
- if (initialAbove)
26
- stack.push(i - width);
27
- if (initialBelow)
28
- stack.push(i + width);
29
- // scan right and left
30
- for (let dir = 1; dir >= -1; dir -= 2) {
31
- let visitedAbove = initialAbove;
32
- let visitedBelow = initialBelow;
33
- for (let sx = x + dir; (dir > 0 ? sx < width : sx >= 0) && isLegal(sx, y, drawMode); sx += dir) {
34
- const idx = i + (sx - x);
35
- visited[idx] = 0xff;
36
- plot(sx, y, drawMode, drawCodes);
37
- if (y - 1 >= 0 && !visited[idx - width]) {
38
- if (isLegal(sx, y - 1, drawMode)) {
39
- if (!visitedAbove)
40
- stack.push(idx - width);
41
- visitedAbove = true;
42
- }
43
- else {
44
- visitedAbove = false;
45
- }
46
- }
47
- if (y + 1 < height && !visited[idx + width]) {
48
- if (isLegal(sx, y + 1, drawMode)) {
49
- if (!visitedBelow)
50
- stack.push(idx + width);
51
- visitedBelow = true;
52
- }
53
- else {
54
- visitedBelow = false;
55
- }
56
- }
57
- }
58
- }
59
- } while (!stack.isEmpty());
60
- };
4
+ const visited = new Uint8ClampedArray(width * height);
5
+ const stack = new NumericDeque(width * height, Uint32Array);
6
+ return function floodFill(ix, iy, drawMode, drawCodes) {
7
+ visited.fill(0);
8
+ stack.clear();
9
+ const start = iy * width + ix;
10
+ stack.push(start);
11
+ do {
12
+ const i = stack.shift();
13
+ if (visited[i]) continue;
14
+ visited[i] = 255;
15
+ const x = i % width;
16
+ const y = i / width >>> 0;
17
+ if (!isLegal(x, y, drawMode)) continue;
18
+ plot(x, y, drawMode, drawCodes);
19
+ const initialAbove = y - 1 >= 0 && !visited[i - width] && isLegal(x, y - 1, drawMode);
20
+ const initialBelow = y + 1 < height && !visited[i + width] && isLegal(x, y + 1, drawMode);
21
+ if (initialAbove) stack.push(i - width);
22
+ if (initialBelow) stack.push(i + width);
23
+ for (let dir = 1; dir >= -1; dir -= 2) {
24
+ let visitedAbove = initialAbove;
25
+ let visitedBelow = initialBelow;
26
+ for (let sx = x + dir; (dir > 0 ? sx < width : sx >= 0) && isLegal(sx, y, drawMode); sx += dir) {
27
+ const idx = i + (sx - x);
28
+ visited[idx] = 255;
29
+ plot(sx, y, drawMode, drawCodes);
30
+ if (y - 1 >= 0 && !visited[idx - width]) if (isLegal(sx, y - 1, drawMode)) {
31
+ if (!visitedAbove) stack.push(idx - width);
32
+ visitedAbove = true;
33
+ } else visitedAbove = false;
34
+ if (y + 1 < height && !visited[idx + width]) if (isLegal(sx, y + 1, drawMode)) {
35
+ if (!visitedBelow) stack.push(idx + width);
36
+ visitedBelow = true;
37
+ } else visitedBelow = false;
38
+ }
39
+ }
40
+ } while (!stack.isEmpty());
41
+ };
61
42
  };
62
- exports.createFloodFill = createFloodFill;
43
+ //#endregion
44
+ export { createFloodFill };
45
+
63
46
  //# sourceMappingURL=create-flood-fill.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-flood-fill.js","sourceRoot":"","sources":["../../../src/pic/tools/create-flood-fill.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAKhD,MAAM,eAAe,GAAG,CAC7B,IAAa,EACb,OAAmB,EACnB,CAAC,KAAK,EAAE,MAAM,CAAiB,EACvB,EAAE;IACV,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,IAAI,4BAAY,CAAC,KAAK,GAAG,MAAM,EAAE,WAAW,CAAC,CAAC;IAE5D,OAAO,SAAS,SAAS,CACvB,EAAU,EACV,EAAU,EACV,QAAkB,EAClB,SAAoB;QAEpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,KAAK,CAAC,KAAK,EAAE,CAAC;QAEd,MAAM,KAAK,GAAG,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAElB,GAAG,CAAC;YACF,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAExB,IAAI,OAAO,CAAC,CAAC,CAAC;gBAAE,SAAS;YACzB,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YAElB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK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AAC,GAAG,IAAI,CAAC;oBACpB,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;oBAEjC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;wBACxC,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC;4BACjC,IAAI,CAAC,YAAY;gCAAE,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;4BAC3C,YAAY,GAAG,IAAI,CAAC;wBACtB,CAAC;6BAAM,CAAC;4BACN,YAAY,GAAG,KAAK,CAAC;wBACvB,CAAC;oBACH,CAAC;oBAED,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;wBAC5C,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC;4BACjC,IAAI,CAAC,YAAY;gCAAE,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;4BAC3C,YAAY,GAAG,IAAI,CAAC;wBACtB,CAAC;6BAAM,CAAC;4BACN,YAAY,GAAG,KAAK,CAAC;wBACvB,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE;IAC7B,CAAC,CAAC;AACJ,CAAC,CAAC;AA3EW,QAAA,eAAe,mBA2E1B"}
1
+ {"version":3,"file":"create-flood-fill.js","names":[],"sources":["../../../src/pic/tools/create-flood-fill.ts"],"sourcesContent":["import { NumericDeque } from '@4bitlabs/numeric-deque';\nimport type { Vec2 } from '@4bitlabs/vec2';\nimport type { DrawMode, DrawCodes } from '@4bitlabs/sci0';\nimport type { Filler, IsFillable, Plotter } from './screen.js';\n\nexport const createFloodFill = (\n plot: Plotter,\n isLegal: IsFillable,\n [width, height]: Readonly<Vec2>,\n): Filler => {\n const visited = new Uint8ClampedArray(width * height);\n const stack = new NumericDeque(width * height, Uint32Array);\n\n return function floodFill(\n ix: number,\n iy: number,\n drawMode: DrawMode,\n drawCodes: DrawCodes,\n ): void {\n visited.fill(0);\n stack.clear();\n\n const start = iy * width + ix;\n stack.push(start);\n\n do {\n const i = stack.shift();\n\n if (visited[i]) continue;\n visited[i] = 0xff;\n\n const x = i % width;\n const y = (i / width) >>> 0;\n\n if (!isLegal(x, y, drawMode)) continue;\n plot(x, y, drawMode, drawCodes);\n\n const initialAbove =\n y - 1 >= 0 && !visited[i - width] && isLegal(x, y - 1, drawMode);\n const initialBelow =\n y + 1 < height && !visited[i + width] && isLegal(x, y + 1, drawMode);\n\n if (initialAbove) stack.push(i - width);\n if (initialBelow) stack.push(i + width);\n\n // scan right and left\n for (let dir = 1; dir >= -1; dir -= 2) {\n let visitedAbove = initialAbove;\n let visitedBelow = initialBelow;\n\n for (\n let sx = x + dir;\n (dir > 0 ? sx < width : sx >= 0) && isLegal(sx, y, drawMode);\n sx += dir\n ) {\n const idx = i + (sx - x);\n visited[idx] = 0xff;\n plot(sx, y, drawMode, drawCodes);\n\n if (y - 1 >= 0 && !visited[idx - width]) {\n if (isLegal(sx, y - 1, drawMode)) {\n if (!visitedAbove) stack.push(idx - width);\n visitedAbove = true;\n } else {\n visitedAbove = false;\n }\n }\n\n if (y + 1 < height && !visited[idx + width]) {\n if (isLegal(sx, y + 1, drawMode)) {\n if (!visitedBelow) stack.push(idx + width);\n visitedBelow = true;\n } else {\n visitedBelow = false;\n }\n }\n }\n }\n } while (!stack.isEmpty());\n };\n};\n"],"mappings":";;AAKA,MAAa,mBACX,MACA,SACA,CAAC,OAAO,YACG;CACX,MAAM,UAAU,IAAI,kBAAkB,QAAQ,MAAM;CACpD,MAAM,QAAQ,IAAI,aAAa,QAAQ,QAAQ,WAAW;C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C,cAAc,MAAM,KAAK,MAAM,KAAK;MACzC,eAAe;KACjB,OACE,eAAe;IAGrB;GACF;EACF,SAAS,CAAC,MAAM,QAAQ;CAC1B;AACF"}
@@ -1,46 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLine = void 0;
1
+ //#region src/pic/tools/create-line.ts
4
2
  const createLine = (plot) => function line(x0, y0, x1, y1, drawMode, drawCodes) {
5
- if (x0 === x1) {
6
- for (let y = Math.min(y0, y1); y <= Math.max(y0, y1); y++)
7
- plot(x0, y, drawMode, drawCodes);
8
- return;
9
- }
10
- if (y0 === y1) {
11
- for (let x = Math.min(x0, x1); x <= Math.max(x0, x1); x++)
12
- plot(x, y0, drawMode, drawCodes);
13
- return;
14
- }
15
- plot(x0, y0, drawMode, drawCodes);
16
- plot(x1, y1, drawMode, drawCodes);
17
- const dx = x1 - x0;
18
- const dy = y1 - y0;
19
- const adx = Math.abs(dx);
20
- const ady = Math.abs(dy);
21
- const sx = dx > 0 ? 1 : -1;
22
- const sy = dy > 0 ? 1 : -1;
23
- let eps = 0;
24
- if (adx > ady) {
25
- for (let x = x0, y = y0; sx < 0 ? x >= x1 : x <= x1; x += sx) {
26
- plot(x, y, drawMode, drawCodes);
27
- eps += ady;
28
- if (eps << 1 >= adx) {
29
- y += sy;
30
- eps -= adx;
31
- }
32
- }
33
- }
34
- else {
35
- for (let x = x0, y = y0; sy < 0 ? y >= y1 : y <= y1; y += sy) {
36
- plot(x, y, drawMode, drawCodes);
37
- eps += adx;
38
- if (eps << 1 >= ady) {
39
- x += sx;
40
- eps -= ady;
41
- }
42
- }
43
- }
3
+ if (x0 === x1) {
4
+ for (let y = Math.min(y0, y1); y <= Math.max(y0, y1); y++) plot(x0, y, drawMode, drawCodes);
5
+ return;
6
+ }
7
+ if (y0 === y1) {
8
+ for (let x = Math.min(x0, x1); x <= Math.max(x0, x1); x++) plot(x, y0, drawMode, drawCodes);
9
+ return;
10
+ }
11
+ plot(x0, y0, drawMode, drawCodes);
12
+ plot(x1, y1, drawMode, drawCodes);
13
+ const dx = x1 - x0;
14
+ const dy = y1 - y0;
15
+ const adx = Math.abs(dx);
16
+ const ady = Math.abs(dy);
17
+ const sx = dx > 0 ? 1 : -1;
18
+ const sy = dy > 0 ? 1 : -1;
19
+ let eps = 0;
20
+ if (adx > ady) for (let x = x0, y = y0; sx < 0 ? x >= x1 : x <= x1; x += sx) {
21
+ plot(x, y, drawMode, drawCodes);
22
+ eps += ady;
23
+ if (eps << 1 >= adx) {
24
+ y += sy;
25
+ eps -= adx;
26
+ }
27
+ }
28
+ else for (let x = x0, y = y0; sy < 0 ? y >= y1 : y <= y1; y += sy) {
29
+ plot(x, y, drawMode, drawCodes);
30
+ eps += adx;
31
+ if (eps << 1 >= ady) {
32
+ x += sx;
33
+ eps -= ady;
34
+ }
35
+ }
44
36
  };
45
- exports.createLine = createLine;
37
+ //#endregion
38
+ export { createLine };
39
+
46
40
  //# sourceMappingURL=create-line.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-line.js","sourceRoot":"","sources":["../../../src/pic/tools/create-line.ts"],"names":[],"mappings":";;;AAGO,MAAM,UAAU,GAAG,CAAC,IAAa,EAAS,EAAE,CACjD,SAAS,IAAI,CACX,EAAU,EACV,EAAU,EACV,EAAU,EACV,EAAU,EACV,QAAkB,EAClB,SAAoB;IAEpB,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;YACvD,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG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C,IAAI,EAAE,CAAC;gBACR,GAAG,IAAI,GAAG,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7D,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAChC,GAAG,IAAI,GAAG,CAAC;YACX,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;gBACpB,CAAC,IAAI,EAAE,CAAC;gBACR,GAAG,IAAI,GAAG,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AApDS,QAAA,UAAU,cAoDnB"}
1
+ {"version":3,"file":"create-line.js","names":[],"sources":["../../../src/pic/tools/create-line.ts"],"sourcesContent":["import type { DrawMode, DrawCodes } from '@4bitlabs/sci0';\nimport type { Liner, Plotter } from './screen.js';\n\nexport const createLine = (plot: Plotter): Liner =>\n function line(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n drawMode: DrawMode,\n drawCodes: DrawCodes,\n ): void {\n if (x0 === x1) {\n for (let y = Math.min(y0, y1); y <= Math.max(y0, y1); y++)\n plot(x0, y, drawMode, drawCodes);\n return;\n }\n\n if (y0 === y1) {\n for (let x = Math.min(x0, x1); x <= Math.max(x0, x1); x++)\n plot(x, y0, drawMode, drawCodes);\n return;\n }\n\n plot(x0, y0, drawMode, drawCodes);\n plot(x1, y1, drawMode, drawCodes);\n\n const dx = x1 - x0;\n const dy = y1 - y0;\n const adx = Math.abs(dx);\n const ady = Math.abs(dy);\n const sx = dx > 0 ? 1 : -1;\n const sy = dy > 0 ? 1 : -1;\n\n let eps = 0;\n\n if (adx > ady) {\n for (let x = x0, y = y0; sx < 0 ? x >= x1 : x <= x1; x += sx) {\n plot(x, y, drawMode, drawCodes);\n eps += ady;\n if (eps << 1 >= adx) {\n y += sy;\n eps -= adx;\n }\n }\n } else {\n for (let x = x0, y = y0; sy < 0 ? y >= y1 : y <= y1; y += sy) {\n plot(x, y, drawMode, drawCodes);\n eps += adx;\n if (eps << 1 >= ady) {\n x += sx;\n eps -= ady;\n }\n }\n }\n };\n"],"mappings":";AAGA,MAAa,cAAc,SACzB,SAAS,KACP,IACA,IACA,IACA,IACA,UACA,WACM;CACN,IAAI,OAAO,IAAI;EACb,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,EAAE,GAAG,KAAK,KAAK,IAAI,IAAI,EAAE,GAAG,KACpD,KAAK,IAAI,GAAG,UAAU,SAAS;EACjC;CACF;CAEA,IAAI,OAAO,IAAI;EACb,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,EAAE,GAAG,KAAK,KAAK,IAAI,IAAI,EAAE,GAAG,KACpD,KAAK,GAAG,IAAI,UAAU,SAAS;EACjC;CACF;CAEA,KAAK,IAAI,IAAI,UAAU,SAAS;CAChC,KAAK,IAAI,IAAI,UAAU,SAAS;CAEhC,MAAM,KAAK,KAAK;CAChB,MAAM,KAAK,KAAK;CAChB,MAAM,MAAM,KAAK,IAAI,EAAE;CACvB,MAAM,MAAM,KAAK,IAAI,EAAE;CACvB,MAAM,KAAK,KAAK,IAAI,IAAI;CACxB,MAAM,KAAK,KAAK,IAAI,IAAI;CAExB,IAAI,MAAM;CAEV,IAAI,MAAM,KACR,KAAK,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,IAAI;EAC5D,KAAK,GAAG,GAAG,UAAU,SAAS;EAC9B,OAAO;EACP,IAAI,OAAO,KAAK,KAAK;GACnB,KAAK;GACL,OAAO;EACT;CACF;MAEA,KAAK,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,IAAI;EAC5D,KAAK,GAAG,GAAG,UAAU,SAAS;EAC9B,OAAO;EACP,IAAI,OAAO,KAAK,KAAK;GACnB,KAAK;GACL,OAAO;EACT;CACF;AAEJ"}
@@ -1,14 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createBlitter = exports.createMarker = exports.createLine = exports.createFloodFill = exports.createBrush = void 0;
4
- var create_brush_1 = require("./create-brush");
5
- Object.defineProperty(exports, "createBrush", { enumerable: true, get: function () { return create_brush_1.createBrush; } });
6
- var create_flood_fill_1 = require("./create-flood-fill");
7
- Object.defineProperty(exports, "createFloodFill", { enumerable: true, get: function () { return create_flood_fill_1.createFloodFill; } });
8
- var create_line_1 = require("./create-line");
9
- Object.defineProperty(exports, "createLine", { enumerable: true, get: function () { return create_line_1.createLine; } });
10
- var create_marker_1 = require("./create-marker");
11
- Object.defineProperty(exports, "createMarker", { enumerable: true, get: function () { return create_marker_1.createMarker; } });
12
- var create_blitter_1 = require("./create-blitter");
13
- Object.defineProperty(exports, "createBlitter", { enumerable: true, get: function () { return create_blitter_1.createBlitter; } });
14
- //# sourceMappingURL=index.js.map
1
+ import { createBrush } from "./create-brush.js";
2
+ import { createFloodFill } from "./create-flood-fill.js";
3
+ import { createLine } from "./create-line.js";
4
+ import { createBlitter } from "./create-blitter.js";
5
+ export { createBlitter, createBrush, createFloodFill, createLine };
@@ -1,24 +1,162 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NOISE_OFFSETS = exports.NOISE = void 0;
4
- const BYTE = Array(8)
5
- .fill(0)
6
- .map((_, i) => i);
7
- exports.NOISE = [
8
- 0x20, 0x94, 0x02, 0x24, 0x90, 0x82, 0xa4, 0xa2, 0x82, 0x09, 0x0a, 0x22, 0x12,
9
- 0x10, 0x42, 0x14, 0x91, 0x4a, 0x91, 0x11, 0x08, 0x12, 0x25, 0x10, 0x22, 0xa8,
10
- 0x14, 0x24, 0x00, 0x50, 0x24, 0x04,
11
- ].flatMap((it) => BYTE.map((idx) => ((it >>> (7 - idx)) & 0b1) === 0b1));
12
- exports.NOISE_OFFSETS = [
13
- 0x00, 0x18, 0x30, 0xc4, 0xdc, 0x65, 0xeb, 0x48, 0x60, 0xbd, 0x89, 0x04, 0x0a,
14
- 0xf4, 0x7d, 0x6d, 0x85, 0xb0, 0x8e, 0x95, 0x1f, 0x22, 0x0d, 0xdf, 0x2a, 0x78,
15
- 0xd5, 0x73, 0x1c, 0xb4, 0x40, 0xa1, 0xb9, 0x3c, 0xca, 0x58, 0x92, 0x34, 0xcc,
16
- 0xce, 0xd7, 0x42, 0x90, 0x0f, 0x8b, 0x7f, 0x32, 0xed, 0x5c, 0x9d, 0xc8, 0x99,
17
- 0xad, 0x4e, 0x56, 0xa6, 0xf7, 0x68, 0xb7, 0x25, 0x82, 0x37, 0x3a, 0x51, 0x69,
18
- 0x26, 0x38, 0x52, 0x9e, 0x9a, 0x4f, 0xa7, 0x43, 0x10, 0x80, 0xee, 0x3d, 0x59,
19
- 0x35, 0xcf, 0x79, 0x74, 0xb5, 0xa2, 0xb1, 0x96, 0x23, 0xe0, 0xbe, 0x05, 0xf5,
20
- 0x6e, 0x19, 0xc5, 0x66, 0x49, 0xf0, 0xd1, 0x54, 0xa9, 0x70, 0x4b, 0xa4, 0xe2,
21
- 0xe6, 0xe5, 0xab, 0xe4, 0xd2, 0xaa, 0x4c, 0xe3, 0x06, 0x6f, 0xc6, 0x4a, 0x75,
22
- 0xa3, 0x97, 0xe1,
1
+ //#region src/pic/tools/noise.ts
2
+ const BYTE = Array(8).fill(0).map((_, i) => i);
3
+ const NOISE = [
4
+ 32,
5
+ 148,
6
+ 2,
7
+ 36,
8
+ 144,
9
+ 130,
10
+ 164,
11
+ 162,
12
+ 130,
13
+ 9,
14
+ 10,
15
+ 34,
16
+ 18,
17
+ 16,
18
+ 66,
19
+ 20,
20
+ 145,
21
+ 74,
22
+ 145,
23
+ 17,
24
+ 8,
25
+ 18,
26
+ 37,
27
+ 16,
28
+ 34,
29
+ 168,
30
+ 20,
31
+ 36,
32
+ 0,
33
+ 80,
34
+ 36,
35
+ 4
36
+ ].flatMap((it) => BYTE.map((idx) => (it >>> 7 - idx & 1) === 1));
37
+ const NOISE_OFFSETS = [
38
+ 0,
39
+ 24,
40
+ 48,
41
+ 196,
42
+ 220,
43
+ 101,
44
+ 235,
45
+ 72,
46
+ 96,
47
+ 189,
48
+ 137,
49
+ 4,
50
+ 10,
51
+ 244,
52
+ 125,
53
+ 109,
54
+ 133,
55
+ 176,
56
+ 142,
57
+ 149,
58
+ 31,
59
+ 34,
60
+ 13,
61
+ 223,
62
+ 42,
63
+ 120,
64
+ 213,
65
+ 115,
66
+ 28,
67
+ 180,
68
+ 64,
69
+ 161,
70
+ 185,
71
+ 60,
72
+ 202,
73
+ 88,
74
+ 146,
75
+ 52,
76
+ 204,
77
+ 206,
78
+ 215,
79
+ 66,
80
+ 144,
81
+ 15,
82
+ 139,
83
+ 127,
84
+ 50,
85
+ 237,
86
+ 92,
87
+ 157,
88
+ 200,
89
+ 153,
90
+ 173,
91
+ 78,
92
+ 86,
93
+ 166,
94
+ 247,
95
+ 104,
96
+ 183,
97
+ 37,
98
+ 130,
99
+ 55,
100
+ 58,
101
+ 81,
102
+ 105,
103
+ 38,
104
+ 56,
105
+ 82,
106
+ 158,
107
+ 154,
108
+ 79,
109
+ 167,
110
+ 67,
111
+ 16,
112
+ 128,
113
+ 238,
114
+ 61,
115
+ 89,
116
+ 53,
117
+ 207,
118
+ 121,
119
+ 116,
120
+ 181,
121
+ 162,
122
+ 177,
123
+ 150,
124
+ 35,
125
+ 224,
126
+ 190,
127
+ 5,
128
+ 245,
129
+ 110,
130
+ 25,
131
+ 197,
132
+ 102,
133
+ 73,
134
+ 240,
135
+ 209,
136
+ 84,
137
+ 169,
138
+ 112,
139
+ 75,
140
+ 164,
141
+ 226,
142
+ 230,
143
+ 229,
144
+ 171,
145
+ 228,
146
+ 210,
147
+ 170,
148
+ 76,
149
+ 227,
150
+ 6,
151
+ 111,
152
+ 198,
153
+ 74,
154
+ 117,
155
+ 163,
156
+ 151,
157
+ 225
23
158
  ];
159
+ //#endregion
160
+ export { NOISE, NOISE_OFFSETS };
161
+
24
162
  //# sourceMappingURL=noise.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"noise.js","sourceRoot":"","sources":["../../../src/pic/tools/noise.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;KAClB,IAAI,CAAC,CAAC,CAAC;KACP,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEP,QAAA,KAAK,GAAc;IAC9B,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC5E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC5E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CACnC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAE5D,QAAA,aAAa,GAAa;IACrC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;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AAI,EAAE,IAAI,EAAE,IAAI;IAC5E,IAAI,EAAE,IAAI,EAAE,IAAI;CACjB,CAAC"}
1
+ {"version":3,"file":"noise.js","names":[],"sources":["../../../src/pic/tools/noise.ts"],"sourcesContent":["const BYTE = Array(8)\n .fill(0)\n .map((_, i) => i);\n\nexport const NOISE: boolean[] = [\n 0x20, 0x94, 0x02, 0x24, 0x90, 0x82, 0xa4, 0xa2, 0x82, 0x09, 0x0a, 0x22, 0x12,\n 0x10, 0x42, 0x14, 0x91, 0x4a, 0x91, 0x11, 0x08, 0x12, 0x25, 0x10, 0x22, 0xa8,\n 0x14, 0x24, 0x00, 0x50, 0x24, 0x04,\n].flatMap((it) => BYTE.map((idx) => ((it >>> (7 - idx)) & 0b1) === 0b1));\n\nexport const NOISE_OFFSETS: number[] = [\n 0x00, 0x18, 0x30, 0xc4, 0xdc, 0x65, 0xeb, 0x48, 0x60, 0xbd, 0x89, 0x04, 0x0a,\n 0xf4, 0x7d, 0x6d, 0x85, 0xb0, 0x8e, 0x95, 0x1f, 0x22, 0x0d, 0xdf, 0x2a, 0x78,\n 0xd5, 0x73, 0x1c, 0xb4, 0x40, 0xa1, 0xb9, 0x3c, 0xca, 0x58, 0x92, 0x34, 0xcc,\n 0xce, 0xd7, 0x42, 0x90, 0x0f, 0x8b, 0x7f, 0x32, 0xed, 0x5c, 0x9d, 0xc8, 0x99,\n 0xad, 0x4e, 0x56, 0xa6, 0xf7, 0x68, 0xb7, 0x25, 0x82, 0x37, 0x3a, 0x51, 0x69,\n 0x26, 0x38, 0x52, 0x9e, 0x9a, 0x4f, 0xa7, 0x43, 0x10, 0x80, 0xee, 0x3d, 0x59,\n 0x35, 0xcf, 0x79, 0x74, 0xb5, 0xa2, 0xb1, 0x96, 0x23, 0xe0, 0xbe, 0x05, 0xf5,\n 0x6e, 0x19, 0xc5, 0x66, 0x49, 0xf0, 0xd1, 0x54, 0xa9, 0x70, 0x4b, 0xa4, 0xe2,\n 0xe6, 0xe5, 0xab, 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;CAAM;AACd"}
@@ -1,7 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exhaustive = exhaustive;
1
+ //#region src/utils/exhaustive.ts
4
2
  function exhaustive(msg, _) {
5
- throw new Error(`${msg}: ${JSON.stringify(_)}`);
3
+ throw new Error(`${msg}: ${JSON.stringify(_)}`);
6
4
  }
5
+ //#endregion
6
+ export { exhaustive };
7
+
7
8
  //# sourceMappingURL=exhaustive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exhaustive.js","sourceRoot":"","sources":["../../src/utils/exhaustive.ts"],"names":[],"mappings":";;AAAA,gCAEC;AAFD,SAAgB,UAAU,CAAC,GAAW,EAAE,CAAQ;IAC9C,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"exhaustive.js","names":[],"sources":["../../src/utils/exhaustive.ts"],"sourcesContent":["export function exhaustive(msg: string, _: never): never {\n throw new Error(`${msg}: ${JSON.stringify(_)}`);\n}\n"],"mappings":";AAAA,SAAgB,WAAW,KAAa,GAAiB;CACvD,MAAM,IAAI,MAAM,GAAG,IAAI,IAAI,KAAK,UAAU,CAAC,GAAG;AAChD"}
package/package.json CHANGED
@@ -1,32 +1,33 @@
1
1
  {
2
2
  "name": "@4bitlabs/sci0-renderer",
3
- "version": "0.1.1",
3
+ "version": "1.0.0",
4
4
  "description": "Image processing filters and rendering functions for Sierra On-line SCI0 graphical assets.",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
5
  "homepage": "https://github.com/32bitkid/sci.js/tree/main/libs/sci0#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/32bitkid/sci.js/issues"
8
+ },
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "git+https://github.com/32bitkid/sci.js.git"
11
12
  },
12
- "bugs": {
13
- "url": "https://github.com/32bitkid/sci.js/issues"
14
- },
13
+ "license": "ISC",
14
+ "author": "J. Holmes <j@holmes.codes>",
15
+ "type": "module",
16
+ "exports": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
15
18
  "files": [
16
19
  "./dist/**/*"
17
20
  ],
18
21
  "scripts": {
22
+ "build": "tsdown",
19
23
  "clean": "tsc --build --clean",
20
- "clean:wipe": "rimraf ./dist",
21
- "build": "tsc --build"
24
+ "clean:wipe": "rimraf ./dist"
22
25
  },
23
- "author": "J. Holmes <j@holmes.codes>",
24
- "license": "ISC",
25
26
  "dependencies": {
26
- "@4bitlabs/image": "^4.0.0",
27
- "@4bitlabs/numeric-deque": "^1.1.6",
28
- "@4bitlabs/sci0": "^5.0.1",
29
- "@4bitlabs/vec2": "^2.0.0"
27
+ "@4bitlabs/image": "^5.0.0",
28
+ "@4bitlabs/numeric-deque": "^2.0.0",
29
+ "@4bitlabs/sci0": "^6.0.0",
30
+ "@4bitlabs/vec2": "^3.0.0"
30
31
  },
31
- "gitHead": "022fb2701890f39c8f5dffa2029afc33f109c856"
32
+ "gitHead": "e8b4502e1f5fd42407c8857829e66eb5713a9f84"
32
33
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAAzD,wHAAA,iBAAiB,OAAA;AAE1B,+DAA4D;AAAnD,kHAAA,cAAc,OAAA;AAIvB,+CAA6C;AAApC,uGAAA,SAAS,OAAA;AAClB,mDAAiD;AAAxC,2GAAA,WAAW,OAAA"}
@@ -1,2 +0,0 @@
1
- export declare const DEFAULT_PALETTE: readonly [0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 136, 136, 1, 2, 3, 4, 5, 6, 136, 136, 249, 250, 251, 252, 253, 254, 255, 8, 145, 42, 59, 76, 93, 110, 136];
2
- //# sourceMappingURL=default-palette.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-palette.d.ts","sourceRoot":"","sources":["../../src/pic/default-palette.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe,0LAKlB,CAAC"}
@@ -1,3 +0,0 @@
1
- export type PaletteSet = [Uint8Array, Uint8Array, Uint8Array, Uint8Array];
2
- export declare const defaultPalettes: () => PaletteSet;
3
- //# sourceMappingURL=default-palettes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-palettes.d.ts","sourceRoot":"","sources":["../../src/pic/default-palettes.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE1E,eAAO,MAAM,eAAe,QAAO,UAKlC,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { DrawCommand } from '@4bitlabs/sci0';
2
- import type { Screen } from './tools/screen';
3
- export declare function picStep(cmd: DrawCommand, { fill, line, brush, blit }: Screen, palettes: [Uint8Array, Uint8Array, Uint8Array, Uint8Array]): void;
4
- //# sourceMappingURL=pic-step.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pic-step.d.ts","sourceRoot":"","sources":["../../src/pic/pic-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,wBAAgB,OAAO,CACrB,GAAG,EAAE,WAAW,EAChB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EACnC,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,GACzD,IAAI,CA+CN"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=render-pic-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-pic-options.js","sourceRoot":"","sources":["../../src/pic/render-pic-options.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=render-result.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-result.js","sourceRoot":"","sources":["../../src/pic/render-result.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import type { Vec2 } from '@4bitlabs/vec2';
2
- import { type Screen } from './tools/screen';
3
- import { type RenderResult } from './render-result';
4
- type SetTValueFn = (n: number) => void;
5
- export declare const createScreenBuffer: (forcePal: 0 | 1 | 2 | 3 | undefined, palettes: [Uint8Array, Uint8Array, Uint8Array, Uint8Array], [width, height]: Vec2) => [RenderResult, Screen, SetTValueFn];
6
- export {};
7
- //# sourceMappingURL=screen-buffer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"screen-buffer.d.ts","sourceRoot":"","sources":["../../src/pic/screen-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAIL,KAAK,MAAM,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQpD,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvC,eAAO,MAAM,kBAAkB,aACnB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,YACzB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,mBACzC,IAAI,KACpB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CA0EpC,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const circleBitmaps: number[][];
2
- export default circleBitmaps;
3
- //# sourceMappingURL=circles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"circles.d.ts","sourceRoot":"","sources":["../../../src/pic/tools/circles.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,aAAa,EAAE,MAAM,EAAE,EAoF5B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,5 +0,0 @@
1
- import { type Vec2 } from '@4bitlabs/vec2';
2
- import { DrawMode, Cel } from '@4bitlabs/sci0';
3
- import { RawPlotter } from './screen';
4
- export declare const createBlitter: (plot: RawPlotter, [stageWidth, stageHeight]: Readonly<Vec2>) => (x0: number, y0: number, drawMode: DrawMode, cel: Cel) => void;
5
- //# sourceMappingURL=create-blitter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-blitter.d.ts","sourceRoot":"","sources":["../../../src/pic/tools/create-blitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,aAAa,SACjB,UAAU,6BAA6B,QAAQ,CAAC,IAAI,CAAC,UACvD,MAAM,MAAM,MAAM,YAAY,QAAQ,OAAO,GAAG,KAAG,IAevD,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type Vec2 } from '@4bitlabs/vec2';
2
- import { Brusher, Plotter } from './screen';
3
- export declare const createBrush: (plot: Plotter, [stageWidth, stageHeight]: Readonly<Vec2>) => Brusher;
4
- //# sourceMappingURL=create-brush.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-brush.d.ts","sourceRoot":"","sources":["../../../src/pic/tools/create-brush.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAI5C,eAAO,MAAM,WAAW,SAChB,OAAO,6BACc,QAAQ,CAAC,IAAI,CAAC,KACxC,OAmCA,CAAC"}