rust-editor 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rust-editor",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "files": [
6
6
  "rust_editor_bg.wasm",
7
7
  "rust_editor.js",
package/rust_editor.d.ts CHANGED
@@ -10,7 +10,8 @@ export function switch_color(image_source: Uint8Array, image_reference: Uint8Arr
10
10
  export function blur(image_data: Uint8Array, radius: number): Uint8Array;
11
11
  export function sharpen(image_data: Uint8Array, radius: number): Uint8Array;
12
12
  export function fix_size_image(image_data: Uint8Array): Uint8Array;
13
- export function coloring_grayscale(image_source: Uint8Array, image_reference: Uint8Array): void;
13
+ export function grayscale_image(image_data: Uint8Array): Uint8Array;
14
+ export function adjust_saturation_image(image_data: Uint8Array, saturation: number): Uint8Array;
14
15
 
15
16
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
16
17
 
@@ -26,7 +27,8 @@ export interface InitOutput {
26
27
  readonly blur: (a: number, b: number, c: number) => [number, number];
27
28
  readonly sharpen: (a: number, b: number, c: number) => [number, number];
28
29
  readonly fix_size_image: (a: number, b: number) => [number, number];
29
- readonly coloring_grayscale: (a: number, b: number, c: number, d: number) => void;
30
+ readonly grayscale_image: (a: number, b: number) => [number, number];
31
+ readonly adjust_saturation_image: (a: number, b: number, c: number) => [number, number];
30
32
  readonly __wbindgen_export_0: WebAssembly.Table;
31
33
  readonly __wbindgen_malloc: (a: number, b: number) => number;
32
34
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
package/rust_editor.js CHANGED
@@ -182,15 +182,30 @@ export function fix_size_image(image_data) {
182
182
  }
183
183
 
184
184
  /**
185
- * @param {Uint8Array} image_source
186
- * @param {Uint8Array} image_reference
185
+ * @param {Uint8Array} image_data
186
+ * @returns {Uint8Array}
187
187
  */
188
- export function coloring_grayscale(image_source, image_reference) {
189
- const ptr0 = passArray8ToWasm0(image_source, wasm.__wbindgen_malloc);
188
+ export function grayscale_image(image_data) {
189
+ const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
190
190
  const len0 = WASM_VECTOR_LEN;
191
- const ptr1 = passArray8ToWasm0(image_reference, wasm.__wbindgen_malloc);
192
- const len1 = WASM_VECTOR_LEN;
193
- wasm.coloring_grayscale(ptr0, len0, ptr1, len1);
191
+ const ret = wasm.grayscale_image(ptr0, len0);
192
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
193
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
194
+ return v2;
195
+ }
196
+
197
+ /**
198
+ * @param {Uint8Array} image_data
199
+ * @param {number} saturation
200
+ * @returns {Uint8Array}
201
+ */
202
+ export function adjust_saturation_image(image_data, saturation) {
203
+ const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
204
+ const len0 = WASM_VECTOR_LEN;
205
+ const ret = wasm.adjust_saturation_image(ptr0, len0, saturation);
206
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
207
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
208
+ return v2;
194
209
  }
195
210
 
196
211
  async function __wbg_load(module, imports) {
Binary file