@flighthq/bitmap-wasm 0.4.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.
- package/LICENSE.md +9 -0
- package/README.md +43 -0
- package/dist/bitmapWasm.d.ts +41 -0
- package/dist/bitmapWasm.d.ts.map +1 -0
- package/dist/bitmapWasm.js +204 -0
- package/dist/bitmapWasm.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/wasm/bitmapWasmBytes.d.ts +2 -0
- package/dist/wasm/bitmapWasmBytes.d.ts.map +1 -0
- package/dist/wasm/bitmapWasmBytes.js +15 -0
- package/dist/wasm/bitmapWasmBytes.js.map +1 -0
- package/dist/wasm/bitmap_wasm.d.ts +136 -0
- package/dist/wasm/bitmap_wasm.js +760 -0
- package/package.json +56 -0
- package/src/bitmapWasm.test.ts +210 -0
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
/* @ts-self-types="./bitmap_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {Uint8Array} dest_data
|
|
5
|
+
* @param {Float64Array} dest_descriptor
|
|
6
|
+
* @param {Uint8Array} source_data
|
|
7
|
+
* @param {Float64Array} source_descriptor
|
|
8
|
+
* @param {Uint8Array} red_lut
|
|
9
|
+
* @param {Uint8Array} green_lut
|
|
10
|
+
* @param {Uint8Array} blue_lut
|
|
11
|
+
* @param {Uint8Array} alpha_lut
|
|
12
|
+
*/
|
|
13
|
+
export function apply_bitmap_curve_wasm(dest_data, dest_descriptor, source_data, source_descriptor, red_lut, green_lut, blue_lut, alpha_lut) {
|
|
14
|
+
var ptr0 = passArray8ToWasm0(dest_data, wasm.__wbindgen_malloc);
|
|
15
|
+
var len0 = WASM_VECTOR_LEN;
|
|
16
|
+
const ptr1 = passArrayF64ToWasm0(dest_descriptor, wasm.__wbindgen_malloc);
|
|
17
|
+
const len1 = WASM_VECTOR_LEN;
|
|
18
|
+
const ptr2 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
19
|
+
const len2 = WASM_VECTOR_LEN;
|
|
20
|
+
const ptr3 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
21
|
+
const len3 = WASM_VECTOR_LEN;
|
|
22
|
+
const ptr4 = passArray8ToWasm0(red_lut, wasm.__wbindgen_malloc);
|
|
23
|
+
const len4 = WASM_VECTOR_LEN;
|
|
24
|
+
const ptr5 = passArray8ToWasm0(green_lut, wasm.__wbindgen_malloc);
|
|
25
|
+
const len5 = WASM_VECTOR_LEN;
|
|
26
|
+
const ptr6 = passArray8ToWasm0(blue_lut, wasm.__wbindgen_malloc);
|
|
27
|
+
const len6 = WASM_VECTOR_LEN;
|
|
28
|
+
const ptr7 = passArray8ToWasm0(alpha_lut, wasm.__wbindgen_malloc);
|
|
29
|
+
const len7 = WASM_VECTOR_LEN;
|
|
30
|
+
wasm.apply_bitmap_curve_wasm(ptr0, len0, dest_data, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Uint8Array} dest_data
|
|
35
|
+
* @param {Float64Array} dest_descriptor
|
|
36
|
+
* @param {Uint8Array} source_data
|
|
37
|
+
* @param {Float64Array} source_descriptor
|
|
38
|
+
* @param {number} black_point
|
|
39
|
+
* @param {number} white_point
|
|
40
|
+
* @param {number} gamma
|
|
41
|
+
*/
|
|
42
|
+
export function apply_bitmap_levels_wasm(dest_data, dest_descriptor, source_data, source_descriptor, black_point, white_point, gamma) {
|
|
43
|
+
var ptr0 = passArray8ToWasm0(dest_data, wasm.__wbindgen_malloc);
|
|
44
|
+
var len0 = WASM_VECTOR_LEN;
|
|
45
|
+
const ptr1 = passArrayF64ToWasm0(dest_descriptor, wasm.__wbindgen_malloc);
|
|
46
|
+
const len1 = WASM_VECTOR_LEN;
|
|
47
|
+
const ptr2 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
48
|
+
const len2 = WASM_VECTOR_LEN;
|
|
49
|
+
const ptr3 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
50
|
+
const len3 = WASM_VECTOR_LEN;
|
|
51
|
+
wasm.apply_bitmap_levels_wasm(ptr0, len0, dest_data, ptr1, len1, ptr2, len2, ptr3, len3, black_point, white_point, gamma);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {Uint8Array} dest_data
|
|
56
|
+
* @param {Float64Array} dest_descriptor
|
|
57
|
+
* @param {Uint8Array} source_data
|
|
58
|
+
* @param {Float64Array} source_descriptor
|
|
59
|
+
* @param {Float64Array} red_map
|
|
60
|
+
* @param {Float64Array} green_map
|
|
61
|
+
* @param {Float64Array} blue_map
|
|
62
|
+
* @param {Float64Array} alpha_map
|
|
63
|
+
*/
|
|
64
|
+
export function apply_bitmap_palette_map_wasm(dest_data, dest_descriptor, source_data, source_descriptor, red_map, green_map, blue_map, alpha_map) {
|
|
65
|
+
var ptr0 = passArray8ToWasm0(dest_data, wasm.__wbindgen_malloc);
|
|
66
|
+
var len0 = WASM_VECTOR_LEN;
|
|
67
|
+
const ptr1 = passArrayF64ToWasm0(dest_descriptor, wasm.__wbindgen_malloc);
|
|
68
|
+
const len1 = WASM_VECTOR_LEN;
|
|
69
|
+
const ptr2 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
70
|
+
const len2 = WASM_VECTOR_LEN;
|
|
71
|
+
const ptr3 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
72
|
+
const len3 = WASM_VECTOR_LEN;
|
|
73
|
+
const ptr4 = passArrayF64ToWasm0(red_map, wasm.__wbindgen_malloc);
|
|
74
|
+
const len4 = WASM_VECTOR_LEN;
|
|
75
|
+
const ptr5 = passArrayF64ToWasm0(green_map, wasm.__wbindgen_malloc);
|
|
76
|
+
const len5 = WASM_VECTOR_LEN;
|
|
77
|
+
const ptr6 = passArrayF64ToWasm0(blue_map, wasm.__wbindgen_malloc);
|
|
78
|
+
const len6 = WASM_VECTOR_LEN;
|
|
79
|
+
const ptr7 = passArrayF64ToWasm0(alpha_map, wasm.__wbindgen_malloc);
|
|
80
|
+
const len7 = WASM_VECTOR_LEN;
|
|
81
|
+
wasm.apply_bitmap_palette_map_wasm(ptr0, len0, dest_data, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param {Float64Array} out
|
|
86
|
+
* @param {number} amount
|
|
87
|
+
*/
|
|
88
|
+
export function build_bitmap_brightness_color_matrix_wasm(out, amount) {
|
|
89
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
90
|
+
var len0 = WASM_VECTOR_LEN;
|
|
91
|
+
wasm.build_bitmap_brightness_color_matrix_wasm(ptr0, len0, out, amount);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @param {Float64Array} out
|
|
96
|
+
* @param {number} amount
|
|
97
|
+
*/
|
|
98
|
+
export function build_bitmap_contrast_color_matrix_wasm(out, amount) {
|
|
99
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
100
|
+
var len0 = WASM_VECTOR_LEN;
|
|
101
|
+
wasm.build_bitmap_contrast_color_matrix_wasm(ptr0, len0, out, amount);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {Float64Array} out
|
|
106
|
+
*/
|
|
107
|
+
export function build_bitmap_grayscale_color_matrix_wasm(out) {
|
|
108
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
109
|
+
var len0 = WASM_VECTOR_LEN;
|
|
110
|
+
wasm.build_bitmap_grayscale_color_matrix_wasm(ptr0, len0, out);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @param {Float64Array} out
|
|
115
|
+
* @param {number} degrees
|
|
116
|
+
*/
|
|
117
|
+
export function build_bitmap_hue_rotation_color_matrix_wasm(out, degrees) {
|
|
118
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
119
|
+
var len0 = WASM_VECTOR_LEN;
|
|
120
|
+
wasm.build_bitmap_hue_rotation_color_matrix_wasm(ptr0, len0, out, degrees);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {Float64Array} out
|
|
125
|
+
*/
|
|
126
|
+
export function build_bitmap_invert_color_matrix_wasm(out) {
|
|
127
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
128
|
+
var len0 = WASM_VECTOR_LEN;
|
|
129
|
+
wasm.build_bitmap_invert_color_matrix_wasm(ptr0, len0, out);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {Float64Array} out
|
|
134
|
+
* @param {number} amount
|
|
135
|
+
*/
|
|
136
|
+
export function build_bitmap_saturation_color_matrix_wasm(out, amount) {
|
|
137
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
138
|
+
var len0 = WASM_VECTOR_LEN;
|
|
139
|
+
wasm.build_bitmap_saturation_color_matrix_wasm(ptr0, len0, out, amount);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {Float64Array} out
|
|
144
|
+
*/
|
|
145
|
+
export function build_bitmap_sepia_color_matrix_wasm(out) {
|
|
146
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
147
|
+
var len0 = WASM_VECTOR_LEN;
|
|
148
|
+
wasm.build_bitmap_sepia_color_matrix_wasm(ptr0, len0, out);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {Uint8Array} out
|
|
153
|
+
* @param {Uint8Array} source_data
|
|
154
|
+
* @param {Float64Array} source_descriptor
|
|
155
|
+
* @param {Float64Array} matrix
|
|
156
|
+
*/
|
|
157
|
+
export function color_matrix_bitmap_wasm(out, source_data, source_descriptor, matrix) {
|
|
158
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
159
|
+
var len0 = WASM_VECTOR_LEN;
|
|
160
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
161
|
+
const len1 = WASM_VECTOR_LEN;
|
|
162
|
+
const ptr2 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
163
|
+
const len2 = WASM_VECTOR_LEN;
|
|
164
|
+
const ptr3 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
165
|
+
const len3 = WASM_VECTOR_LEN;
|
|
166
|
+
wasm.color_matrix_bitmap_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @param {Uint8Array} first_cells
|
|
171
|
+
* @param {number} first_grid_size
|
|
172
|
+
* @param {Uint8Array} second_cells
|
|
173
|
+
* @param {number} second_grid_size
|
|
174
|
+
* @returns {number}
|
|
175
|
+
*/
|
|
176
|
+
export function compare_bitmap_fingerprints_wasm(first_cells, first_grid_size, second_cells, second_grid_size) {
|
|
177
|
+
const ptr0 = passArray8ToWasm0(first_cells, wasm.__wbindgen_malloc);
|
|
178
|
+
const len0 = WASM_VECTOR_LEN;
|
|
179
|
+
const ptr1 = passArray8ToWasm0(second_cells, wasm.__wbindgen_malloc);
|
|
180
|
+
const len1 = WASM_VECTOR_LEN;
|
|
181
|
+
const ret = wasm.compare_bitmap_fingerprints_wasm(ptr0, len0, first_grid_size, ptr1, len1, second_grid_size);
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {Float64Array} out
|
|
187
|
+
* @param {Float64Array} first
|
|
188
|
+
* @param {Float64Array} second
|
|
189
|
+
*/
|
|
190
|
+
export function concat_bitmap_color_matrix_wasm(out, first, second) {
|
|
191
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
192
|
+
var len0 = WASM_VECTOR_LEN;
|
|
193
|
+
const ptr1 = passArrayF64ToWasm0(first, wasm.__wbindgen_malloc);
|
|
194
|
+
const len1 = WASM_VECTOR_LEN;
|
|
195
|
+
const ptr2 = passArrayF64ToWasm0(second, wasm.__wbindgen_malloc);
|
|
196
|
+
const len2 = WASM_VECTOR_LEN;
|
|
197
|
+
wasm.concat_bitmap_color_matrix_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @param {Uint8Array} out
|
|
202
|
+
* @param {Uint8Array} source_data
|
|
203
|
+
* @param {Float64Array} source_descriptor
|
|
204
|
+
* @param {Float64Array} matrix
|
|
205
|
+
* @param {number} matrix_x
|
|
206
|
+
* @param {number} matrix_y
|
|
207
|
+
* @param {number} bias
|
|
208
|
+
* @param {string} edge
|
|
209
|
+
* @param {number} divisor
|
|
210
|
+
* @param {boolean} preserve_alpha
|
|
211
|
+
*/
|
|
212
|
+
export function convolve_bitmap_wasm(out, source_data, source_descriptor, matrix, matrix_x, matrix_y, bias, edge, divisor, preserve_alpha) {
|
|
213
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
214
|
+
var len0 = WASM_VECTOR_LEN;
|
|
215
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
216
|
+
const len1 = WASM_VECTOR_LEN;
|
|
217
|
+
const ptr2 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
218
|
+
const len2 = WASM_VECTOR_LEN;
|
|
219
|
+
const ptr3 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
220
|
+
const len3 = WASM_VECTOR_LEN;
|
|
221
|
+
const ptr4 = passStringToWasm0(edge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
222
|
+
const len4 = WASM_VECTOR_LEN;
|
|
223
|
+
wasm.convolve_bitmap_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2, ptr3, len3, matrix_x, matrix_y, bias, ptr4, len4, divisor, preserve_alpha);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @param {Uint8Array} dest_data
|
|
228
|
+
* @param {Float64Array} dest_descriptor
|
|
229
|
+
* @param {Uint8Array} source_data
|
|
230
|
+
* @param {Float64Array} source_descriptor
|
|
231
|
+
*/
|
|
232
|
+
export function copy_bitmap_alpha_wasm(dest_data, dest_descriptor, source_data, source_descriptor) {
|
|
233
|
+
var ptr0 = passArray8ToWasm0(dest_data, wasm.__wbindgen_malloc);
|
|
234
|
+
var len0 = WASM_VECTOR_LEN;
|
|
235
|
+
const ptr1 = passArrayF64ToWasm0(dest_descriptor, wasm.__wbindgen_malloc);
|
|
236
|
+
const len1 = WASM_VECTOR_LEN;
|
|
237
|
+
const ptr2 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
238
|
+
const len2 = WASM_VECTOR_LEN;
|
|
239
|
+
const ptr3 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
240
|
+
const len3 = WASM_VECTOR_LEN;
|
|
241
|
+
wasm.copy_bitmap_alpha_wasm(ptr0, len0, dest_data, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @param {Uint8Array} dest_data
|
|
246
|
+
* @param {Float64Array} dest_descriptor
|
|
247
|
+
* @param {Uint8Array} source_data
|
|
248
|
+
* @param {Float64Array} source_descriptor
|
|
249
|
+
* @param {boolean} composite
|
|
250
|
+
*/
|
|
251
|
+
export function copy_bitmap_pixels_wasm(dest_data, dest_descriptor, source_data, source_descriptor, composite) {
|
|
252
|
+
var ptr0 = passArray8ToWasm0(dest_data, wasm.__wbindgen_malloc);
|
|
253
|
+
var len0 = WASM_VECTOR_LEN;
|
|
254
|
+
const ptr1 = passArrayF64ToWasm0(dest_descriptor, wasm.__wbindgen_malloc);
|
|
255
|
+
const len1 = WASM_VECTOR_LEN;
|
|
256
|
+
const ptr2 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
257
|
+
const len2 = WASM_VECTOR_LEN;
|
|
258
|
+
const ptr3 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
259
|
+
const len3 = WASM_VECTOR_LEN;
|
|
260
|
+
wasm.copy_bitmap_pixels_wasm(ptr0, len0, dest_data, ptr1, len1, ptr2, len2, ptr3, len3, composite);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @param {Uint8Array} out
|
|
265
|
+
* @param {Uint8Array} source_data
|
|
266
|
+
* @param {number} source_width
|
|
267
|
+
* @param {number} source_height
|
|
268
|
+
* @param {number} grid_size
|
|
269
|
+
*/
|
|
270
|
+
export function create_bitmap_fingerprint_wasm(out, source_data, source_width, source_height, grid_size) {
|
|
271
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
272
|
+
var len0 = WASM_VECTOR_LEN;
|
|
273
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
274
|
+
const len1 = WASM_VECTOR_LEN;
|
|
275
|
+
wasm.create_bitmap_fingerprint_wasm(ptr0, len0, out, ptr1, len1, source_width, source_height, grid_size);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @param {Uint8Array} out
|
|
280
|
+
* @param {Uint8Array} source_data
|
|
281
|
+
* @param {Float64Array} source_descriptor
|
|
282
|
+
* @param {number} radius
|
|
283
|
+
*/
|
|
284
|
+
export function dilate_bitmap_wasm(out, source_data, source_descriptor, radius) {
|
|
285
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
286
|
+
var len0 = WASM_VECTOR_LEN;
|
|
287
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
288
|
+
const len1 = WASM_VECTOR_LEN;
|
|
289
|
+
const ptr2 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
290
|
+
const len2 = WASM_VECTOR_LEN;
|
|
291
|
+
wasm.dilate_bitmap_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2, radius);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @param {Uint8Array} out
|
|
296
|
+
* @param {Uint8Array} source_data
|
|
297
|
+
* @param {Float64Array} source_descriptor
|
|
298
|
+
* @param {number} radius
|
|
299
|
+
*/
|
|
300
|
+
export function erode_bitmap_wasm(out, source_data, source_descriptor, radius) {
|
|
301
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
302
|
+
var len0 = WASM_VECTOR_LEN;
|
|
303
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
304
|
+
const len1 = WASM_VECTOR_LEN;
|
|
305
|
+
const ptr2 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
306
|
+
const len2 = WASM_VECTOR_LEN;
|
|
307
|
+
wasm.erode_bitmap_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2, radius);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @param {Uint8Array} data
|
|
312
|
+
* @param {Float64Array} descriptor
|
|
313
|
+
* @param {number} seed
|
|
314
|
+
* @param {number} low
|
|
315
|
+
* @param {number} high
|
|
316
|
+
* @param {boolean} gray_scale
|
|
317
|
+
*/
|
|
318
|
+
export function fill_bitmap_noise_wasm(data, descriptor, seed, low, high, gray_scale) {
|
|
319
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
320
|
+
var len0 = WASM_VECTOR_LEN;
|
|
321
|
+
const ptr1 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
322
|
+
const len1 = WASM_VECTOR_LEN;
|
|
323
|
+
wasm.fill_bitmap_noise_wasm(ptr0, len0, data, ptr1, len1, seed, low, high, gray_scale);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @param {Uint8Array} data
|
|
328
|
+
* @param {Float64Array} descriptor
|
|
329
|
+
* @param {number} base_x
|
|
330
|
+
* @param {number} base_y
|
|
331
|
+
* @param {number} octaves
|
|
332
|
+
* @param {number} seed
|
|
333
|
+
* @param {boolean} gray_scale
|
|
334
|
+
* @param {boolean} stitch
|
|
335
|
+
* @param {number} channel_options
|
|
336
|
+
*/
|
|
337
|
+
export function fill_bitmap_perlin_noise_wasm(data, descriptor, base_x, base_y, octaves, seed, gray_scale, stitch, channel_options) {
|
|
338
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
339
|
+
var len0 = WASM_VECTOR_LEN;
|
|
340
|
+
const ptr1 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
341
|
+
const len1 = WASM_VECTOR_LEN;
|
|
342
|
+
wasm.fill_bitmap_perlin_noise_wasm(ptr0, len0, data, ptr1, len1, base_x, base_y, octaves, seed, gray_scale, stitch, channel_options);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @param {Uint8Array} data
|
|
347
|
+
* @param {Float64Array} descriptor
|
|
348
|
+
* @param {number} color
|
|
349
|
+
*/
|
|
350
|
+
export function fill_bitmap_rectangle_wasm(data, descriptor, color) {
|
|
351
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
352
|
+
var len0 = WASM_VECTOR_LEN;
|
|
353
|
+
const ptr1 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
354
|
+
const len1 = WASM_VECTOR_LEN;
|
|
355
|
+
wasm.fill_bitmap_rectangle_wasm(ptr0, len0, data, ptr1, len1, color);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @param {Uint8Array} data
|
|
360
|
+
* @param {Float64Array} descriptor
|
|
361
|
+
* @param {number} base_x
|
|
362
|
+
* @param {number} base_y
|
|
363
|
+
* @param {number} octaves
|
|
364
|
+
* @param {number} seed
|
|
365
|
+
* @param {boolean} gray_scale
|
|
366
|
+
* @param {boolean} stitch
|
|
367
|
+
* @param {number} channel_options
|
|
368
|
+
*/
|
|
369
|
+
export function fill_bitmap_turbulence_wasm(data, descriptor, base_x, base_y, octaves, seed, gray_scale, stitch, channel_options) {
|
|
370
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
371
|
+
var len0 = WASM_VECTOR_LEN;
|
|
372
|
+
const ptr1 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
373
|
+
const len1 = WASM_VECTOR_LEN;
|
|
374
|
+
wasm.fill_bitmap_turbulence_wasm(ptr0, len0, data, ptr1, len1, base_x, base_y, octaves, seed, gray_scale, stitch, channel_options);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @param {Float64Array} out
|
|
379
|
+
* @param {Uint8Array} data
|
|
380
|
+
* @param {Float64Array} descriptor
|
|
381
|
+
* @param {number} mask
|
|
382
|
+
* @param {number} color
|
|
383
|
+
* @param {boolean} find_color
|
|
384
|
+
* @returns {boolean}
|
|
385
|
+
*/
|
|
386
|
+
export function get_bitmap_color_bounds_rectangle_wasm(out, data, descriptor, mask, color, find_color) {
|
|
387
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
388
|
+
var len0 = WASM_VECTOR_LEN;
|
|
389
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
390
|
+
const len1 = WASM_VECTOR_LEN;
|
|
391
|
+
const ptr2 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
392
|
+
const len2 = WASM_VECTOR_LEN;
|
|
393
|
+
const ret = wasm.get_bitmap_color_bounds_rectangle_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2, mask, color, find_color);
|
|
394
|
+
return ret !== 0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* @param {Uint8Array} data
|
|
399
|
+
* @param {number} width
|
|
400
|
+
* @param {number} height
|
|
401
|
+
* @param {number} background_color
|
|
402
|
+
* @param {number} channel_tolerance
|
|
403
|
+
* @returns {number}
|
|
404
|
+
*/
|
|
405
|
+
export function get_bitmap_coverage_wasm(data, width, height, background_color, channel_tolerance) {
|
|
406
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
407
|
+
const len0 = WASM_VECTOR_LEN;
|
|
408
|
+
const ret = wasm.get_bitmap_coverage_wasm(ptr0, len0, width, height, background_color, channel_tolerance);
|
|
409
|
+
return ret;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* @param {Float64Array} out
|
|
414
|
+
* @param {Uint8Array} data
|
|
415
|
+
* @param {Float64Array} descriptor
|
|
416
|
+
*/
|
|
417
|
+
export function get_bitmap_histogram_wasm(out, data, descriptor) {
|
|
418
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
419
|
+
var len0 = WASM_VECTOR_LEN;
|
|
420
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
421
|
+
const len1 = WASM_VECTOR_LEN;
|
|
422
|
+
const ptr2 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
423
|
+
const len2 = WASM_VECTOR_LEN;
|
|
424
|
+
wasm.get_bitmap_histogram_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* @param {Float64Array} out
|
|
429
|
+
* @param {Uint8Array} source_data
|
|
430
|
+
* @param {number} source_width
|
|
431
|
+
* @param {number} source_height
|
|
432
|
+
* @param {Uint8Array} other_data
|
|
433
|
+
* @param {number} other_width
|
|
434
|
+
* @param {number} other_height
|
|
435
|
+
* @param {number} channel_tolerance
|
|
436
|
+
*/
|
|
437
|
+
export function get_bitmap_mismatch_wasm(out, source_data, source_width, source_height, other_data, other_width, other_height, channel_tolerance) {
|
|
438
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
439
|
+
var len0 = WASM_VECTOR_LEN;
|
|
440
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
441
|
+
const len1 = WASM_VECTOR_LEN;
|
|
442
|
+
const ptr2 = passArray8ToWasm0(other_data, wasm.__wbindgen_malloc);
|
|
443
|
+
const len2 = WASM_VECTOR_LEN;
|
|
444
|
+
wasm.get_bitmap_mismatch_wasm(ptr0, len0, out, ptr1, len1, source_width, source_height, ptr2, len2, other_width, other_height, channel_tolerance);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* @param {Uint8Array} out_data
|
|
449
|
+
* @param {Float64Array} out_descriptor
|
|
450
|
+
* @param {Uint8Array} red_data
|
|
451
|
+
* @param {Float64Array} red_descriptor
|
|
452
|
+
* @param {Uint8Array} green_data
|
|
453
|
+
* @param {Float64Array} green_descriptor
|
|
454
|
+
* @param {Uint8Array} blue_data
|
|
455
|
+
* @param {Float64Array} blue_descriptor
|
|
456
|
+
* @param {Uint8Array} alpha_data
|
|
457
|
+
* @param {Float64Array} alpha_descriptor
|
|
458
|
+
*/
|
|
459
|
+
export function merge_bitmap_channels_wasm(out_data, out_descriptor, red_data, red_descriptor, green_data, green_descriptor, blue_data, blue_descriptor, alpha_data, alpha_descriptor) {
|
|
460
|
+
var ptr0 = passArray8ToWasm0(out_data, wasm.__wbindgen_malloc);
|
|
461
|
+
var len0 = WASM_VECTOR_LEN;
|
|
462
|
+
const ptr1 = passArrayF64ToWasm0(out_descriptor, wasm.__wbindgen_malloc);
|
|
463
|
+
const len1 = WASM_VECTOR_LEN;
|
|
464
|
+
const ptr2 = passArray8ToWasm0(red_data, wasm.__wbindgen_malloc);
|
|
465
|
+
const len2 = WASM_VECTOR_LEN;
|
|
466
|
+
const ptr3 = passArrayF64ToWasm0(red_descriptor, wasm.__wbindgen_malloc);
|
|
467
|
+
const len3 = WASM_VECTOR_LEN;
|
|
468
|
+
const ptr4 = passArray8ToWasm0(green_data, wasm.__wbindgen_malloc);
|
|
469
|
+
const len4 = WASM_VECTOR_LEN;
|
|
470
|
+
const ptr5 = passArrayF64ToWasm0(green_descriptor, wasm.__wbindgen_malloc);
|
|
471
|
+
const len5 = WASM_VECTOR_LEN;
|
|
472
|
+
const ptr6 = passArray8ToWasm0(blue_data, wasm.__wbindgen_malloc);
|
|
473
|
+
const len6 = WASM_VECTOR_LEN;
|
|
474
|
+
const ptr7 = passArrayF64ToWasm0(blue_descriptor, wasm.__wbindgen_malloc);
|
|
475
|
+
const len7 = WASM_VECTOR_LEN;
|
|
476
|
+
const ptr8 = passArray8ToWasm0(alpha_data, wasm.__wbindgen_malloc);
|
|
477
|
+
const len8 = WASM_VECTOR_LEN;
|
|
478
|
+
const ptr9 = passArrayF64ToWasm0(alpha_descriptor, wasm.__wbindgen_malloc);
|
|
479
|
+
const len9 = WASM_VECTOR_LEN;
|
|
480
|
+
wasm.merge_bitmap_channels_wasm(ptr0, len0, out_data, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @param {Uint8Array} data
|
|
485
|
+
* @param {Float64Array} descriptor
|
|
486
|
+
* @param {number} factor
|
|
487
|
+
*/
|
|
488
|
+
export function multiply_bitmap_alpha_wasm(data, descriptor, factor) {
|
|
489
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
490
|
+
var len0 = WASM_VECTOR_LEN;
|
|
491
|
+
const ptr1 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
492
|
+
const len1 = WASM_VECTOR_LEN;
|
|
493
|
+
wasm.multiply_bitmap_alpha_wasm(ptr0, len0, data, ptr1, len1, factor);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* @param {Uint8Array} out
|
|
498
|
+
* @param {Uint8Array} source_data
|
|
499
|
+
* @param {Float64Array} source_descriptor
|
|
500
|
+
* @param {number} block_size
|
|
501
|
+
*/
|
|
502
|
+
export function pixelate_bitmap_wasm(out, source_data, source_descriptor, block_size) {
|
|
503
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
504
|
+
var len0 = WASM_VECTOR_LEN;
|
|
505
|
+
const ptr1 = passArray8ToWasm0(source_data, wasm.__wbindgen_malloc);
|
|
506
|
+
const len1 = WASM_VECTOR_LEN;
|
|
507
|
+
const ptr2 = passArrayF64ToWasm0(source_descriptor, wasm.__wbindgen_malloc);
|
|
508
|
+
const len2 = WASM_VECTOR_LEN;
|
|
509
|
+
wasm.pixelate_bitmap_wasm(ptr0, len0, out, ptr1, len1, ptr2, len2, block_size);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @param {Uint8Array} out
|
|
514
|
+
* @param {Uint8Array} source
|
|
515
|
+
* @param {number} length
|
|
516
|
+
*/
|
|
517
|
+
export function premultiply_bitmap_pixels_wasm(out, source, length) {
|
|
518
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
519
|
+
var len0 = WASM_VECTOR_LEN;
|
|
520
|
+
const ptr1 = passArray8ToWasm0(source, wasm.__wbindgen_malloc);
|
|
521
|
+
const len1 = WASM_VECTOR_LEN;
|
|
522
|
+
wasm.premultiply_bitmap_pixels_wasm(ptr0, len0, out, ptr1, len1, length);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* @param {Uint8Array} data
|
|
527
|
+
* @param {Float64Array} descriptor
|
|
528
|
+
* @param {number} alpha
|
|
529
|
+
*/
|
|
530
|
+
export function set_bitmap_alpha_wasm(data, descriptor, alpha) {
|
|
531
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
532
|
+
var len0 = WASM_VECTOR_LEN;
|
|
533
|
+
const ptr1 = passArrayF64ToWasm0(descriptor, wasm.__wbindgen_malloc);
|
|
534
|
+
const len1 = WASM_VECTOR_LEN;
|
|
535
|
+
wasm.set_bitmap_alpha_wasm(ptr0, len0, data, ptr1, len1, alpha);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @param {Float64Array} out
|
|
540
|
+
*/
|
|
541
|
+
export function set_bitmap_color_matrix_identity_wasm(out) {
|
|
542
|
+
var ptr0 = passArrayF64ToWasm0(out, wasm.__wbindgen_malloc);
|
|
543
|
+
var len0 = WASM_VECTOR_LEN;
|
|
544
|
+
wasm.set_bitmap_color_matrix_identity_wasm(ptr0, len0, out);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @param {Uint8Array} out
|
|
549
|
+
* @param {Uint8Array} source
|
|
550
|
+
* @param {number} length
|
|
551
|
+
*/
|
|
552
|
+
export function unpremultiply_bitmap_pixels_wasm(out, source, length) {
|
|
553
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
554
|
+
var len0 = WASM_VECTOR_LEN;
|
|
555
|
+
const ptr1 = passArray8ToWasm0(source, wasm.__wbindgen_malloc);
|
|
556
|
+
const len1 = WASM_VECTOR_LEN;
|
|
557
|
+
wasm.unpremultiply_bitmap_pixels_wasm(ptr0, len0, out, ptr1, len1, length);
|
|
558
|
+
}
|
|
559
|
+
function __wbg_get_imports() {
|
|
560
|
+
const import0 = {
|
|
561
|
+
__proto__: null,
|
|
562
|
+
__wbg___wbindgen_copy_to_typed_array_4db0cbe2cc60dbee: function(arg0, arg1, arg2) {
|
|
563
|
+
new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
|
|
564
|
+
},
|
|
565
|
+
__wbindgen_init_externref_table: function() {
|
|
566
|
+
const table = wasm.__wbindgen_externrefs;
|
|
567
|
+
const offset = table.grow(4);
|
|
568
|
+
table.set(0, undefined);
|
|
569
|
+
table.set(offset + 0, undefined);
|
|
570
|
+
table.set(offset + 1, null);
|
|
571
|
+
table.set(offset + 2, true);
|
|
572
|
+
table.set(offset + 3, false);
|
|
573
|
+
},
|
|
574
|
+
};
|
|
575
|
+
return {
|
|
576
|
+
__proto__: null,
|
|
577
|
+
"./bitmap_wasm_bg.js": import0,
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
582
|
+
ptr = ptr >>> 0;
|
|
583
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
587
|
+
function getFloat64ArrayMemory0() {
|
|
588
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
589
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
590
|
+
}
|
|
591
|
+
return cachedFloat64ArrayMemory0;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
let cachedUint8ArrayMemory0 = null;
|
|
595
|
+
function getUint8ArrayMemory0() {
|
|
596
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
597
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
598
|
+
}
|
|
599
|
+
return cachedUint8ArrayMemory0;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
603
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
604
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
605
|
+
WASM_VECTOR_LEN = arg.length;
|
|
606
|
+
return ptr;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
610
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
611
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
612
|
+
WASM_VECTOR_LEN = arg.length;
|
|
613
|
+
return ptr;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
617
|
+
if (realloc === undefined) {
|
|
618
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
619
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
620
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
621
|
+
WASM_VECTOR_LEN = buf.length;
|
|
622
|
+
return ptr;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
let len = arg.length;
|
|
626
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
627
|
+
|
|
628
|
+
const mem = getUint8ArrayMemory0();
|
|
629
|
+
|
|
630
|
+
let offset = 0;
|
|
631
|
+
|
|
632
|
+
for (; offset < len; offset++) {
|
|
633
|
+
const code = arg.charCodeAt(offset);
|
|
634
|
+
if (code > 0x7F) break;
|
|
635
|
+
mem[ptr + offset] = code;
|
|
636
|
+
}
|
|
637
|
+
if (offset !== len) {
|
|
638
|
+
if (offset !== 0) {
|
|
639
|
+
arg = arg.slice(offset);
|
|
640
|
+
}
|
|
641
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
642
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
643
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
644
|
+
|
|
645
|
+
offset += ret.written;
|
|
646
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
WASM_VECTOR_LEN = offset;
|
|
650
|
+
return ptr;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
const cachedTextEncoder = new TextEncoder();
|
|
654
|
+
|
|
655
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
656
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
657
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
658
|
+
view.set(buf);
|
|
659
|
+
return {
|
|
660
|
+
read: arg.length,
|
|
661
|
+
written: buf.length
|
|
662
|
+
};
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
let WASM_VECTOR_LEN = 0;
|
|
667
|
+
|
|
668
|
+
let wasmModule, wasmInstance, wasm;
|
|
669
|
+
function __wbg_finalize_init(instance, module) {
|
|
670
|
+
wasmInstance = instance;
|
|
671
|
+
wasm = instance.exports;
|
|
672
|
+
wasmModule = module;
|
|
673
|
+
cachedFloat64ArrayMemory0 = null;
|
|
674
|
+
cachedUint8ArrayMemory0 = null;
|
|
675
|
+
wasm.__wbindgen_start();
|
|
676
|
+
return wasm;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
async function __wbg_load(module, imports) {
|
|
680
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
681
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
682
|
+
try {
|
|
683
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
684
|
+
} catch (e) {
|
|
685
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
686
|
+
|
|
687
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
688
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
689
|
+
|
|
690
|
+
} else { throw e; }
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
const bytes = await module.arrayBuffer();
|
|
695
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
696
|
+
} else {
|
|
697
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
698
|
+
|
|
699
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
700
|
+
return { instance, module };
|
|
701
|
+
} else {
|
|
702
|
+
return instance;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
function expectedResponseType(type) {
|
|
707
|
+
switch (type) {
|
|
708
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
709
|
+
}
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function initSync(module) {
|
|
715
|
+
if (wasm !== undefined) return wasm;
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
if (module !== undefined) {
|
|
719
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
720
|
+
({module} = module)
|
|
721
|
+
} else {
|
|
722
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const imports = __wbg_get_imports();
|
|
727
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
728
|
+
module = new WebAssembly.Module(module);
|
|
729
|
+
}
|
|
730
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
731
|
+
return __wbg_finalize_init(instance, module);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
async function __wbg_init(module_or_path) {
|
|
735
|
+
if (wasm !== undefined) return wasm;
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
if (module_or_path !== undefined) {
|
|
739
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
740
|
+
({module_or_path} = module_or_path)
|
|
741
|
+
} else {
|
|
742
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (module_or_path === undefined) {
|
|
747
|
+
module_or_path = new URL('bitmap_wasm_bg.wasm', import.meta.url);
|
|
748
|
+
}
|
|
749
|
+
const imports = __wbg_get_imports();
|
|
750
|
+
|
|
751
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
752
|
+
module_or_path = fetch(module_or_path);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
756
|
+
|
|
757
|
+
return __wbg_finalize_init(instance, module);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export { initSync, __wbg_init as default };
|