@woosh/meep-engine 2.126.75 → 2.127.1

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 (92) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/package.json +1 -1
  3. package/src/core/binary/platform_compute_endianness.d.ts.map +1 -1
  4. package/src/core/binary/platform_compute_endianness.js +5 -1
  5. package/src/core/color/hunt/xyz_to_hpe.d.ts +7 -0
  6. package/src/core/color/hunt/xyz_to_hpe.d.ts.map +1 -0
  7. package/src/core/color/hunt/xyz_to_hpe.js +15 -0
  8. package/src/core/color/xyz/rgb_to_xyz.d.ts +2 -0
  9. package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
  10. package/src/core/color/xyz/rgb_to_xyz.js +2 -0
  11. package/src/core/color/xyz/xyz_to_rgb.d.ts +2 -0
  12. package/src/core/color/xyz/xyz_to_rgb.d.ts.map +1 -1
  13. package/src/core/color/xyz/xyz_to_rgb.js +2 -0
  14. package/src/core/math/idct_1d.d.ts +14 -0
  15. package/src/core/math/idct_1d.d.ts.map +1 -0
  16. package/src/core/math/idct_1d.js +69 -0
  17. package/src/core/math/idct_2d.d.ts +11 -0
  18. package/src/core/math/idct_2d.d.ts.map +1 -0
  19. package/src/core/math/idct_2d.js +22 -0
  20. package/src/core/model/DebouncedObservedBoolean.d.ts +1 -1
  21. package/src/core/model/DebouncedObservedBoolean.d.ts.map +1 -1
  22. package/src/core/model/object/objectKeyByValue.d.ts.map +1 -1
  23. package/src/core/model/object/objectKeyByValue.js +4 -0
  24. package/src/engine/asset/Asset.d.ts.map +1 -1
  25. package/src/engine/asset/Asset.js +2 -5
  26. package/src/engine/asset/AssetTransformer.js +1 -1
  27. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts +20 -1
  28. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts.map +1 -1
  29. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +56 -13
  30. package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts +42 -0
  31. package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts.map +1 -0
  32. package/src/engine/asset/loaders/image/jpeg/JpegFrame.js +45 -0
  33. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts +42 -0
  34. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts.map +1 -0
  35. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.js +48 -0
  36. package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts +60 -0
  37. package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts.map +1 -0
  38. package/src/engine/asset/loaders/image/jpeg/JpegImage.js +624 -0
  39. package/src/engine/asset/loaders/image/jpeg/NOTES.md +3 -0
  40. package/src/engine/asset/loaders/image/jpeg/buildComponentData.d.ts +7 -0
  41. package/src/engine/asset/loaders/image/jpeg/buildComponentData.d.ts.map +1 -0
  42. package/src/engine/asset/loaders/image/jpeg/buildComponentData.js +59 -0
  43. package/src/engine/asset/loaders/image/jpeg/buildHuffmanTable.d.ts +8 -0
  44. package/src/engine/asset/loaders/image/jpeg/buildHuffmanTable.d.ts.map +1 -0
  45. package/src/engine/asset/loaders/image/jpeg/buildHuffmanTable.js +46 -0
  46. package/src/engine/asset/loaders/image/jpeg/decodeScan.d.ts +17 -0
  47. package/src/engine/asset/loaders/image/jpeg/decodeScan.d.ts.map +1 -0
  48. package/src/engine/asset/loaders/image/jpeg/decodeScan.js +351 -0
  49. package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.d.ts +23 -0
  50. package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.d.ts.map +1 -0
  51. package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.js +214 -0
  52. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts +9 -0
  53. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts.map +1 -0
  54. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.js +32 -0
  55. package/src/engine/asset/loaders/image/jpeg/jpeg_decode.d.ts +13 -0
  56. package/src/engine/asset/loaders/image/jpeg/jpeg_decode.d.ts.map +1 -0
  57. package/src/engine/asset/loaders/image/jpeg/jpeg_decode.js +41 -0
  58. package/src/engine/asset/loaders/image/png/PNG.d.ts +18 -11
  59. package/src/engine/asset/loaders/image/png/PNG.d.ts.map +1 -1
  60. package/src/engine/asset/loaders/image/png/PNG.js +17 -22
  61. package/src/engine/asset/loaders/image/png/PNGReader.d.ts +71 -10
  62. package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
  63. package/src/engine/asset/loaders/image/png/PNGReader.js +422 -101
  64. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  65. package/src/engine/ecs/EntityComponentDataset.js +2 -1
  66. package/src/engine/graphics/geometry/AttributeSpec.d.ts.map +1 -1
  67. package/src/engine/graphics/geometry/AttributeSpec.js +2 -1
  68. package/src/engine/graphics/render/frame_graph/RenderGraph.d.ts +50 -7
  69. package/src/engine/graphics/render/frame_graph/RenderGraph.d.ts.map +1 -1
  70. package/src/engine/graphics/render/frame_graph/RenderGraph.js +108 -8
  71. package/src/engine/graphics/render/frame_graph/RenderPassBuilder.d.ts +44 -0
  72. package/src/engine/graphics/render/frame_graph/RenderPassBuilder.d.ts.map +1 -0
  73. package/src/engine/graphics/render/frame_graph/{RenderGraphBuilder.js → RenderPassBuilder.js} +25 -6
  74. package/src/engine/graphics/render/frame_graph/RenderPassNode.d.ts +1 -0
  75. package/src/engine/graphics/render/frame_graph/RenderPassNode.d.ts.map +1 -1
  76. package/src/engine/graphics/render/frame_graph/RenderPassNode.js +1 -0
  77. package/src/engine/graphics/render/frame_graph/ResourceEntry.d.ts +8 -0
  78. package/src/engine/graphics/render/frame_graph/ResourceEntry.d.ts.map +1 -1
  79. package/src/engine/graphics/render/frame_graph/ResourceEntry.js +8 -0
  80. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts.map +1 -1
  81. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +6 -1
  82. package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.d.ts.map +1 -1
  83. package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +7 -2
  84. package/src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.d.ts.map +1 -1
  85. package/src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js +12 -1
  86. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +1 -1
  87. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
  88. package/src/engine/graphics/render/frame_graph/RenderGraphBuilder.d.ts +0 -33
  89. package/src/engine/graphics/render/frame_graph/RenderGraphBuilder.d.ts.map +0 -1
  90. package/src/engine/graphics/render/frame_graph/RenderPass.d.ts +0 -50
  91. package/src/engine/graphics/render/frame_graph/RenderPass.d.ts.map +0 -1
  92. package/src/engine/graphics/render/frame_graph/RenderPass.js +0 -74
@@ -0,0 +1,214 @@
1
+ // IDCT constants (20.12 fixed point format)
2
+ const dctCos1 = 4017; // cos(pi/16)
3
+ const dctSin1 = 799; // sin(pi/16)
4
+ const dctCos3 = 3406; // cos(3*pi/16)
5
+ const dctSin3 = 2276; // sin(3*pi/16)
6
+ const dctCos6 = 1567; // cos(6*pi/16)
7
+ const dctSin6 = 3784; // sin(6*pi/16)
8
+ const dctSqrt2 = 5793; // sqrt(2)
9
+ const dctSqrt1d2 = 2896; // sqrt(2) / 2
10
+
11
+ /**
12
+ * Used internally for transformation
13
+ * @type {Int32Array}
14
+ */
15
+ const p = new Int32Array(64);
16
+
17
+ /**
18
+ * Decode 8x8 block quantized DCT coefficients and inverse DCT transform.
19
+ * This is a fixed-point implementation of the IDCT algorithm.
20
+ *
21
+ * This IDCT algorithm is taken from:
22
+ * Y. A. Reznik, A. T. Hinds, L. Yu, Z. Ni, and C-X. Zhang,
23
+ * "Efficient fixed-point approximations of the 8x8 inverse discrete
24
+ * cosine transform" (invited paper), Proc. SPIE Vol. 6696, Sep. 24, 2007.
25
+ *
26
+ * which is based on:
27
+ * Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz,
28
+ * "Practical Fast 1-D DCT Algorithms with 11 Multiplications",
29
+ * IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989,
30
+ * 988-991.
31
+ *
32
+ * The stage numbers mentioned in the comments refer to Figure 1 in the Loeffler paper.
33
+ *
34
+ * @param {Int32Array} qt quantization table
35
+ * @param {Int32Array} zz zigzag-ordered coefficients
36
+ * @param {Uint8Array|Uint8ClampedArray} dataOut
37
+ */
38
+ export function idct8x8_fixed(
39
+ qt,
40
+ zz,
41
+ dataOut,
42
+ ) {
43
+
44
+ // TODO check https://github.com/ONLYOFFICE/core/blob/f6c835668482d70e59202394434314c8863fc1cf/PdfFile/lib/xpdf/Stream.cc#L3582
45
+
46
+ let v0, v1, v2, v3, v4, v5, v6, v7, t;
47
+ let i;
48
+
49
+ // dequant
50
+ for (i = 0; i < 64; i++) {
51
+ p[i] = zz[i] * qt[i];
52
+ }
53
+
54
+ // inverse DCT on rows
55
+ for (i = 0; i < 8; ++i) {
56
+ const row = 8 * i;
57
+
58
+ // check for all-zero AC coefficients
59
+ if (p[1 + row] === 0
60
+ && p[2 + row] === 0
61
+ && p[3 + row] === 0
62
+ && p[4 + row] === 0
63
+ && p[5 + row] === 0
64
+ && p[6 + row] === 0
65
+ && p[7 + row] === 0
66
+ ) {
67
+
68
+ t = (dctSqrt2 * p[0 + row] + 512) >> 10;
69
+
70
+ p[0 + row] = t;
71
+ p[1 + row] = t;
72
+ p[2 + row] = t;
73
+ p[3 + row] = t;
74
+ p[4 + row] = t;
75
+ p[5 + row] = t;
76
+ p[6 + row] = t;
77
+ p[7 + row] = t;
78
+
79
+ continue;
80
+ }
81
+
82
+ // stage 4
83
+ v0 = (dctSqrt2 * p[0 + row] + 128) >> 8;
84
+ v1 = (dctSqrt2 * p[4 + row] + 128) >> 8;
85
+ v2 = p[2 + row];
86
+ v3 = p[6 + row];
87
+ v4 = (dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128) >> 8;
88
+ v7 = (dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128) >> 8;
89
+ v5 = p[3 + row] << 4;
90
+ v6 = p[5 + row] << 4;
91
+
92
+ // stage 3
93
+ t = (v0 - v1 + 1) >> 1;
94
+ v0 = (v0 + v1 + 1) >> 1;
95
+ v1 = t;
96
+ t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8;
97
+ v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8;
98
+ v3 = t;
99
+ t = (v4 - v6 + 1) >> 1;
100
+ v4 = (v4 + v6 + 1) >> 1;
101
+ v6 = t;
102
+ t = (v7 + v5 + 1) >> 1;
103
+ v5 = (v7 - v5 + 1) >> 1;
104
+ v7 = t;
105
+
106
+ // stage 2
107
+ t = (v0 - v3 + 1) >> 1;
108
+ v0 = (v0 + v3 + 1) >> 1;
109
+ v3 = t;
110
+ t = (v1 - v2 + 1) >> 1;
111
+ v1 = (v1 + v2 + 1) >> 1;
112
+ v2 = t;
113
+ t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
114
+ v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
115
+ v7 = t;
116
+ t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
117
+ v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
118
+ v6 = t;
119
+
120
+ // stage 1
121
+ p[0 + row] = v0 + v7;
122
+ p[7 + row] = v0 - v7;
123
+ p[1 + row] = v1 + v6;
124
+ p[6 + row] = v1 - v6;
125
+ p[2 + row] = v2 + v5;
126
+ p[5 + row] = v2 - v5;
127
+ p[3 + row] = v3 + v4;
128
+ p[4 + row] = v3 - v4;
129
+ }
130
+
131
+ // inverse DCT on columns
132
+ for (i = 0; i < 8; ++i) {
133
+ const col = i;
134
+
135
+ // check for all-zero AC coefficients
136
+ if (p[1 * 8 + col] === 0
137
+ && p[2 * 8 + col] === 0
138
+ && p[3 * 8 + col] === 0
139
+ && p[4 * 8 + col] === 0
140
+ && p[5 * 8 + col] === 0
141
+ && p[6 * 8 + col] === 0
142
+ && p[7 * 8 + col] === 0
143
+ ) {
144
+
145
+ t = (dctSqrt2 * p[i + 0] + 8192) >> 14;
146
+
147
+ p[0 * 8 + col] = t;
148
+ p[1 * 8 + col] = t;
149
+ p[2 * 8 + col] = t;
150
+ p[3 * 8 + col] = t;
151
+ p[4 * 8 + col] = t;
152
+ p[5 * 8 + col] = t;
153
+ p[6 * 8 + col] = t;
154
+ p[7 * 8 + col] = t;
155
+ continue;
156
+ }
157
+
158
+ // stage 4
159
+ v0 = (dctSqrt2 * p[0 * 8 + col] + 2048) >> 12;
160
+ v1 = (dctSqrt2 * p[4 * 8 + col] + 2048) >> 12;
161
+ v2 = p[2 * 8 + col];
162
+ v3 = p[6 * 8 + col];
163
+ v4 = (dctSqrt1d2 * (p[1 * 8 + col] - p[7 * 8 + col]) + 2048) >> 12;
164
+ v7 = (dctSqrt1d2 * (p[1 * 8 + col] + p[7 * 8 + col]) + 2048) >> 12;
165
+ v5 = p[3 * 8 + col];
166
+ v6 = p[5 * 8 + col];
167
+
168
+ // stage 3
169
+ t = (v0 - v1 + 1) >> 1;
170
+ v0 = (v0 + v1 + 1) >> 1;
171
+ v1 = t;
172
+ t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;
173
+ v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12;
174
+ v3 = t;
175
+ t = (v4 - v6 + 1) >> 1;
176
+ v4 = (v4 + v6 + 1) >> 1;
177
+ v6 = t;
178
+ t = (v7 + v5 + 1) >> 1;
179
+ v5 = (v7 - v5 + 1) >> 1;
180
+ v7 = t;
181
+
182
+ // stage 2
183
+ t = (v0 - v3 + 1) >> 1;
184
+ v0 = (v0 + v3 + 1) >> 1;
185
+ v3 = t;
186
+ t = (v1 - v2 + 1) >> 1;
187
+ v1 = (v1 + v2 + 1) >> 1;
188
+ v2 = t;
189
+ t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
190
+ v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
191
+ v7 = t;
192
+ t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
193
+ v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
194
+ v6 = t;
195
+
196
+ // stage 1
197
+ p[0 * 8 + col] = v0 + v7;
198
+ p[7 * 8 + col] = v0 - v7;
199
+ p[1 * 8 + col] = v1 + v6;
200
+ p[6 * 8 + col] = v1 - v6;
201
+ p[2 * 8 + col] = v2 + v5;
202
+ p[5 * 8 + col] = v2 - v5;
203
+ p[3 * 8 + col] = v3 + v4;
204
+ p[4 * 8 + col] = v3 - v4;
205
+ }
206
+
207
+ // convert to 8-bit integers
208
+ for (i = 0; i < 64; ++i) {
209
+ const q = p[i];
210
+
211
+ // clip to 8-bit range
212
+ dataOut[i] = (q <= -2056) ? 0 : (q >= 2024) ? 255 : (q + 2056) >> 4;
213
+ }
214
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An efficient, floating-point quantize and inverse DCT function based on the AAN fast IDCT algorithm.
3
+ * @param {Int32Array} qt quantization table
4
+ * @param {Int32Array} zz zigzag-ordered DCT coefficients
5
+ * @param {Uint8Array|Uint8ClampedArray} output The output array for the 8x8 block.
6
+ * @see idct8x8_fixed
7
+ */
8
+ export function idct8x8_float(qt: Int32Array, zz: Int32Array, output: Uint8Array | Uint8ClampedArray): void;
9
+ //# sourceMappingURL=idct8x8_float.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idct8x8_float.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/jpeg/idct8x8_float.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,kCALW,UAAU,MACV,UAAU,UACV,UAAU,GAAC,iBAAiB,QAuBtC"}
@@ -0,0 +1,32 @@
1
+ import { idct_2d } from "../../../../../core/math/idct_2d.js";
2
+
3
+ const p = new Float64Array(64);
4
+
5
+ /**
6
+ * An efficient, floating-point quantize and inverse DCT function based on the AAN fast IDCT algorithm.
7
+ * @param {Int32Array} qt quantization table
8
+ * @param {Int32Array} zz zigzag-ordered DCT coefficients
9
+ * @param {Uint8Array|Uint8ClampedArray} output The output array for the 8x8 block.
10
+ * @see idct8x8_fixed
11
+ */
12
+ export function idct8x8_float(
13
+ qt,
14
+ zz,
15
+ output
16
+ ) {
17
+
18
+ // 1. Dequantize the coefficients
19
+ for (let i = 0; i < 64; i++) {
20
+ p[i] = (zz[i] * qt[i]);
21
+ }
22
+
23
+ idct_2d(p);
24
+
25
+ // 4. Level-shift, scale, and clip to 8-bit range
26
+ for (let i = 0; i < 64; ++i) {
27
+ const sample = 128 + Math.round(p[i]);
28
+
29
+ // Clip to the valid 8-bit range [0, 255]
30
+ output[i] = sample < 0 ? 0 : sample > 255 ? 255 : sample;
31
+ }
32
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ *
3
+ * @param {ArrayBuffer} jpegData
4
+ * @param [userOpts]
5
+ * @return {{width: number, height: number, exifBuffer: Uint8Array, data: Uint8Array}}
6
+ */
7
+ export function jpeg_decode(jpegData: ArrayBuffer, userOpts?: {}): {
8
+ width: number;
9
+ height: number;
10
+ exifBuffer: Uint8Array;
11
+ data: Uint8Array;
12
+ };
13
+ //# sourceMappingURL=jpeg_decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jpeg_decode.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/jpeg/jpeg_decode.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,sCAJW,WAAW,kBAEV;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAC,CAkCpF"}
@@ -0,0 +1,41 @@
1
+ import { JpegImage } from "./JpegImage.js";
2
+
3
+ /**
4
+ *
5
+ * @param {ArrayBuffer} jpegData
6
+ * @param [userOpts]
7
+ * @return {{width: number, height: number, exifBuffer: Uint8Array, data: Uint8Array}}
8
+ */
9
+ export function jpeg_decode(jpegData, userOpts = {}) {
10
+ const defaultOpts = {
11
+ // "undefined" means "Choose whether to transform colors based on the image’s color model."
12
+ colorTransform: undefined,
13
+ tolerantDecoding: true,
14
+ };
15
+
16
+ const opts = { ...defaultOpts, ...userOpts };
17
+ const arr = new Uint8Array(jpegData);
18
+ const decoder = new JpegImage();
19
+ decoder.opts = opts;
20
+ // If this constructor ever supports async decoding this will need to be done differently.
21
+ // Until then, treating as singleton limit is fine.
22
+ decoder.parse(arr);
23
+
24
+ const channels = 3;
25
+ const bytesNeeded = decoder.width * decoder.height * channels;
26
+
27
+ const image = {
28
+ width: decoder.width,
29
+ height: decoder.height,
30
+ exifBuffer: decoder.exifBuffer,
31
+ data: new Uint8Array(bytesNeeded)
32
+ };
33
+
34
+ if (decoder.comments.length > 0) {
35
+ image["comments"] = decoder.comments;
36
+ }
37
+
38
+ decoder.copyToImageData(image, false);
39
+
40
+ return image;
41
+ }
@@ -25,8 +25,11 @@ export class PNG {
25
25
  */
26
26
  colors: number;
27
27
  alpha: boolean;
28
- pixelBits: number;
29
- palette: any;
28
+ /**
29
+ *
30
+ * @type {Uint8Array|null}
31
+ */
32
+ palette: Uint8Array | null;
30
33
  /**
31
34
  *
32
35
  * @type {Uint8Array|null}
@@ -36,7 +39,7 @@ export class PNG {
36
39
  * Transparency palette
37
40
  * @type {Uint8Array|null}
38
41
  */
39
- trns: Uint8Array | null;
42
+ transparency_lookup: Uint8Array | null;
40
43
  /**
41
44
  * Text metadata coming from tEXt chunks
42
45
  * @type {Object<string>}
@@ -50,19 +53,23 @@ export class PNG {
50
53
  setBitDepth(bitDepth: any): void;
51
54
  getColorType(): number;
52
55
  setColorType(colorType: any): void;
53
- getCompressionMethod(): number;
54
- setCompressionMethod(compressionMethod: any): void;
55
- getFilterMethod(): number;
56
- setFilterMethod(filterMethod: any): void;
56
+ /**
57
+ *
58
+ * @param {number} compressionMethod
59
+ */
60
+ setCompressionMethod(compressionMethod: number): void;
61
+ /**
62
+ *
63
+ * @param {number} filterMethod
64
+ */
65
+ setFilterMethod(filterMethod: number): void;
57
66
  getInterlaceMethod(): number;
58
67
  setInterlaceMethod(interlaceMethod: any): void;
59
68
  /**
60
69
  *
61
- * @param {Uint8Array} trns
70
+ * @param {Uint8Array} palette
62
71
  */
63
- setTRNS(trns: Uint8Array): void;
64
- setPalette(palette: any): void;
65
- getPalette(): any;
72
+ setPalette(palette: Uint8Array): void;
66
73
  /**
67
74
  * get the pixel color on a certain location in a normalized way
68
75
  * result is an array: [red, green, blue, alpha]
@@ -1 +1 @@
1
- {"version":3,"file":"PNG.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/png/PNG.js"],"names":[],"mappings":"AAAA;IAEI;;;OAGG;IACH,OAFU,MAAM,CAEN;IACV;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,UAFU,MAAM,CAEH;IAEb,kBAAc;IACd,0BAAsB;IACtB,qBAAiB;IACjB,wBAAoB;IAEpB;;;;OAIG;IACH,QAFU,MAAM,CAEL;IACX,eAAc;IACd,kBAAc;IAEd,aAAe;IAEf;;;OAGG;IACH,QAFU,UAAU,GAAC,IAAI,CAEX;IAEd;;;OAGG;IACH,MAFU,UAAU,GAAC,IAAI,CAEb;IAGZ;;;OAGG;IACH,UAAU;IAGV,mBAEC;IAED,2BAEC;IAED,oBAEC;IAED,6BAEC;IAED,sBAEC;IAED,iCAKC;IAED,uBAEC;IAED,mCA6CC;IAED,+BAEC;IAED,mDAKC;IAED,0BAEC;IAED,yCAKC;IAED,6BAEC;IAED,+CAKC;IAED;;;OAGG;IACH,cAFW,UAAU,QAIpB;IAED,+BAQC;IAED,kBAEC;IAED;;;OAGG;IACH,gEA+DC;IAED;;;OAGG;IACH,mCAFW,UAAU,QAqBpB;IAED;;;OAGG;IACH,mCAFW,UAAU,QAiBpB;IAED;;;OAGG;IACH,4BAoBC;IAED;;;MA4DC;IAED;;OAEG;IACH;kBAFuB,MAAM;cAAO,UAAU;kBAAY,MAAM;MA0C/D;CACJ"}
1
+ {"version":3,"file":"PNG.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/png/PNG.js"],"names":[],"mappings":"AAAA;IAEI;;;OAGG;IACH,OAFU,MAAM,CAEN;IACV;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,UAFU,MAAM,CAEH;IAEb,kBAAc;IACd,0BAAsB;IACtB,qBAAiB;IACjB,wBAAoB;IAEpB;;;;OAIG;IACH,QAFU,MAAM,CAEL;IACX,eAAc;IAEd;;;OAGG;IACH,SAFU,UAAU,GAAC,IAAI,CAEV;IAEf;;;OAGG;IACH,QAFU,UAAU,GAAC,IAAI,CAEX;IAEd;;;OAGG;IACH,qBAFU,UAAU,GAAC,IAAI,CAEE;IAG3B;;;OAGG;IACH,UAAU;IAGV,mBAEC;IAED,2BAEC;IAED,oBAEC;IAED,6BAEC;IAED,sBAEC;IAED,iCAKC;IAED,uBAEC;IAED,mCA6CC;IAED;;;OAGG;IACH,wCAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,8BAFW,MAAM,QAOhB;IAED,6BAEC;IAED,+CAKC;IAED;;;OAGG;IACH,oBAFW,UAAU,QAUpB;IAED;;;OAGG;IACH,gEA+DC;IAED;;;OAGG;IACH,mCAFW,UAAU,QAqBpB;IAED;;;OAGG;IACH,mCAFW,UAAU,QAiBpB;IAED;;;OAGG;IACH,4BAoBC;IAED;;;MA4DC;IAED;;OAEG;IACH;kBAFuB,MAAM;cAAO,UAAU;kBAAY,MAAM;MA0C/D;CACJ"}
@@ -29,8 +29,11 @@ export class PNG {
29
29
  */
30
30
  colors = 0;
31
31
  alpha = false;
32
- pixelBits = 0;
33
32
 
33
+ /**
34
+ *
35
+ * @type {Uint8Array|null}
36
+ */
34
37
  palette = null;
35
38
 
36
39
  /**
@@ -43,7 +46,7 @@ export class PNG {
43
46
  * Transparency palette
44
47
  * @type {Uint8Array|null}
45
48
  */
46
- trns = null;
49
+ transparency_lookup = null;
47
50
 
48
51
 
49
52
  /**
@@ -131,10 +134,10 @@ export class PNG {
131
134
  this.colorType = colorType;
132
135
  }
133
136
 
134
- getCompressionMethod() {
135
- return this.compressionMethod;
136
- }
137
-
137
+ /**
138
+ *
139
+ * @param {number} compressionMethod
140
+ */
138
141
  setCompressionMethod(compressionMethod) {
139
142
  if (compressionMethod !== 0) {
140
143
  throw new Error("invalid compression method " + compressionMethod);
@@ -142,10 +145,10 @@ export class PNG {
142
145
  this.compressionMethod = compressionMethod;
143
146
  }
144
147
 
145
- getFilterMethod() {
146
- return this.filterMethod;
147
- }
148
-
148
+ /**
149
+ *
150
+ * @param {number} filterMethod
151
+ */
149
152
  setFilterMethod(filterMethod) {
150
153
  if (filterMethod !== 0) {
151
154
  throw new Error("invalid filter method " + filterMethod);
@@ -166,12 +169,8 @@ export class PNG {
166
169
 
167
170
  /**
168
171
  *
169
- * @param {Uint8Array} trns
172
+ * @param {Uint8Array} palette
170
173
  */
171
- setTRNS(trns) {
172
- this.trns = trns;
173
- }
174
-
175
174
  setPalette(palette) {
176
175
  if (palette.length % 3 !== 0) {
177
176
  throw new Error("incorrect PLTE chunk length");
@@ -182,10 +181,6 @@ export class PNG {
182
181
  this.palette = palette;
183
182
  }
184
183
 
185
- getPalette() {
186
- return this.palette;
187
- }
188
-
189
184
  /**
190
185
  * get the pixel color on a certain location in a normalized way
191
186
  * result is an array: [red, green, blue, alpha]
@@ -221,8 +216,8 @@ export class PNG {
221
216
  case 3:
222
217
  a = 255;
223
218
 
224
- if (this.trns != null) {
225
- a = this.trns[pixels[i]];
219
+ if (this.transparency_lookup != null) {
220
+ a = this.transparency_lookup[pixels[i]];
226
221
  }
227
222
 
228
223
  const offset = pixels[i] * 3;
@@ -335,7 +330,7 @@ export class PNG {
335
330
 
336
331
  let itemSize;
337
332
 
338
- const transparency_lookup = this.trns;
333
+ const transparency_lookup = this.transparency_lookup;
339
334
  if (transparency_lookup !== null) {
340
335
  // has transparency
341
336
  itemSize = 4;
@@ -26,7 +26,11 @@ export class PNGReader {
26
26
  * @type {PNG}
27
27
  */
28
28
  png: PNG;
29
- dataChunks: any[];
29
+ /**
30
+ *
31
+ * @type {Uint8Array[]}
32
+ */
33
+ dataChunks: Uint8Array[];
30
34
  /**
31
35
  *
32
36
  * @type {BinaryBuffer}
@@ -120,8 +124,9 @@ export class PNGReader {
120
124
  /**
121
125
  *
122
126
  * http://www.w3.org/TR/PNG/#11PLTE
127
+ * @param {Uint8Array} chunk
123
128
  */
124
- decodePLTE(chunk: any): void;
129
+ decodePLTE(chunk: Uint8Array): void;
125
130
  /**
126
131
  * http://www.w3.org/TR/2003/REC-PNG-20031110/#11IDAT
127
132
  */
@@ -142,36 +147,84 @@ export class PNGReader {
142
147
  /**
143
148
  * @param {Uint8Array} data
144
149
  */
145
- interlaceNone(data: Uint8Array): void;
150
+ interlaceNone(data: Uint8Array): Uint8Array;
146
151
  /**
147
152
  * De-interlace image according to Adam 7 scheme
148
153
  * @param {Uint8Array} data
149
154
  */
150
- interlaceAdam7(data: Uint8Array): never;
155
+ interlaceAdam7(data: Uint8Array): Uint8Array | Uint16Array;
156
+ /**
157
+ *
158
+ * @param {number} filter_type
159
+ * @param {Uint8Array} data
160
+ * @param {number} scanline_address
161
+ * @param {Uint8Array} output
162
+ * @param {number} bytes_per_pixel
163
+ * @param {number} output_offset
164
+ * @param {number} output_offset_previous where does result of previous scanline begin in the output? Needed for various filters such as `Up`
165
+ * @param {number} length
166
+ */
167
+ unFilter(filter_type: number, data: Uint8Array, scanline_address: number, output: Uint8Array, bytes_per_pixel: number, output_offset: number, output_offset_previous: number, length: number): void;
168
+ /**
169
+ *
170
+ * @param {Uint8Array} data
171
+ * @param {number} scanline_address
172
+ * @param {Uint8Array} output
173
+ * @param {number} bytes_per_pixel
174
+ * @param {number} output_offset
175
+ * @param {number} output_offset_previous
176
+ * @param {number} length
177
+ */
178
+ unFilterNone(data: Uint8Array, scanline_address: number, output: Uint8Array, bytes_per_pixel: number, output_offset: number, output_offset_previous: number, length: number): void;
151
179
  /**
152
180
  * The Sub() filter transmits the difference between each byte and the value
153
181
  * of the corresponding byte of the prior pixel.
154
182
  * Sub(x) = Raw(x) + Raw(x - bpp)
183
+ *
184
+ * @param {Uint8Array} scanline raw data
185
+ * @param {number} scanline_offset
186
+ * @param {Uint8Array} pixels processed output
187
+ * @param {number} bpp bytes-per-pixel
188
+ * @param {number} offset
189
+ * @param {number} output_offset_previous
190
+ * @param {number} length
155
191
  */
156
- unFilterSub(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void;
192
+ unFilterSub(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): void;
157
193
  /**
158
194
  * The Up() filter is just like the Sub() filter except that the pixel
159
195
  * immediately above the current pixel, rather than just to its left, is used
160
196
  * as the predictor.
161
197
  * Up(x) = Raw(x) + Prior(x)
198
+ *
199
+ * @param {Uint8Array} scanline raw data
200
+ * @param {number} scanline_offset
201
+ * @param {Uint8Array} pixels processed output
202
+ * @param {number} bpp bytes-per-pixel
203
+ * @param {number} offset
204
+ * @param {number} output_offset_previous
205
+ * @param {number} length
162
206
  */
163
- unFilterUp(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void;
207
+ unFilterUp(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): void;
164
208
  /**
165
209
  * The Average() filter uses the average of the two neighboring pixels (left
166
210
  * and above) to predict the value of a pixel.
167
211
  * Average(x) = Raw(x) + floor((Raw(x-bpp)+Prior(x))/2)
212
+ *
213
+ * @param {Uint8Array} scanline raw data
214
+ * @param {number} scanline_offset
215
+ * @param {Uint8Array} pixels processed output
216
+ * @param {number} bpp bytes-per-pixel
217
+ * @param {number} offset
218
+ * @param {number} output_offset_previous
219
+ * @param {number} length
168
220
  */
169
- unFilterAverage(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void;
221
+ unFilterAverage(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): void;
170
222
  /**
171
223
  * The Paeth() filter computes a simple linear function of the three
172
224
  * neighboring pixels (left, above, upper left), then chooses as predictor
173
- * the neighboring pixel closest to the computed value. This technique is due
174
- * to Alan W. Paeth.
225
+ * the neighboring pixel closest to the computed value.
226
+ * This technique is due to Alan W. Paeth.
227
+ *
175
228
  * Paeth(x) = Raw(x) +
176
229
  * PaethPredictor(Raw(x-bpp), Prior(x), Prior(x-bpp))
177
230
  * function PaethPredictor (a, b, c)
@@ -187,8 +240,16 @@ export class PNGReader {
187
240
  * else if pb <= pc then return b
188
241
  * else return c
189
242
  * end
243
+ *
244
+ * @param {Uint8Array} scanline raw data
245
+ * @param {number} scanline_offset
246
+ * @param {Uint8Array} pixels processed output
247
+ * @param {number} bpp bytes-per-pixel
248
+ * @param {number} offset
249
+ * @param {number} output_offset_previous
250
+ * @param {number} length
190
251
  */
191
- unFilterPaeth(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void;
252
+ unFilterPaeth(scanline: Uint8Array, scanline_offset: number, pixels: Uint8Array, bpp: number, offset: number, output_offset_previous: number, length: number): void;
192
253
  /**
193
254
  * Parse the PNG file
194
255
  * @returns {PNG}
@@ -1 +1 @@
1
- {"version":3,"file":"PNGReader.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/png/PNGReader.js"],"names":[],"mappings":"AAuDA;;;;GAIG;AACH,iCAHW,WAAW,QA8CrB;;IAhDD;;;;OAIG;IACH,mBAHW,WAAW,EA8CrB;IA1CG;;;OAGG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,OAFU,UAAU,CAEc;IAElC;;;OAGG;IACH,KAFU,GAAG,CAEO;IAEpB,kBAAoB;IAEpB;;;OAGG;IACH,QAFU,YAAY,CAEU;IAOhC;;;OAGG;IACH,aAFU,OAAO,CAEO;IAExB;;;OAGG;IACH,QAFU,UAAU,CAEW;IAGnC;;;;OAIG;IACH,kBAHW,MAAM,GACL,UAAU,CAQrB;IAED;;OAEG;IACH,qBAkBC;IAED;;;;;;;;;OASG;IACH,eAFa,MAAM,CA4ElB;IAGD;;;OAGG;IACH,kBAFW,UAAU,QAOpB;IAED;;;OAGG;IACH,kBAFW,UAAU,QAapB;IAED;;;;OAIG;IACH,kBAFW,UAAU;;;;;MAiCpB;IAGD;;;;OAIG;IACH,kBAFW,UAAU;;;MA6BpB;IAED;;;OAGG;IACH,kBAFW,UAAU,QASpB;IACD;;;;OAIG;IACH,kBAFW,UAAU,QAqBpB;IAED;;;;;;;;;;;OAWG;IACH,6BAWC;IAED;;;OAGG;IACH,6BAEC;IAED;;OAEG;IACH,6BAGC;IAED;;;OAGG;IACH,kBAFW,UAAU,QAIpB;IAED;;OAEG;IACH,mBACC;IAED;;OAEG;IACH,qBAwBC;IAID;;OAEG;IACH,oBAFW,UAAU,QAyFpB;IAED;;;OAGG;IACH,qBAFW,UAAU,SAIpB;IAKD;;;;OAIG;IACH,oGAYC;IAED;;;;;OAKG;IACH,mGAYC;IAED;;;;OAIG;IACH,wGA+BC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,sGA8CC;IAED;;;OAGG;IACH,SAFa,GAAG,CAqBf;;oBA5sBmB,UAAU;6BALD,4CAA4C"}
1
+ {"version":3,"file":"PNGReader.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/png/PNGReader.js"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,iCAHW,WAAW,QAkDrB;;IApDD;;;;OAIG;IACH,mBAHW,WAAW,EAkDrB;IA9CG;;;OAGG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,OAFU,UAAU,CAEc;IAElC;;;OAGG;IACH,KAFU,GAAG,CAEO;IAEpB;;;OAGG;IACH,YAFU,UAAU,EAAE,CAEF;IAEpB;;;OAGG;IACH,QAFU,YAAY,CAEU;IAOhC;;;OAGG;IACH,aAFU,OAAO,CAEO;IAExB;;;OAGG;IACH,QAFU,UAAU,CAEW;IAGnC;;;;OAIG;IACH,kBAHW,MAAM,GACL,UAAU,CAarB;IAED;;OAEG;IACH,qBAkBC;IAED;;;;;;;;;OASG;IACH,eAFa,MAAM,CA4ElB;IAGD;;;OAGG;IACH,kBAFW,UAAU,QAOpB;IAED;;;OAGG;IACH,kBAFW,UAAU,QAapB;IAED;;;;OAIG;IACH,kBAFW,UAAU;;;;;MAuCpB;IAGD;;;;OAIG;IACH,kBAFW,UAAU;;;MAiCpB;IAED;;;OAGG;IACH,kBAFW,UAAU,QASpB;IACD;;;;OAIG;IACH,kBAFW,UAAU,QAwBpB;IAED;;;;;;;;;;;OAWG;IACH,6BAWC;IAED;;;;OAIG;IACH,kBAFW,UAAU,QAIpB;IAED;;OAEG;IACH,6BAGC;IAED;;;OAGG;IACH,kBAFW,UAAU,QAIpB;IAED;;OAEG;IACH,mBACC;IAED;;OAEG;IACH,qBAyBC;IAID;;OAEG;IACH,oBAFW,UAAU,cA+CpB;IAGD;;;OAGG;IACH,qBAFW,UAAU,4BA8GpB;IAID;;;;;;;;;;OAUG;IACH,sBATW,MAAM,QACN,UAAU,oBACV,MAAM,UACN,UAAU,mBACV,MAAM,iBACN,MAAM,0BACN,MAAM,UACN,MAAM,QA6EhB;IAED;;;;;;;;;OASG;IACH,mBARW,UAAU,oBACV,MAAM,UACN,UAAU,mBACV,MAAM,iBACN,MAAM,0BACN,MAAM,UACN,MAAM,QA+ChB;IAED;;;;;;;;;;;;OAYG;IACH,sBARW,UAAU,mBACV,MAAM,UACN,UAAU,OACV,MAAM,UACN,MAAM,0BACN,MAAM,UACN,MAAM,QAwBhB;IAED;;;;;;;;;;;;;OAaG;IACH,qBARW,UAAU,mBACV,MAAM,UACN,UAAU,OACV,MAAM,UACN,MAAM,0BACN,MAAM,UACN,MAAM,QAkChB;IAED;;;;;;;;;;;;OAYG;IACH,0BARW,UAAU,mBACV,MAAM,UACN,UAAU,OACV,MAAM,UACN,MAAM,0BACN,MAAM,UACN,MAAM,QA4ChB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,wBARW,UAAU,mBACV,MAAM,UACN,UAAU,OACV,MAAM,UACN,MAAM,0BACN,MAAM,UACN,MAAM,QA4DhB;IAED;;;OAGG;IACH,SAFa,GAAG,CAqBf;;oBA3gCmB,UAAU;6BAND,4CAA4C"}