rust-editor 0.2.4 → 0.2.6
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 +2 -44
- package/rust_editor.js +7 -266
- package/rust_editor_bg.wasm +0 -0
package/package.json
CHANGED
package/rust_editor.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function get_image_size_gpu(image_data: Uint8Array): Promise<Uint32Array>;
|
|
4
3
|
export function get_size(image_data: Uint8Array): Uint32Array;
|
|
5
|
-
export function get_size_gpu_async(image_data: Uint8Array): Promise<Uint32Array>;
|
|
6
4
|
export function switch_color(image_source: Uint8Array, image_reference: Uint8Array): Uint8Array;
|
|
7
5
|
export function blur(image_data: Uint8Array, radius: number): Uint8Array;
|
|
8
6
|
export function sharpen(image_data: Uint8Array, radius: number): Uint8Array;
|
|
@@ -15,47 +13,12 @@ export function adjust_exposure_image(image_data: Uint8Array, exposure: number):
|
|
|
15
13
|
export function adjust_contrasts_image(image_data: Uint8Array, contrasts: number): Uint8Array;
|
|
16
14
|
export function adjust_color_image(image_data: Uint8Array, saturation: number, temperature: number, tint: number): Uint8Array;
|
|
17
15
|
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
|
-
}
|
|
46
16
|
|
|
47
17
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
48
18
|
|
|
49
19
|
export interface InitOutput {
|
|
50
20
|
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;
|
|
57
21
|
readonly get_size: (a: number, b: number) => [number, number];
|
|
58
|
-
readonly get_size_gpu_async: (a: number, b: number) => any;
|
|
59
22
|
readonly switch_color: (a: number, b: number, c: number, d: number) => [number, number];
|
|
60
23
|
readonly blur: (a: number, b: number, c: number) => [number, number];
|
|
61
24
|
readonly sharpen: (a: number, b: number, c: number) => [number, number];
|
|
@@ -68,14 +31,9 @@ export interface InitOutput {
|
|
|
68
31
|
readonly adjust_contrasts_image: (a: number, b: number, c: number) => [number, number];
|
|
69
32
|
readonly adjust_color_image: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
70
33
|
readonly adjust_light_image: (a: number, b: number, c: number, d: number) => [number, number];
|
|
71
|
-
readonly
|
|
72
|
-
readonly __externref_table_alloc: () => number;
|
|
73
|
-
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
74
|
-
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
75
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
34
|
+
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
76
35
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
77
|
-
readonly
|
|
78
|
-
readonly closure170_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
36
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
79
37
|
readonly __wbindgen_start: () => void;
|
|
80
38
|
}
|
|
81
39
|
|
package/rust_editor.js
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
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
|
-
|
|
22
3
|
let cachedUint8ArrayMemory0 = null;
|
|
23
4
|
|
|
24
5
|
function getUint8ArrayMemory0() {
|
|
@@ -28,44 +9,13 @@ function getUint8ArrayMemory0() {
|
|
|
28
9
|
return cachedUint8ArrayMemory0;
|
|
29
10
|
}
|
|
30
11
|
|
|
31
|
-
|
|
32
|
-
ptr = ptr >>> 0;
|
|
33
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function isLikeNone(x) {
|
|
37
|
-
return x === undefined || x === null;
|
|
38
|
-
}
|
|
12
|
+
let WASM_VECTOR_LEN = 0;
|
|
39
13
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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;
|
|
14
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
15
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
16
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
17
|
+
WASM_VECTOR_LEN = arg.length;
|
|
18
|
+
return ptr;
|
|
69
19
|
}
|
|
70
20
|
|
|
71
21
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -81,26 +31,6 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
81
31
|
ptr = ptr >>> 0;
|
|
82
32
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
83
33
|
}
|
|
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
|
-
|
|
104
34
|
/**
|
|
105
35
|
* @param {Uint8Array} image_data
|
|
106
36
|
* @returns {Uint32Array}
|
|
@@ -114,17 +44,6 @@ export function get_size(image_data) {
|
|
|
114
44
|
return v2;
|
|
115
45
|
}
|
|
116
46
|
|
|
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
|
-
|
|
128
47
|
function getArrayU8FromWasm0(ptr, len) {
|
|
129
48
|
ptr = ptr >>> 0;
|
|
130
49
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -300,86 +219,6 @@ export function adjust_light_image(image_data, contrasts, exposure) {
|
|
|
300
219
|
return v2;
|
|
301
220
|
}
|
|
302
221
|
|
|
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
|
-
|
|
383
222
|
async function __wbg_load(module, imports) {
|
|
384
223
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
385
224
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -414,85 +253,8 @@ async function __wbg_load(module, imports) {
|
|
|
414
253
|
function __wbg_get_imports() {
|
|
415
254
|
const imports = {};
|
|
416
255
|
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
|
-
};
|
|
494
256
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
495
|
-
const table = wasm.
|
|
257
|
+
const table = wasm.__wbindgen_export_0;
|
|
496
258
|
const offset = table.grow(4);
|
|
497
259
|
table.set(0, undefined);
|
|
498
260
|
table.set(offset + 0, undefined);
|
|
@@ -501,27 +263,6 @@ function __wbg_get_imports() {
|
|
|
501
263
|
table.set(offset + 3, false);
|
|
502
264
|
;
|
|
503
265
|
};
|
|
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
|
-
};
|
|
525
266
|
|
|
526
267
|
return imports;
|
|
527
268
|
}
|
package/rust_editor_bg.wasm
CHANGED
|
Binary file
|