@pixagram/renderart 0.1.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.
@@ -0,0 +1,893 @@
1
+ let wasm;
2
+
3
+ function _assertClass(instance, klass) {
4
+ if (!(instance instanceof klass)) {
5
+ throw new Error(`expected instance of ${klass.name}`);
6
+ }
7
+ }
8
+
9
+ function getArrayU32FromWasm0(ptr, len) {
10
+ ptr = ptr >>> 0;
11
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
12
+ }
13
+
14
+ let cachedDataViewMemory0 = null;
15
+ function getDataViewMemory0() {
16
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
17
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
18
+ }
19
+ return cachedDataViewMemory0;
20
+ }
21
+
22
+ function getStringFromWasm0(ptr, len) {
23
+ ptr = ptr >>> 0;
24
+ return decodeText(ptr, len);
25
+ }
26
+
27
+ let cachedUint32ArrayMemory0 = null;
28
+ function getUint32ArrayMemory0() {
29
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
30
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
31
+ }
32
+ return cachedUint32ArrayMemory0;
33
+ }
34
+
35
+ let cachedUint8ArrayMemory0 = null;
36
+ function getUint8ArrayMemory0() {
37
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
38
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
39
+ }
40
+ return cachedUint8ArrayMemory0;
41
+ }
42
+
43
+ function passArray8ToWasm0(arg, malloc) {
44
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
45
+ getUint8ArrayMemory0().set(arg, ptr / 1);
46
+ WASM_VECTOR_LEN = arg.length;
47
+ return ptr;
48
+ }
49
+
50
+ function passStringToWasm0(arg, malloc, realloc) {
51
+ if (realloc === undefined) {
52
+ const buf = cachedTextEncoder.encode(arg);
53
+ const ptr = malloc(buf.length, 1) >>> 0;
54
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
55
+ WASM_VECTOR_LEN = buf.length;
56
+ return ptr;
57
+ }
58
+
59
+ let len = arg.length;
60
+ let ptr = malloc(len, 1) >>> 0;
61
+
62
+ const mem = getUint8ArrayMemory0();
63
+
64
+ let offset = 0;
65
+
66
+ for (; offset < len; offset++) {
67
+ const code = arg.charCodeAt(offset);
68
+ if (code > 0x7F) break;
69
+ mem[ptr + offset] = code;
70
+ }
71
+ if (offset !== len) {
72
+ if (offset !== 0) {
73
+ arg = arg.slice(offset);
74
+ }
75
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
+ const ret = cachedTextEncoder.encodeInto(arg, view);
78
+
79
+ offset += ret.written;
80
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
81
+ }
82
+
83
+ WASM_VECTOR_LEN = offset;
84
+ return ptr;
85
+ }
86
+
87
+ function takeFromExternrefTable0(idx) {
88
+ const value = wasm.__wbindgen_externrefs.get(idx);
89
+ wasm.__externref_table_dealloc(idx);
90
+ return value;
91
+ }
92
+
93
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
94
+ cachedTextDecoder.decode();
95
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
96
+ let numBytesDecoded = 0;
97
+ function decodeText(ptr, len) {
98
+ numBytesDecoded += len;
99
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
100
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
101
+ cachedTextDecoder.decode();
102
+ numBytesDecoded = len;
103
+ }
104
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
105
+ }
106
+
107
+ const cachedTextEncoder = new TextEncoder();
108
+
109
+ if (!('encodeInto' in cachedTextEncoder)) {
110
+ cachedTextEncoder.encodeInto = function (arg, view) {
111
+ const buf = cachedTextEncoder.encode(arg);
112
+ view.set(buf);
113
+ return {
114
+ read: arg.length,
115
+ written: buf.length
116
+ };
117
+ }
118
+ }
119
+
120
+ let WASM_VECTOR_LEN = 0;
121
+
122
+ const CrtConfigFinalization = (typeof FinalizationRegistry === 'undefined')
123
+ ? { register: () => {}, unregister: () => {} }
124
+ : new FinalizationRegistry(ptr => wasm.__wbg_crtconfig_free(ptr >>> 0, 1));
125
+
126
+ const HexConfigFinalization = (typeof FinalizationRegistry === 'undefined')
127
+ ? { register: () => {}, unregister: () => {} }
128
+ : new FinalizationRegistry(ptr => wasm.__wbg_hexconfig_free(ptr >>> 0, 1));
129
+
130
+ const UpscaleResultFinalization = (typeof FinalizationRegistry === 'undefined')
131
+ ? { register: () => {}, unregister: () => {} }
132
+ : new FinalizationRegistry(ptr => wasm.__wbg_upscaleresult_free(ptr >>> 0, 1));
133
+
134
+ const XbrzConfigFinalization = (typeof FinalizationRegistry === 'undefined')
135
+ ? { register: () => {}, unregister: () => {} }
136
+ : new FinalizationRegistry(ptr => wasm.__wbg_xbrzconfig_free(ptr >>> 0, 1));
137
+
138
+ /**
139
+ * CRT configuration options
140
+ */
141
+ export class CrtConfig {
142
+ static __wrap(ptr) {
143
+ ptr = ptr >>> 0;
144
+ const obj = Object.create(CrtConfig.prototype);
145
+ obj.__wbg_ptr = ptr;
146
+ CrtConfigFinalization.register(obj, obj.__wbg_ptr, obj);
147
+ return obj;
148
+ }
149
+ __destroy_into_raw() {
150
+ const ptr = this.__wbg_ptr;
151
+ this.__wbg_ptr = 0;
152
+ CrtConfigFinalization.unregister(this);
153
+ return ptr;
154
+ }
155
+ free() {
156
+ const ptr = this.__destroy_into_raw();
157
+ wasm.__wbg_crtconfig_free(ptr, 0);
158
+ }
159
+ /**
160
+ * Horizontal warp intensity (0.0 - 0.1)
161
+ * @returns {number}
162
+ */
163
+ get warp_x() {
164
+ const ret = wasm.__wbg_get_crtconfig_warp_x(this.__wbg_ptr);
165
+ return ret;
166
+ }
167
+ /**
168
+ * Horizontal warp intensity (0.0 - 0.1)
169
+ * @param {number} arg0
170
+ */
171
+ set warp_x(arg0) {
172
+ wasm.__wbg_set_crtconfig_warp_x(this.__wbg_ptr, arg0);
173
+ }
174
+ /**
175
+ * Vertical warp intensity (0.0 - 0.1)
176
+ * @returns {number}
177
+ */
178
+ get warp_y() {
179
+ const ret = wasm.__wbg_get_crtconfig_warp_y(this.__wbg_ptr);
180
+ return ret;
181
+ }
182
+ /**
183
+ * Vertical warp intensity (0.0 - 0.1)
184
+ * @param {number} arg0
185
+ */
186
+ set warp_y(arg0) {
187
+ wasm.__wbg_set_crtconfig_warp_y(this.__wbg_ptr, arg0);
188
+ }
189
+ /**
190
+ * Scanline hardness (-10.0 to 0.0, more negative = sharper)
191
+ * @returns {number}
192
+ */
193
+ get scan_hardness() {
194
+ const ret = wasm.__wbg_get_crtconfig_scan_hardness(this.__wbg_ptr);
195
+ return ret;
196
+ }
197
+ /**
198
+ * Scanline hardness (-10.0 to 0.0, more negative = sharper)
199
+ * @param {number} arg0
200
+ */
201
+ set scan_hardness(arg0) {
202
+ wasm.__wbg_set_crtconfig_scan_hardness(this.__wbg_ptr, arg0);
203
+ }
204
+ /**
205
+ * Scanline opacity (0.0 - 1.0)
206
+ * @returns {number}
207
+ */
208
+ get scan_opacity() {
209
+ const ret = wasm.__wbg_get_crtconfig_scan_opacity(this.__wbg_ptr);
210
+ return ret;
211
+ }
212
+ /**
213
+ * Scanline opacity (0.0 - 1.0)
214
+ * @param {number} arg0
215
+ */
216
+ set scan_opacity(arg0) {
217
+ wasm.__wbg_set_crtconfig_scan_opacity(this.__wbg_ptr, arg0);
218
+ }
219
+ /**
220
+ * Shadow mask opacity (0.0 - 1.0)
221
+ * @returns {number}
222
+ */
223
+ get mask_opacity() {
224
+ const ret = wasm.__wbg_get_crtconfig_mask_opacity(this.__wbg_ptr);
225
+ return ret;
226
+ }
227
+ /**
228
+ * Shadow mask opacity (0.0 - 1.0)
229
+ * @param {number} arg0
230
+ */
231
+ set mask_opacity(arg0) {
232
+ wasm.__wbg_set_crtconfig_mask_opacity(this.__wbg_ptr, arg0);
233
+ }
234
+ /**
235
+ * Enable barrel distortion
236
+ * @returns {boolean}
237
+ */
238
+ get enable_warp() {
239
+ const ret = wasm.__wbg_get_crtconfig_enable_warp(this.__wbg_ptr);
240
+ return ret !== 0;
241
+ }
242
+ /**
243
+ * Enable barrel distortion
244
+ * @param {boolean} arg0
245
+ */
246
+ set enable_warp(arg0) {
247
+ wasm.__wbg_set_crtconfig_enable_warp(this.__wbg_ptr, arg0);
248
+ }
249
+ /**
250
+ * Enable scanlines
251
+ * @returns {boolean}
252
+ */
253
+ get enable_scanlines() {
254
+ const ret = wasm.__wbg_get_crtconfig_enable_scanlines(this.__wbg_ptr);
255
+ return ret !== 0;
256
+ }
257
+ /**
258
+ * Enable scanlines
259
+ * @param {boolean} arg0
260
+ */
261
+ set enable_scanlines(arg0) {
262
+ wasm.__wbg_set_crtconfig_enable_scanlines(this.__wbg_ptr, arg0);
263
+ }
264
+ /**
265
+ * Enable shadow mask
266
+ * @returns {boolean}
267
+ */
268
+ get enable_mask() {
269
+ const ret = wasm.__wbg_get_crtconfig_enable_mask(this.__wbg_ptr);
270
+ return ret !== 0;
271
+ }
272
+ /**
273
+ * Enable shadow mask
274
+ * @param {boolean} arg0
275
+ */
276
+ set enable_mask(arg0) {
277
+ wasm.__wbg_set_crtconfig_enable_mask(this.__wbg_ptr, arg0);
278
+ }
279
+ constructor() {
280
+ const ret = wasm.crtconfig_new();
281
+ this.__wbg_ptr = ret >>> 0;
282
+ CrtConfigFinalization.register(this, this.__wbg_ptr, this);
283
+ return this;
284
+ }
285
+ /**
286
+ * Create preset: Authentic CRT look
287
+ * @returns {CrtConfig}
288
+ */
289
+ static preset_authentic() {
290
+ const ret = wasm.crtconfig_preset_authentic();
291
+ return CrtConfig.__wrap(ret);
292
+ }
293
+ /**
294
+ * Create preset: Subtle modern look
295
+ * @returns {CrtConfig}
296
+ */
297
+ static preset_subtle() {
298
+ const ret = wasm.crtconfig_preset_subtle();
299
+ return CrtConfig.__wrap(ret);
300
+ }
301
+ /**
302
+ * Create preset: Flat screen (no curvature)
303
+ * @returns {CrtConfig}
304
+ */
305
+ static preset_flat() {
306
+ const ret = wasm.crtconfig_preset_flat();
307
+ return CrtConfig.__wrap(ret);
308
+ }
309
+ }
310
+ if (Symbol.dispose) CrtConfig.prototype[Symbol.dispose] = CrtConfig.prototype.free;
311
+
312
+ /**
313
+ * Configuration for hexagonal upscaling
314
+ */
315
+ export class HexConfig {
316
+ static __wrap(ptr) {
317
+ ptr = ptr >>> 0;
318
+ const obj = Object.create(HexConfig.prototype);
319
+ obj.__wbg_ptr = ptr;
320
+ HexConfigFinalization.register(obj, obj.__wbg_ptr, obj);
321
+ return obj;
322
+ }
323
+ __destroy_into_raw() {
324
+ const ptr = this.__wbg_ptr;
325
+ this.__wbg_ptr = 0;
326
+ HexConfigFinalization.unregister(this);
327
+ return ptr;
328
+ }
329
+ free() {
330
+ const ptr = this.__destroy_into_raw();
331
+ wasm.__wbg_hexconfig_free(ptr, 0);
332
+ }
333
+ /**
334
+ * Hexagon orientation
335
+ * @returns {HexOrientation}
336
+ */
337
+ get orientation() {
338
+ const ret = wasm.__wbg_get_hexconfig_orientation(this.__wbg_ptr);
339
+ return ret;
340
+ }
341
+ /**
342
+ * Hexagon orientation
343
+ * @param {HexOrientation} arg0
344
+ */
345
+ set orientation(arg0) {
346
+ wasm.__wbg_set_hexconfig_orientation(this.__wbg_ptr, arg0);
347
+ }
348
+ /**
349
+ * Draw hexagon borders
350
+ * @returns {boolean}
351
+ */
352
+ get draw_borders() {
353
+ const ret = wasm.__wbg_get_hexconfig_draw_borders(this.__wbg_ptr);
354
+ return ret !== 0;
355
+ }
356
+ /**
357
+ * Draw hexagon borders
358
+ * @param {boolean} arg0
359
+ */
360
+ set draw_borders(arg0) {
361
+ wasm.__wbg_set_hexconfig_draw_borders(this.__wbg_ptr, arg0);
362
+ }
363
+ /**
364
+ * Border color (RGBA packed as u32: 0xRRGGBBAA)
365
+ * @returns {number}
366
+ */
367
+ get border_color() {
368
+ const ret = wasm.__wbg_get_hexconfig_border_color(this.__wbg_ptr);
369
+ return ret >>> 0;
370
+ }
371
+ /**
372
+ * Border color (RGBA packed as u32: 0xRRGGBBAA)
373
+ * @param {number} arg0
374
+ */
375
+ set border_color(arg0) {
376
+ wasm.__wbg_set_hexconfig_border_color(this.__wbg_ptr, arg0);
377
+ }
378
+ /**
379
+ * Border thickness in pixels
380
+ * @returns {number}
381
+ */
382
+ get border_thickness() {
383
+ const ret = wasm.__wbg_get_hexconfig_border_thickness(this.__wbg_ptr);
384
+ return ret >>> 0;
385
+ }
386
+ /**
387
+ * Border thickness in pixels
388
+ * @param {number} arg0
389
+ */
390
+ set border_thickness(arg0) {
391
+ wasm.__wbg_set_hexconfig_border_thickness(this.__wbg_ptr, arg0);
392
+ }
393
+ /**
394
+ * Background color (RGBA packed as u32)
395
+ * @returns {number}
396
+ */
397
+ get background_color() {
398
+ const ret = wasm.__wbg_get_hexconfig_background_color(this.__wbg_ptr);
399
+ return ret >>> 0;
400
+ }
401
+ /**
402
+ * Background color (RGBA packed as u32)
403
+ * @param {number} arg0
404
+ */
405
+ set background_color(arg0) {
406
+ wasm.__wbg_set_hexconfig_background_color(this.__wbg_ptr, arg0);
407
+ }
408
+ constructor() {
409
+ const ret = wasm.hexconfig_new();
410
+ this.__wbg_ptr = ret >>> 0;
411
+ HexConfigFinalization.register(this, this.__wbg_ptr, this);
412
+ return this;
413
+ }
414
+ /**
415
+ * Create preset with borders
416
+ * @returns {HexConfig}
417
+ */
418
+ static preset_bordered() {
419
+ const ret = wasm.hexconfig_preset_bordered();
420
+ return HexConfig.__wrap(ret);
421
+ }
422
+ /**
423
+ * Create preset for pointy-top hexagons
424
+ * @returns {HexConfig}
425
+ */
426
+ static preset_pointy() {
427
+ const ret = wasm.hexconfig_preset_pointy();
428
+ return HexConfig.__wrap(ret);
429
+ }
430
+ }
431
+ if (Symbol.dispose) HexConfig.prototype[Symbol.dispose] = HexConfig.prototype.free;
432
+
433
+ /**
434
+ * Hexagon orientation type
435
+ * @enum {0 | 1}
436
+ */
437
+ export const HexOrientation = Object.freeze({
438
+ /**
439
+ * Flat edge at top, vertices on left/right
440
+ */
441
+ FlatTop: 0, "0": "FlatTop",
442
+ /**
443
+ * Vertex at top, flat edges on left/right
444
+ */
445
+ PointyTop: 1, "1": "PointyTop",
446
+ });
447
+
448
+ /**
449
+ * Result container for upscaled image data
450
+ */
451
+ export class UpscaleResult {
452
+ static __wrap(ptr) {
453
+ ptr = ptr >>> 0;
454
+ const obj = Object.create(UpscaleResult.prototype);
455
+ obj.__wbg_ptr = ptr;
456
+ UpscaleResultFinalization.register(obj, obj.__wbg_ptr, obj);
457
+ return obj;
458
+ }
459
+ __destroy_into_raw() {
460
+ const ptr = this.__wbg_ptr;
461
+ this.__wbg_ptr = 0;
462
+ UpscaleResultFinalization.unregister(this);
463
+ return ptr;
464
+ }
465
+ free() {
466
+ const ptr = this.__destroy_into_raw();
467
+ wasm.__wbg_upscaleresult_free(ptr, 0);
468
+ }
469
+ /**
470
+ * Pointer to the output buffer in WASM memory
471
+ * @returns {number}
472
+ */
473
+ get ptr() {
474
+ const ret = wasm.upscaleresult_ptr(this.__wbg_ptr);
475
+ return ret >>> 0;
476
+ }
477
+ /**
478
+ * Length of the output buffer in bytes
479
+ * @returns {number}
480
+ */
481
+ get len() {
482
+ const ret = wasm.upscaleresult_len(this.__wbg_ptr);
483
+ return ret >>> 0;
484
+ }
485
+ /**
486
+ * Output image width
487
+ * @returns {number}
488
+ */
489
+ get width() {
490
+ const ret = wasm.upscaleresult_width(this.__wbg_ptr);
491
+ return ret >>> 0;
492
+ }
493
+ /**
494
+ * Output image height
495
+ * @returns {number}
496
+ */
497
+ get height() {
498
+ const ret = wasm.upscaleresult_height(this.__wbg_ptr);
499
+ return ret >>> 0;
500
+ }
501
+ }
502
+ if (Symbol.dispose) UpscaleResult.prototype[Symbol.dispose] = UpscaleResult.prototype.free;
503
+
504
+ /**
505
+ * xBRZ configuration options
506
+ */
507
+ export class XbrzConfig {
508
+ static __wrap(ptr) {
509
+ ptr = ptr >>> 0;
510
+ const obj = Object.create(XbrzConfig.prototype);
511
+ obj.__wbg_ptr = ptr;
512
+ XbrzConfigFinalization.register(obj, obj.__wbg_ptr, obj);
513
+ return obj;
514
+ }
515
+ __destroy_into_raw() {
516
+ const ptr = this.__wbg_ptr;
517
+ this.__wbg_ptr = 0;
518
+ XbrzConfigFinalization.unregister(this);
519
+ return ptr;
520
+ }
521
+ free() {
522
+ const ptr = this.__destroy_into_raw();
523
+ wasm.__wbg_xbrzconfig_free(ptr, 0);
524
+ }
525
+ /**
526
+ * Luminance weight for edge detection (0.0 - 1.0)
527
+ * @returns {number}
528
+ */
529
+ get luminance_weight() {
530
+ const ret = wasm.__wbg_get_crtconfig_warp_x(this.__wbg_ptr);
531
+ return ret;
532
+ }
533
+ /**
534
+ * Luminance weight for edge detection (0.0 - 1.0)
535
+ * @param {number} arg0
536
+ */
537
+ set luminance_weight(arg0) {
538
+ wasm.__wbg_set_crtconfig_warp_x(this.__wbg_ptr, arg0);
539
+ }
540
+ /**
541
+ * Equal color tolerance (0 - 50)
542
+ * @returns {number}
543
+ */
544
+ get equal_color_tolerance() {
545
+ const ret = wasm.__wbg_get_hexconfig_border_thickness(this.__wbg_ptr);
546
+ return ret >>> 0;
547
+ }
548
+ /**
549
+ * Equal color tolerance (0 - 50)
550
+ * @param {number} arg0
551
+ */
552
+ set equal_color_tolerance(arg0) {
553
+ wasm.__wbg_set_hexconfig_border_thickness(this.__wbg_ptr, arg0);
554
+ }
555
+ /**
556
+ * Dominant direction threshold (3.5 - 6.0)
557
+ * @returns {number}
558
+ */
559
+ get dominant_direction_threshold() {
560
+ const ret = wasm.__wbg_get_crtconfig_scan_hardness(this.__wbg_ptr);
561
+ return ret;
562
+ }
563
+ /**
564
+ * Dominant direction threshold (3.5 - 6.0)
565
+ * @param {number} arg0
566
+ */
567
+ set dominant_direction_threshold(arg0) {
568
+ wasm.__wbg_set_crtconfig_scan_hardness(this.__wbg_ptr, arg0);
569
+ }
570
+ /**
571
+ * Steep direction threshold (2.0 - 3.0)
572
+ * @returns {number}
573
+ */
574
+ get steep_direction_threshold() {
575
+ const ret = wasm.__wbg_get_crtconfig_scan_opacity(this.__wbg_ptr);
576
+ return ret;
577
+ }
578
+ /**
579
+ * Steep direction threshold (2.0 - 3.0)
580
+ * @param {number} arg0
581
+ */
582
+ set steep_direction_threshold(arg0) {
583
+ wasm.__wbg_set_crtconfig_scan_opacity(this.__wbg_ptr, arg0);
584
+ }
585
+ constructor() {
586
+ const ret = wasm.xbrzconfig_new();
587
+ this.__wbg_ptr = ret >>> 0;
588
+ XbrzConfigFinalization.register(this, this.__wbg_ptr, this);
589
+ return this;
590
+ }
591
+ /**
592
+ * Preset for sharp edges
593
+ * @returns {XbrzConfig}
594
+ */
595
+ static preset_sharp() {
596
+ const ret = wasm.xbrzconfig_preset_sharp();
597
+ return XbrzConfig.__wrap(ret);
598
+ }
599
+ /**
600
+ * Preset for smooth output
601
+ * @returns {XbrzConfig}
602
+ */
603
+ static preset_smooth() {
604
+ const ret = wasm.xbrzconfig_preset_smooth();
605
+ return XbrzConfig.__wrap(ret);
606
+ }
607
+ }
608
+ if (Symbol.dispose) XbrzConfig.prototype[Symbol.dispose] = XbrzConfig.prototype.free;
609
+
610
+ /**
611
+ * Apply CRT effect with default configuration
612
+ * @param {Uint8Array} input
613
+ * @param {number} src_w
614
+ * @param {number} src_h
615
+ * @param {number} scale
616
+ * @returns {UpscaleResult}
617
+ */
618
+ export function crt_upscale(input, src_w, src_h, scale) {
619
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
620
+ const len0 = WASM_VECTOR_LEN;
621
+ const ret = wasm.crt_upscale(ptr0, len0, src_w, src_h, scale);
622
+ if (ret[2]) {
623
+ throw takeFromExternrefTable0(ret[1]);
624
+ }
625
+ return UpscaleResult.__wrap(ret[0]);
626
+ }
627
+
628
+ /**
629
+ * Apply CRT effect with custom configuration
630
+ * @param {Uint8Array} input
631
+ * @param {number} src_w
632
+ * @param {number} src_h
633
+ * @param {number} scale
634
+ * @param {CrtConfig} config
635
+ * @returns {UpscaleResult}
636
+ */
637
+ export function crt_upscale_config(input, src_w, src_h, scale, config) {
638
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
639
+ const len0 = WASM_VECTOR_LEN;
640
+ _assertClass(config, CrtConfig);
641
+ const ret = wasm.crt_upscale_config(ptr0, len0, src_w, src_h, scale, config.__wbg_ptr);
642
+ if (ret[2]) {
643
+ throw takeFromExternrefTable0(ret[1]);
644
+ }
645
+ return UpscaleResult.__wrap(ret[0]);
646
+ }
647
+
648
+ /**
649
+ * Get WASM memory for zero-copy data transfer
650
+ * @returns {any}
651
+ */
652
+ export function get_memory() {
653
+ const ret = wasm.get_memory();
654
+ return ret;
655
+ }
656
+
657
+ /**
658
+ * Get output dimensions for hexagonal upscaling
659
+ * @param {number} src_w
660
+ * @param {number} src_h
661
+ * @param {number} scale
662
+ * @param {HexOrientation} orientation
663
+ * @returns {Uint32Array}
664
+ */
665
+ export function hex_get_dimensions(src_w, src_h, scale, orientation) {
666
+ const ret = wasm.hex_get_dimensions(src_w, src_h, scale, orientation);
667
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
668
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
669
+ return v1;
670
+ }
671
+
672
+ /**
673
+ * Apply hexagonal upscaling with default configuration
674
+ * @param {Uint8Array} input
675
+ * @param {number} src_w
676
+ * @param {number} src_h
677
+ * @param {number} scale
678
+ * @returns {UpscaleResult}
679
+ */
680
+ export function hex_upscale(input, src_w, src_h, scale) {
681
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
682
+ const len0 = WASM_VECTOR_LEN;
683
+ const ret = wasm.hex_upscale(ptr0, len0, src_w, src_h, scale);
684
+ if (ret[2]) {
685
+ throw takeFromExternrefTable0(ret[1]);
686
+ }
687
+ return UpscaleResult.__wrap(ret[0]);
688
+ }
689
+
690
+ /**
691
+ * Apply hexagonal upscaling with custom configuration
692
+ * @param {Uint8Array} input
693
+ * @param {number} src_w
694
+ * @param {number} src_h
695
+ * @param {number} scale
696
+ * @param {HexConfig} config
697
+ * @returns {UpscaleResult}
698
+ */
699
+ export function hex_upscale_config(input, src_w, src_h, scale, config) {
700
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
701
+ const len0 = WASM_VECTOR_LEN;
702
+ _assertClass(config, HexConfig);
703
+ const ret = wasm.hex_upscale_config(ptr0, len0, src_w, src_h, scale, config.__wbg_ptr);
704
+ if (ret[2]) {
705
+ throw takeFromExternrefTable0(ret[1]);
706
+ }
707
+ return UpscaleResult.__wrap(ret[0]);
708
+ }
709
+
710
+ export function init() {
711
+ wasm.init();
712
+ }
713
+
714
+ /**
715
+ * Apply xBRZ upscaling with default configuration
716
+ * @param {Uint8Array} input
717
+ * @param {number} src_w
718
+ * @param {number} src_h
719
+ * @param {number} scale
720
+ * @returns {UpscaleResult}
721
+ */
722
+ export function xbrz_upscale(input, src_w, src_h, scale) {
723
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
724
+ const len0 = WASM_VECTOR_LEN;
725
+ const ret = wasm.xbrz_upscale(ptr0, len0, src_w, src_h, scale);
726
+ if (ret[2]) {
727
+ throw takeFromExternrefTable0(ret[1]);
728
+ }
729
+ return UpscaleResult.__wrap(ret[0]);
730
+ }
731
+
732
+ /**
733
+ * Apply xBRZ upscaling with custom configuration
734
+ * @param {Uint8Array} input
735
+ * @param {number} src_w
736
+ * @param {number} src_h
737
+ * @param {number} scale
738
+ * @param {XbrzConfig} config
739
+ * @returns {UpscaleResult}
740
+ */
741
+ export function xbrz_upscale_config(input, src_w, src_h, scale, config) {
742
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
743
+ const len0 = WASM_VECTOR_LEN;
744
+ _assertClass(config, XbrzConfig);
745
+ const ret = wasm.xbrz_upscale_config(ptr0, len0, src_w, src_h, scale, config.__wbg_ptr);
746
+ if (ret[2]) {
747
+ throw takeFromExternrefTable0(ret[1]);
748
+ }
749
+ return UpscaleResult.__wrap(ret[0]);
750
+ }
751
+
752
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
753
+
754
+ async function __wbg_load(module, imports) {
755
+ if (typeof Response === 'function' && module instanceof Response) {
756
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
757
+ try {
758
+ return await WebAssembly.instantiateStreaming(module, imports);
759
+ } catch (e) {
760
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
761
+
762
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
763
+ 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);
764
+
765
+ } else {
766
+ throw e;
767
+ }
768
+ }
769
+ }
770
+
771
+ const bytes = await module.arrayBuffer();
772
+ return await WebAssembly.instantiate(bytes, imports);
773
+ } else {
774
+ const instance = await WebAssembly.instantiate(module, imports);
775
+
776
+ if (instance instanceof WebAssembly.Instance) {
777
+ return { instance, module };
778
+ } else {
779
+ return instance;
780
+ }
781
+ }
782
+ }
783
+
784
+ function __wbg_get_imports() {
785
+ const imports = {};
786
+ imports.wbg = {};
787
+ imports.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
788
+ const ret = wasm.memory;
789
+ return ret;
790
+ };
791
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
792
+ throw new Error(getStringFromWasm0(arg0, arg1));
793
+ };
794
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
795
+ let deferred0_0;
796
+ let deferred0_1;
797
+ try {
798
+ deferred0_0 = arg0;
799
+ deferred0_1 = arg1;
800
+ console.error(getStringFromWasm0(arg0, arg1));
801
+ } finally {
802
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
803
+ }
804
+ };
805
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
806
+ const ret = new Error();
807
+ return ret;
808
+ };
809
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
810
+ const ret = arg1.stack;
811
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
812
+ const len1 = WASM_VECTOR_LEN;
813
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
814
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
815
+ };
816
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
817
+ // Cast intrinsic for `Ref(String) -> Externref`.
818
+ const ret = getStringFromWasm0(arg0, arg1);
819
+ return ret;
820
+ };
821
+ imports.wbg.__wbindgen_init_externref_table = function() {
822
+ const table = wasm.__wbindgen_externrefs;
823
+ const offset = table.grow(4);
824
+ table.set(0, undefined);
825
+ table.set(offset + 0, undefined);
826
+ table.set(offset + 1, null);
827
+ table.set(offset + 2, true);
828
+ table.set(offset + 3, false);
829
+ };
830
+
831
+ return imports;
832
+ }
833
+
834
+ function __wbg_finalize_init(instance, module) {
835
+ wasm = instance.exports;
836
+ __wbg_init.__wbindgen_wasm_module = module;
837
+ cachedDataViewMemory0 = null;
838
+ cachedUint32ArrayMemory0 = null;
839
+ cachedUint8ArrayMemory0 = null;
840
+
841
+
842
+ wasm.__wbindgen_start();
843
+ return wasm;
844
+ }
845
+
846
+ function initSync(module) {
847
+ if (wasm !== undefined) return wasm;
848
+
849
+
850
+ if (typeof module !== 'undefined') {
851
+ if (Object.getPrototypeOf(module) === Object.prototype) {
852
+ ({module} = module)
853
+ } else {
854
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
855
+ }
856
+ }
857
+
858
+ const imports = __wbg_get_imports();
859
+ if (!(module instanceof WebAssembly.Module)) {
860
+ module = new WebAssembly.Module(module);
861
+ }
862
+ const instance = new WebAssembly.Instance(module, imports);
863
+ return __wbg_finalize_init(instance, module);
864
+ }
865
+
866
+ async function __wbg_init(module_or_path) {
867
+ if (wasm !== undefined) return wasm;
868
+
869
+
870
+ if (typeof module_or_path !== 'undefined') {
871
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
872
+ ({module_or_path} = module_or_path)
873
+ } else {
874
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
875
+ }
876
+ }
877
+
878
+ if (typeof module_or_path === 'undefined') {
879
+ module_or_path = new URL('renderart_wasm_bg.wasm', import.meta.url);
880
+ }
881
+ const imports = __wbg_get_imports();
882
+
883
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
884
+ module_or_path = fetch(module_or_path);
885
+ }
886
+
887
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
888
+
889
+ return __wbg_finalize_init(instance, module);
890
+ }
891
+
892
+ export { initSync };
893
+ export default __wbg_init;