rust-editor 0.2.3 → 0.2.4
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/package.json +1 -1
- package/rust_editor.d.ts +44 -2
- package/rust_editor.js +266 -7
- package/rust_editor_bg.wasm +0 -0
package/package.json
CHANGED
package/rust_editor.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function get_image_size_gpu(image_data: Uint8Array): Promise<Uint32Array>;
|
|
3
4
|
export function get_size(image_data: Uint8Array): Uint32Array;
|
|
5
|
+
export function get_size_gpu_async(image_data: Uint8Array): Promise<Uint32Array>;
|
|
4
6
|
export function switch_color(image_source: Uint8Array, image_reference: Uint8Array): Uint8Array;
|
|
5
7
|
export function blur(image_data: Uint8Array, radius: number): Uint8Array;
|
|
6
8
|
export function sharpen(image_data: Uint8Array, radius: number): Uint8Array;
|
|
@@ -13,12 +15,47 @@ export function adjust_exposure_image(image_data: Uint8Array, exposure: number):
|
|
|
13
15
|
export function adjust_contrasts_image(image_data: Uint8Array, contrasts: number): Uint8Array;
|
|
14
16
|
export function adjust_color_image(image_data: Uint8Array, saturation: number, temperature: number, tint: number): Uint8Array;
|
|
15
17
|
export function adjust_light_image(image_data: Uint8Array, contrasts: number, exposure: number): Uint8Array;
|
|
18
|
+
/**
|
|
19
|
+
* Chroma subsampling format
|
|
20
|
+
*/
|
|
21
|
+
export enum ChromaSampling {
|
|
22
|
+
/**
|
|
23
|
+
* Both vertically and horizontally subsampled.
|
|
24
|
+
*/
|
|
25
|
+
Cs420 = 0,
|
|
26
|
+
/**
|
|
27
|
+
* Horizontally subsampled.
|
|
28
|
+
*/
|
|
29
|
+
Cs422 = 1,
|
|
30
|
+
/**
|
|
31
|
+
* Not subsampled.
|
|
32
|
+
*/
|
|
33
|
+
Cs444 = 2,
|
|
34
|
+
/**
|
|
35
|
+
* Monochrome.
|
|
36
|
+
*/
|
|
37
|
+
Cs400 = 3,
|
|
38
|
+
}
|
|
39
|
+
export class GpuImageProcessor {
|
|
40
|
+
free(): void;
|
|
41
|
+
constructor();
|
|
42
|
+
init(): Promise<void>;
|
|
43
|
+
get_image_size(image_data: Uint8Array): Promise<Uint32Array>;
|
|
44
|
+
is_gpu_available(): boolean;
|
|
45
|
+
}
|
|
16
46
|
|
|
17
47
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
18
48
|
|
|
19
49
|
export interface InitOutput {
|
|
20
50
|
readonly memory: WebAssembly.Memory;
|
|
51
|
+
readonly __wbg_gpuimageprocessor_free: (a: number, b: number) => void;
|
|
52
|
+
readonly gpuimageprocessor_new: () => number;
|
|
53
|
+
readonly gpuimageprocessor_init: (a: number) => any;
|
|
54
|
+
readonly gpuimageprocessor_get_image_size: (a: number, b: number, c: number) => any;
|
|
55
|
+
readonly gpuimageprocessor_is_gpu_available: (a: number) => number;
|
|
56
|
+
readonly get_image_size_gpu: (a: number, b: number) => any;
|
|
21
57
|
readonly get_size: (a: number, b: number) => [number, number];
|
|
58
|
+
readonly get_size_gpu_async: (a: number, b: number) => any;
|
|
22
59
|
readonly switch_color: (a: number, b: number, c: number, d: number) => [number, number];
|
|
23
60
|
readonly blur: (a: number, b: number, c: number) => [number, number];
|
|
24
61
|
readonly sharpen: (a: number, b: number, c: number) => [number, number];
|
|
@@ -31,9 +68,14 @@ export interface InitOutput {
|
|
|
31
68
|
readonly adjust_contrasts_image: (a: number, b: number, c: number) => [number, number];
|
|
32
69
|
readonly adjust_color_image: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
33
70
|
readonly adjust_light_image: (a: number, b: number, c: number, d: number) => [number, number];
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
71
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
72
|
+
readonly __externref_table_alloc: () => number;
|
|
73
|
+
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
74
|
+
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
36
75
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
76
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
77
|
+
readonly closure195_externref_shim: (a: number, b: number, c: any) => void;
|
|
78
|
+
readonly closure170_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
37
79
|
readonly __wbindgen_start: () => void;
|
|
38
80
|
}
|
|
39
81
|
|
package/rust_editor.js
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function handleError(f, args) {
|
|
10
|
+
try {
|
|
11
|
+
return f.apply(this, args);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
const idx = addToExternrefTable0(e);
|
|
14
|
+
wasm.__wbindgen_exn_store(idx);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
19
|
+
|
|
20
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
21
|
+
|
|
3
22
|
let cachedUint8ArrayMemory0 = null;
|
|
4
23
|
|
|
5
24
|
function getUint8ArrayMemory0() {
|
|
@@ -9,13 +28,44 @@ function getUint8ArrayMemory0() {
|
|
|
9
28
|
return cachedUint8ArrayMemory0;
|
|
10
29
|
}
|
|
11
30
|
|
|
12
|
-
|
|
31
|
+
function getStringFromWasm0(ptr, len) {
|
|
32
|
+
ptr = ptr >>> 0;
|
|
33
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
34
|
+
}
|
|
13
35
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
function isLikeNone(x) {
|
|
37
|
+
return x === undefined || x === null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
41
|
+
? { register: () => {}, unregister: () => {} }
|
|
42
|
+
: new FinalizationRegistry(state => {
|
|
43
|
+
wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b)
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
47
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
48
|
+
const real = (...args) => {
|
|
49
|
+
// First up with a closure we increment the internal reference
|
|
50
|
+
// count. This ensures that the Rust closure environment won't
|
|
51
|
+
// be deallocated while we're invoking it.
|
|
52
|
+
state.cnt++;
|
|
53
|
+
const a = state.a;
|
|
54
|
+
state.a = 0;
|
|
55
|
+
try {
|
|
56
|
+
return f(a, state.b, ...args);
|
|
57
|
+
} finally {
|
|
58
|
+
if (--state.cnt === 0) {
|
|
59
|
+
wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
|
|
60
|
+
CLOSURE_DTORS.unregister(state);
|
|
61
|
+
} else {
|
|
62
|
+
state.a = a;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
real.original = state;
|
|
67
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
68
|
+
return real;
|
|
19
69
|
}
|
|
20
70
|
|
|
21
71
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -31,6 +81,26 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
31
81
|
ptr = ptr >>> 0;
|
|
32
82
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
33
83
|
}
|
|
84
|
+
|
|
85
|
+
let WASM_VECTOR_LEN = 0;
|
|
86
|
+
|
|
87
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
88
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
89
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
90
|
+
WASM_VECTOR_LEN = arg.length;
|
|
91
|
+
return ptr;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @param {Uint8Array} image_data
|
|
95
|
+
* @returns {Promise<Uint32Array>}
|
|
96
|
+
*/
|
|
97
|
+
export function get_image_size_gpu(image_data) {
|
|
98
|
+
const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
|
|
99
|
+
const len0 = WASM_VECTOR_LEN;
|
|
100
|
+
const ret = wasm.get_image_size_gpu(ptr0, len0);
|
|
101
|
+
return ret;
|
|
102
|
+
}
|
|
103
|
+
|
|
34
104
|
/**
|
|
35
105
|
* @param {Uint8Array} image_data
|
|
36
106
|
* @returns {Uint32Array}
|
|
@@ -44,6 +114,17 @@ export function get_size(image_data) {
|
|
|
44
114
|
return v2;
|
|
45
115
|
}
|
|
46
116
|
|
|
117
|
+
/**
|
|
118
|
+
* @param {Uint8Array} image_data
|
|
119
|
+
* @returns {Promise<Uint32Array>}
|
|
120
|
+
*/
|
|
121
|
+
export function get_size_gpu_async(image_data) {
|
|
122
|
+
const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
|
|
123
|
+
const len0 = WASM_VECTOR_LEN;
|
|
124
|
+
const ret = wasm.get_size_gpu_async(ptr0, len0);
|
|
125
|
+
return ret;
|
|
126
|
+
}
|
|
127
|
+
|
|
47
128
|
function getArrayU8FromWasm0(ptr, len) {
|
|
48
129
|
ptr = ptr >>> 0;
|
|
49
130
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -219,6 +300,86 @@ export function adjust_light_image(image_data, contrasts, exposure) {
|
|
|
219
300
|
return v2;
|
|
220
301
|
}
|
|
221
302
|
|
|
303
|
+
function __wbg_adapter_20(arg0, arg1, arg2) {
|
|
304
|
+
wasm.closure195_externref_shim(arg0, arg1, arg2);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function __wbg_adapter_32(arg0, arg1, arg2, arg3) {
|
|
308
|
+
wasm.closure170_externref_shim(arg0, arg1, arg2, arg3);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Chroma subsampling format
|
|
313
|
+
* @enum {0 | 1 | 2 | 3}
|
|
314
|
+
*/
|
|
315
|
+
export const ChromaSampling = Object.freeze({
|
|
316
|
+
/**
|
|
317
|
+
* Both vertically and horizontally subsampled.
|
|
318
|
+
*/
|
|
319
|
+
Cs420: 0, "0": "Cs420",
|
|
320
|
+
/**
|
|
321
|
+
* Horizontally subsampled.
|
|
322
|
+
*/
|
|
323
|
+
Cs422: 1, "1": "Cs422",
|
|
324
|
+
/**
|
|
325
|
+
* Not subsampled.
|
|
326
|
+
*/
|
|
327
|
+
Cs444: 2, "2": "Cs444",
|
|
328
|
+
/**
|
|
329
|
+
* Monochrome.
|
|
330
|
+
*/
|
|
331
|
+
Cs400: 3, "3": "Cs400",
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
const GpuImageProcessorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
335
|
+
? { register: () => {}, unregister: () => {} }
|
|
336
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_gpuimageprocessor_free(ptr >>> 0, 1));
|
|
337
|
+
|
|
338
|
+
export class GpuImageProcessor {
|
|
339
|
+
|
|
340
|
+
__destroy_into_raw() {
|
|
341
|
+
const ptr = this.__wbg_ptr;
|
|
342
|
+
this.__wbg_ptr = 0;
|
|
343
|
+
GpuImageProcessorFinalization.unregister(this);
|
|
344
|
+
return ptr;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
free() {
|
|
348
|
+
const ptr = this.__destroy_into_raw();
|
|
349
|
+
wasm.__wbg_gpuimageprocessor_free(ptr, 0);
|
|
350
|
+
}
|
|
351
|
+
constructor() {
|
|
352
|
+
const ret = wasm.gpuimageprocessor_new();
|
|
353
|
+
this.__wbg_ptr = ret >>> 0;
|
|
354
|
+
GpuImageProcessorFinalization.register(this, this.__wbg_ptr, this);
|
|
355
|
+
return this;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* @returns {Promise<void>}
|
|
359
|
+
*/
|
|
360
|
+
init() {
|
|
361
|
+
const ret = wasm.gpuimageprocessor_init(this.__wbg_ptr);
|
|
362
|
+
return ret;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* @param {Uint8Array} image_data
|
|
366
|
+
* @returns {Promise<Uint32Array>}
|
|
367
|
+
*/
|
|
368
|
+
get_image_size(image_data) {
|
|
369
|
+
const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
|
|
370
|
+
const len0 = WASM_VECTOR_LEN;
|
|
371
|
+
const ret = wasm.gpuimageprocessor_get_image_size(this.__wbg_ptr, ptr0, len0);
|
|
372
|
+
return ret;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* @returns {boolean}
|
|
376
|
+
*/
|
|
377
|
+
is_gpu_available() {
|
|
378
|
+
const ret = wasm.gpuimageprocessor_is_gpu_available(this.__wbg_ptr);
|
|
379
|
+
return ret !== 0;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
222
383
|
async function __wbg_load(module, imports) {
|
|
223
384
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
224
385
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -253,8 +414,85 @@ async function __wbg_load(module, imports) {
|
|
|
253
414
|
function __wbg_get_imports() {
|
|
254
415
|
const imports = {};
|
|
255
416
|
imports.wbg = {};
|
|
417
|
+
imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
418
|
+
const ret = arg0.call(arg1);
|
|
419
|
+
return ret;
|
|
420
|
+
}, arguments) };
|
|
421
|
+
imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
422
|
+
const ret = arg0.call(arg1, arg2);
|
|
423
|
+
return ret;
|
|
424
|
+
}, arguments) };
|
|
425
|
+
imports.wbg.__wbg_log_c222819a41e063d3 = function(arg0) {
|
|
426
|
+
console.log(arg0);
|
|
427
|
+
};
|
|
428
|
+
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
429
|
+
try {
|
|
430
|
+
var state0 = {a: arg0, b: arg1};
|
|
431
|
+
var cb0 = (arg0, arg1) => {
|
|
432
|
+
const a = state0.a;
|
|
433
|
+
state0.a = 0;
|
|
434
|
+
try {
|
|
435
|
+
return __wbg_adapter_32(a, state0.b, arg0, arg1);
|
|
436
|
+
} finally {
|
|
437
|
+
state0.a = a;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
const ret = new Promise(cb0);
|
|
441
|
+
return ret;
|
|
442
|
+
} finally {
|
|
443
|
+
state0.a = state0.b = 0;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
447
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
448
|
+
return ret;
|
|
449
|
+
};
|
|
450
|
+
imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
|
|
451
|
+
queueMicrotask(arg0);
|
|
452
|
+
};
|
|
453
|
+
imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
|
|
454
|
+
const ret = arg0.queueMicrotask;
|
|
455
|
+
return ret;
|
|
456
|
+
};
|
|
457
|
+
imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
458
|
+
const ret = Promise.resolve(arg0);
|
|
459
|
+
return ret;
|
|
460
|
+
};
|
|
461
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
462
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
463
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
464
|
+
};
|
|
465
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
466
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
467
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
468
|
+
};
|
|
469
|
+
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
470
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
471
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
472
|
+
};
|
|
473
|
+
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
474
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
475
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
476
|
+
};
|
|
477
|
+
imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
|
|
478
|
+
const ret = arg0.then(arg1);
|
|
479
|
+
return ret;
|
|
480
|
+
};
|
|
481
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
482
|
+
const obj = arg0.original;
|
|
483
|
+
if (obj.cnt-- == 1) {
|
|
484
|
+
obj.a = 0;
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
const ret = false;
|
|
488
|
+
return ret;
|
|
489
|
+
};
|
|
490
|
+
imports.wbg.__wbindgen_closure_wrapper2139 = function(arg0, arg1, arg2) {
|
|
491
|
+
const ret = makeMutClosure(arg0, arg1, 196, __wbg_adapter_20);
|
|
492
|
+
return ret;
|
|
493
|
+
};
|
|
256
494
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
257
|
-
const table = wasm.
|
|
495
|
+
const table = wasm.__wbindgen_export_2;
|
|
258
496
|
const offset = table.grow(4);
|
|
259
497
|
table.set(0, undefined);
|
|
260
498
|
table.set(offset + 0, undefined);
|
|
@@ -263,6 +501,27 @@ function __wbg_get_imports() {
|
|
|
263
501
|
table.set(offset + 3, false);
|
|
264
502
|
;
|
|
265
503
|
};
|
|
504
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
505
|
+
const ret = typeof(arg0) === 'function';
|
|
506
|
+
return ret;
|
|
507
|
+
};
|
|
508
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
509
|
+
const ret = arg0 === undefined;
|
|
510
|
+
return ret;
|
|
511
|
+
};
|
|
512
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
513
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
514
|
+
return ret;
|
|
515
|
+
};
|
|
516
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
517
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
518
|
+
};
|
|
519
|
+
imports.wbg.__wbindgen_uint32_array_new = function(arg0, arg1) {
|
|
520
|
+
var v0 = getArrayU32FromWasm0(arg0, arg1).slice();
|
|
521
|
+
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
522
|
+
const ret = v0;
|
|
523
|
+
return ret;
|
|
524
|
+
};
|
|
266
525
|
|
|
267
526
|
return imports;
|
|
268
527
|
}
|
package/rust_editor_bg.wasm
CHANGED
|
Binary file
|