rust-editor 0.1.7 → 0.1.8

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.7",
4
+ "version": "0.1.8",
5
5
  "files": [
6
6
  "rust_editor_bg.wasm",
7
7
  "rust_editor.js",
package/rust_editor.d.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function resize(image_data: Uint8Array, height: number, width: number): Uint8Array;
4
- export function resize_exact(image_data: Uint8Array, width: number, height: number): Uint8Array;
5
- export function resize_one_side(image_data: Uint8Array, width: number, height: number): Uint8Array;
6
- export function crop(image_data: Uint8Array, x: number, y: number, width: number, height: number): Uint8Array;
7
- export function change_scale_image(image_data: Uint8Array, scale: number): Uint8Array;
8
3
  export function get_size(image_data: Uint8Array): Uint32Array;
9
4
  export function switch_color(image_source: Uint8Array, image_reference: Uint8Array): Uint8Array;
10
5
  export function blur(image_data: Uint8Array, radius: number): Uint8Array;
@@ -12,20 +7,15 @@ export function sharpen(image_data: Uint8Array, radius: number): Uint8Array;
12
7
  export function fix_size_image(image_data: Uint8Array): Uint8Array;
13
8
  export function grayscale_image(image_data: Uint8Array): Uint8Array;
14
9
  export function adjust_saturation_image(image_data: Uint8Array, saturation: number): Uint8Array;
15
- export function adjust_exposure_image(image_data: Uint8Array, exposure: number): Uint8Array;
16
- export function adjust_contrasts_image(image_data: Uint8Array, contrasts: number): Uint8Array;
17
10
  export function adjust_temperature_image(image_data: Uint8Array, temperature: number): Uint8Array;
18
11
  export function adjust_tint_image(image_data: Uint8Array, tint: number): Uint8Array;
12
+ export function adjust_exposure_image(image_data: Uint8Array, exposure: number): Uint8Array;
13
+ export function adjust_contrasts_image(image_data: Uint8Array, contrasts: number): Uint8Array;
19
14
 
20
15
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
21
16
 
22
17
  export interface InitOutput {
23
18
  readonly memory: WebAssembly.Memory;
24
- readonly resize: (a: number, b: number, c: number, d: number) => [number, number];
25
- readonly resize_exact: (a: number, b: number, c: number, d: number) => [number, number];
26
- readonly resize_one_side: (a: number, b: number, c: number, d: number) => [number, number];
27
- readonly crop: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
28
- readonly change_scale_image: (a: number, b: number, c: number) => [number, number];
29
19
  readonly get_size: (a: number, b: number) => [number, number];
30
20
  readonly switch_color: (a: number, b: number, c: number, d: number) => [number, number];
31
21
  readonly blur: (a: number, b: number, c: number) => [number, number];
@@ -33,10 +23,10 @@ export interface InitOutput {
33
23
  readonly fix_size_image: (a: number, b: number) => [number, number];
34
24
  readonly grayscale_image: (a: number, b: number) => [number, number];
35
25
  readonly adjust_saturation_image: (a: number, b: number, c: number) => [number, number];
36
- readonly adjust_exposure_image: (a: number, b: number, c: number) => [number, number];
37
- readonly adjust_contrasts_image: (a: number, b: number, c: number) => [number, number];
38
26
  readonly adjust_temperature_image: (a: number, b: number, c: number) => [number, number];
39
27
  readonly adjust_tint_image: (a: number, b: number, c: number) => [number, number];
28
+ readonly adjust_exposure_image: (a: number, b: number, c: number) => [number, number];
29
+ readonly adjust_contrasts_image: (a: number, b: number, c: number) => [number, number];
40
30
  readonly __wbindgen_export_0: WebAssembly.Table;
41
31
  readonly __wbindgen_malloc: (a: number, b: number) => number;
42
32
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
package/rust_editor.js CHANGED
@@ -18,86 +18,6 @@ function passArray8ToWasm0(arg, malloc) {
18
18
  return ptr;
19
19
  }
20
20
 
21
- function getArrayU8FromWasm0(ptr, len) {
22
- ptr = ptr >>> 0;
23
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
24
- }
25
- /**
26
- * @param {Uint8Array} image_data
27
- * @param {number} height
28
- * @param {number} width
29
- * @returns {Uint8Array}
30
- */
31
- export function resize(image_data, height, width) {
32
- const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
33
- const len0 = WASM_VECTOR_LEN;
34
- const ret = wasm.resize(ptr0, len0, height, width);
35
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
36
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
37
- return v2;
38
- }
39
-
40
- /**
41
- * @param {Uint8Array} image_data
42
- * @param {number} width
43
- * @param {number} height
44
- * @returns {Uint8Array}
45
- */
46
- export function resize_exact(image_data, width, height) {
47
- const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
48
- const len0 = WASM_VECTOR_LEN;
49
- const ret = wasm.resize_exact(ptr0, len0, width, height);
50
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
51
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
52
- return v2;
53
- }
54
-
55
- /**
56
- * @param {Uint8Array} image_data
57
- * @param {number} width
58
- * @param {number} height
59
- * @returns {Uint8Array}
60
- */
61
- export function resize_one_side(image_data, width, height) {
62
- const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
63
- const len0 = WASM_VECTOR_LEN;
64
- const ret = wasm.resize_one_side(ptr0, len0, width, height);
65
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
66
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
67
- return v2;
68
- }
69
-
70
- /**
71
- * @param {Uint8Array} image_data
72
- * @param {number} x
73
- * @param {number} y
74
- * @param {number} width
75
- * @param {number} height
76
- * @returns {Uint8Array}
77
- */
78
- export function crop(image_data, x, y, width, height) {
79
- const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
80
- const len0 = WASM_VECTOR_LEN;
81
- const ret = wasm.crop(ptr0, len0, x, y, width, height);
82
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
83
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
84
- return v2;
85
- }
86
-
87
- /**
88
- * @param {Uint8Array} image_data
89
- * @param {number} scale
90
- * @returns {Uint8Array}
91
- */
92
- export function change_scale_image(image_data, scale) {
93
- const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
94
- const len0 = WASM_VECTOR_LEN;
95
- const ret = wasm.change_scale_image(ptr0, len0, scale);
96
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
97
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
98
- return v2;
99
- }
100
-
101
21
  let cachedUint32ArrayMemory0 = null;
102
22
 
103
23
  function getUint32ArrayMemory0() {
@@ -124,6 +44,10 @@ export function get_size(image_data) {
124
44
  return v2;
125
45
  }
126
46
 
47
+ function getArrayU8FromWasm0(ptr, len) {
48
+ ptr = ptr >>> 0;
49
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
50
+ }
127
51
  /**
128
52
  * @param {Uint8Array} image_source
129
53
  * @param {Uint8Array} image_reference
@@ -210,13 +134,13 @@ export function adjust_saturation_image(image_data, saturation) {
210
134
 
211
135
  /**
212
136
  * @param {Uint8Array} image_data
213
- * @param {number} exposure
137
+ * @param {number} temperature
214
138
  * @returns {Uint8Array}
215
139
  */
216
- export function adjust_exposure_image(image_data, exposure) {
140
+ export function adjust_temperature_image(image_data, temperature) {
217
141
  const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
218
142
  const len0 = WASM_VECTOR_LEN;
219
- const ret = wasm.adjust_exposure_image(ptr0, len0, exposure);
143
+ const ret = wasm.adjust_temperature_image(ptr0, len0, temperature);
220
144
  var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
221
145
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
222
146
  return v2;
@@ -224,13 +148,13 @@ export function adjust_exposure_image(image_data, exposure) {
224
148
 
225
149
  /**
226
150
  * @param {Uint8Array} image_data
227
- * @param {number} contrasts
151
+ * @param {number} tint
228
152
  * @returns {Uint8Array}
229
153
  */
230
- export function adjust_contrasts_image(image_data, contrasts) {
154
+ export function adjust_tint_image(image_data, tint) {
231
155
  const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
232
156
  const len0 = WASM_VECTOR_LEN;
233
- const ret = wasm.adjust_contrasts_image(ptr0, len0, contrasts);
157
+ const ret = wasm.adjust_tint_image(ptr0, len0, tint);
234
158
  var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
235
159
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
236
160
  return v2;
@@ -238,13 +162,13 @@ export function adjust_contrasts_image(image_data, contrasts) {
238
162
 
239
163
  /**
240
164
  * @param {Uint8Array} image_data
241
- * @param {number} temperature
165
+ * @param {number} exposure
242
166
  * @returns {Uint8Array}
243
167
  */
244
- export function adjust_temperature_image(image_data, temperature) {
168
+ export function adjust_exposure_image(image_data, exposure) {
245
169
  const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
246
170
  const len0 = WASM_VECTOR_LEN;
247
- const ret = wasm.adjust_temperature_image(ptr0, len0, temperature);
171
+ const ret = wasm.adjust_exposure_image(ptr0, len0, exposure);
248
172
  var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
249
173
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
250
174
  return v2;
@@ -252,13 +176,13 @@ export function adjust_temperature_image(image_data, temperature) {
252
176
 
253
177
  /**
254
178
  * @param {Uint8Array} image_data
255
- * @param {number} tint
179
+ * @param {number} contrasts
256
180
  * @returns {Uint8Array}
257
181
  */
258
- export function adjust_tint_image(image_data, tint) {
182
+ export function adjust_contrasts_image(image_data, contrasts) {
259
183
  const ptr0 = passArray8ToWasm0(image_data, wasm.__wbindgen_malloc);
260
184
  const len0 = WASM_VECTOR_LEN;
261
- const ret = wasm.adjust_tint_image(ptr0, len0, tint);
185
+ const ret = wasm.adjust_contrasts_image(ptr0, len0, contrasts);
262
186
  var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
263
187
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
264
188
  return v2;
Binary file