@midscene/harmony-mcp 1.8.11 → 1.9.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.
package/dist/271.js DELETED
@@ -1,4295 +0,0 @@
1
- const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
2
- return typeof document === 'undefined'
3
- ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
4
- : (document.currentScript && document.currentScript.src) ||
5
- new URL('main.js', document.baseURI).href;
6
- })();
7
- exports.ids = ["271"];
8
- exports.modules = {
9
- "../../node_modules/.pnpm/@silvia-odwyer+photon-node@0.3.3/node_modules/@silvia-odwyer/photon-node/photon_rs.js"(module, __unused_rspack_exports, __webpack_require__) {
10
- let imports = {};
11
- imports['__wbindgen_placeholder__'] = module.exports;
12
- let wasm;
13
- const { TextEncoder, TextDecoder } = __webpack_require__("util");
14
-
15
- const heap = new Array(32).fill(undefined);
16
-
17
- heap.push(undefined, null, true, false);
18
-
19
- function getObject(idx) { return heap[idx]; }
20
-
21
- let heap_next = heap.length;
22
-
23
- function dropObject(idx) {
24
- if (idx < 36) return;
25
- heap[idx] = heap_next;
26
- heap_next = idx;
27
- }
28
-
29
- function takeObject(idx) {
30
- const ret = getObject(idx);
31
- dropObject(idx);
32
- return ret;
33
- }
34
-
35
- function addHeapObject(obj) {
36
- if (heap_next === heap.length) heap.push(heap.length + 1);
37
- const idx = heap_next;
38
- heap_next = heap[idx];
39
-
40
- heap[idx] = obj;
41
- return idx;
42
- }
43
-
44
- function debugString(val) {
45
- // primitive types
46
- const type = typeof val;
47
- if (type == 'number' || type == 'boolean' || val == null) {
48
- return `${val}`;
49
- }
50
- if (type == 'string') {
51
- return `"${val}"`;
52
- }
53
- if (type == 'symbol') {
54
- const description = val.description;
55
- if (description == null) {
56
- return 'Symbol';
57
- } else {
58
- return `Symbol(${description})`;
59
- }
60
- }
61
- if (type == 'function') {
62
- const name = val.name;
63
- if (typeof name == 'string' && name.length > 0) {
64
- return `Function(${name})`;
65
- } else {
66
- return 'Function';
67
- }
68
- }
69
- // objects
70
- if (Array.isArray(val)) {
71
- const length = val.length;
72
- let debug = '[';
73
- if (length > 0) {
74
- debug += debugString(val[0]);
75
- }
76
- for(let i = 1; i < length; i++) {
77
- debug += ', ' + debugString(val[i]);
78
- }
79
- debug += ']';
80
- return debug;
81
- }
82
- // Test for built-in
83
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
84
- let className;
85
- if (builtInMatches.length > 1) {
86
- className = builtInMatches[1];
87
- } else {
88
- // Failed to match the standard '[object ClassName]'
89
- return toString.call(val);
90
- }
91
- if (className == 'Object') {
92
- // we're a user defined class or Object
93
- // JSON.stringify avoids problems with cycles, and is generally much
94
- // easier than looping through ownProperties of `val`.
95
- try {
96
- return 'Object(' + JSON.stringify(val) + ')';
97
- } catch (_) {
98
- return 'Object';
99
- }
100
- }
101
- // errors
102
- if (val instanceof Error) {
103
- return `${val.name}: ${val.message}\n${val.stack}`;
104
- }
105
- // TODO we could test for more things here, like `Set`s and `Map`s.
106
- return className;
107
- }
108
-
109
- let WASM_VECTOR_LEN = 0;
110
-
111
- let cachegetUint8Memory0 = null;
112
- function getUint8Memory0() {
113
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
114
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
115
- }
116
- return cachegetUint8Memory0;
117
- }
118
-
119
- let cachedTextEncoder = new TextEncoder('utf-8');
120
-
121
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
122
- ? function (arg, view) {
123
- return cachedTextEncoder.encodeInto(arg, view);
124
- }
125
- : function (arg, view) {
126
- const buf = cachedTextEncoder.encode(arg);
127
- view.set(buf);
128
- return {
129
- read: arg.length,
130
- written: buf.length
131
- };
132
- });
133
-
134
- function passStringToWasm0(arg, malloc, realloc) {
135
-
136
- if (realloc === undefined) {
137
- const buf = cachedTextEncoder.encode(arg);
138
- const ptr = malloc(buf.length);
139
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
140
- WASM_VECTOR_LEN = buf.length;
141
- return ptr;
142
- }
143
-
144
- let len = arg.length;
145
- let ptr = malloc(len);
146
-
147
- const mem = getUint8Memory0();
148
-
149
- let offset = 0;
150
-
151
- for (; offset < len; offset++) {
152
- const code = arg.charCodeAt(offset);
153
- if (code > 0x7F) break;
154
- mem[ptr + offset] = code;
155
- }
156
-
157
- if (offset !== len) {
158
- if (offset !== 0) {
159
- arg = arg.slice(offset);
160
- }
161
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
162
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
163
- const ret = encodeString(arg, view);
164
-
165
- offset += ret.written;
166
- }
167
-
168
- WASM_VECTOR_LEN = offset;
169
- return ptr;
170
- }
171
-
172
- let cachegetInt32Memory0 = null;
173
- function getInt32Memory0() {
174
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
175
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
176
- }
177
- return cachegetInt32Memory0;
178
- }
179
-
180
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
181
-
182
- cachedTextDecoder.decode();
183
-
184
- function getStringFromWasm0(ptr, len) {
185
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
186
- }
187
-
188
- function _assertClass(instance, klass) {
189
- if (!(instance instanceof klass)) {
190
- throw new Error(`expected instance of ${klass.name}`);
191
- }
192
- return instance.ptr;
193
- }
194
- /**
195
- * Crop an image.
196
- *
197
- * # Arguments
198
- * * `img` - A PhotonImage.
199
- *
200
- * # Example
201
- *
202
- * ```no_run
203
- * // For example, to crop an image at (0, 0) to (500, 800)
204
- * use photon_rs::native::{open_image};
205
- * use photon_rs::transform::crop;
206
- * use photon_rs::PhotonImage;
207
- *
208
- * let mut img = open_image("img.jpg").expect("File should open");
209
- * let cropped_img: PhotonImage = crop(&mut img, 0_u32, 0_u32, 500_u32, 800_u32);
210
- * // Write the contents of this image in JPG format.
211
- * ```
212
- * @param {PhotonImage} photon_image
213
- * @param {number} x1
214
- * @param {number} y1
215
- * @param {number} x2
216
- * @param {number} y2
217
- * @returns {PhotonImage}
218
- */
219
- module.exports.crop = function(photon_image, x1, y1, x2, y2) {
220
- _assertClass(photon_image, PhotonImage);
221
- var ret = wasm.crop(photon_image.ptr, x1, y1, x2, y2);
222
- return PhotonImage.__wrap(ret);
223
- };
224
-
225
- /**
226
- * @param {HTMLCanvasElement} source_canvas
227
- * @param {number} width
228
- * @param {number} height
229
- * @param {number} left
230
- * @param {number} top
231
- * @returns {HTMLCanvasElement}
232
- */
233
- module.exports.crop_img_browser = function(source_canvas, width, height, left, top) {
234
- var ret = wasm.crop_img_browser(addHeapObject(source_canvas), width, height, left, top);
235
- return takeObject(ret);
236
- };
237
-
238
- /**
239
- * Flip an image horizontally.
240
- *
241
- * # Arguments
242
- * * `img` - A PhotonImage.
243
- *
244
- * # Example
245
- *
246
- * ```no_run
247
- * // For example, to flip an image horizontally:
248
- * use photon_rs::native::open_image;
249
- * use photon_rs::transform::fliph;
250
- *
251
- * let mut img = open_image("img.jpg").expect("File should open");
252
- * fliph(&mut img);
253
- * ```
254
- * @param {PhotonImage} photon_image
255
- */
256
- module.exports.fliph = function(photon_image) {
257
- _assertClass(photon_image, PhotonImage);
258
- wasm.fliph(photon_image.ptr);
259
- };
260
-
261
- /**
262
- * Flip an image vertically.
263
- *
264
- * # Arguments
265
- * * `img` - A PhotonImage.
266
- *
267
- * # Example
268
- *
269
- * ```no_run
270
- * // For example, to flip an image vertically:
271
- * use photon_rs::native::open_image;
272
- * use photon_rs::transform::flipv;
273
- *
274
- * let mut img = open_image("img.jpg").expect("File should open");
275
- * flipv(&mut img);
276
- * ```
277
- * @param {PhotonImage} photon_image
278
- */
279
- module.exports.flipv = function(photon_image) {
280
- _assertClass(photon_image, PhotonImage);
281
- wasm.flipv(photon_image.ptr);
282
- };
283
-
284
- /**
285
- * Resize an image on the web.
286
- *
287
- * # Arguments
288
- * * `img` - A PhotonImage.
289
- * * `width` - New width.
290
- * * `height` - New height.
291
- * * `sampling_filter` - Nearest = 1, Triangle = 2, CatmullRom = 3, Gaussian = 4, Lanczos3 = 5
292
- * @param {PhotonImage} photon_img
293
- * @param {number} width
294
- * @param {number} height
295
- * @param {number} sampling_filter
296
- * @returns {HTMLCanvasElement}
297
- */
298
- module.exports.resize_img_browser = function(photon_img, width, height, sampling_filter) {
299
- _assertClass(photon_img, PhotonImage);
300
- var ret = wasm.resize_img_browser(photon_img.ptr, width, height, sampling_filter);
301
- return takeObject(ret);
302
- };
303
-
304
- /**
305
- * Resize an image.
306
- *
307
- * # Arguments
308
- * * `img` - A PhotonImage.
309
- * * `width` - New width.
310
- * * `height` - New height.
311
- * * `sampling_filter` - Nearest = 1, Triangle = 2, CatmullRom = 3, Gaussian = 4, Lanczos3 = 5
312
- * @param {PhotonImage} photon_img
313
- * @param {number} width
314
- * @param {number} height
315
- * @param {number} sampling_filter
316
- * @returns {PhotonImage}
317
- */
318
- module.exports.resize = function(photon_img, width, height, sampling_filter) {
319
- _assertClass(photon_img, PhotonImage);
320
- var ret = wasm.resize(photon_img.ptr, width, height, sampling_filter);
321
- return PhotonImage.__wrap(ret);
322
- };
323
-
324
- /**
325
- * Resize image using seam carver.
326
- * Resize only if new dimensions are smaller, than original image.
327
- * # NOTE: This is still experimental feature, and pretty slow.
328
- *
329
- * # Arguments
330
- * * `img` - A PhotonImage.
331
- * * `width` - New width.
332
- * * `height` - New height.
333
- *
334
- * # Example
335
- *
336
- * ```no_run
337
- * // For example, resize image using seam carver:
338
- * use photon_rs::native::open_image;
339
- * use photon_rs::transform::seam_carve;
340
- * use photon_rs::PhotonImage;
341
- *
342
- * let img = open_image("img.jpg").expect("File should open");
343
- * let result: PhotonImage = seam_carve(&img, 100_u32, 100_u32);
344
- * ```
345
- * @param {PhotonImage} img
346
- * @param {number} width
347
- * @param {number} height
348
- * @returns {PhotonImage}
349
- */
350
- module.exports.seam_carve = function(img, width, height) {
351
- _assertClass(img, PhotonImage);
352
- var ret = wasm.seam_carve(img.ptr, width, height);
353
- return PhotonImage.__wrap(ret);
354
- };
355
-
356
- /**
357
- * Apply uniform padding around the PhotonImage
358
- * A padded PhotonImage is returned.
359
- * # Arguments
360
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
361
- * * `padding` - The amount of padding to be applied to the PhotonImage.
362
- * * `padding_rgba` - Tuple containing the RGBA code for padding color.
363
- *
364
- * # Example
365
- *
366
- * ```no_run
367
- * // For example, to apply a padding of 10 pixels around a PhotonImage:
368
- * use photon_rs::transform::padding_uniform;
369
- * use photon_rs::native::open_image;
370
- * use photon_rs::Rgba;
371
- *
372
- * let mut img = open_image("img.jpg").expect("File should open");
373
- * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
374
- * padding_uniform(&img, 10_u32, rgba);
375
- * ```
376
- * @param {PhotonImage} img
377
- * @param {number} padding
378
- * @param {Rgba} padding_rgba
379
- * @returns {PhotonImage}
380
- */
381
- module.exports.padding_uniform = function(img, padding, padding_rgba) {
382
- _assertClass(img, PhotonImage);
383
- _assertClass(padding_rgba, Rgba);
384
- var ptr0 = padding_rgba.ptr;
385
- padding_rgba.ptr = 0;
386
- var ret = wasm.padding_uniform(img.ptr, padding, ptr0);
387
- return PhotonImage.__wrap(ret);
388
- };
389
-
390
- /**
391
- * Apply padding on the left side of the PhotonImage
392
- * A padded PhotonImage is returned.
393
- * # Arguments
394
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
395
- * * `padding` - The amount of padding to be applied to the PhotonImage.
396
- * * `padding_rgba` - Tuple containing the RGBA code for padding color.
397
- *
398
- * # Example
399
- *
400
- * ```no_run
401
- * // For example, to apply a padding of 10 pixels on the left side of a PhotonImage:
402
- * use photon_rs::transform::padding_left;
403
- * use photon_rs::native::open_image;
404
- * use photon_rs::Rgba;
405
- *
406
- * let mut img = open_image("img.jpg").expect("File should open");
407
- * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
408
- * padding_left(&img, 10_u32, rgba);
409
- * ```
410
- * @param {PhotonImage} img
411
- * @param {number} padding
412
- * @param {Rgba} padding_rgba
413
- * @returns {PhotonImage}
414
- */
415
- module.exports.padding_left = function(img, padding, padding_rgba) {
416
- _assertClass(img, PhotonImage);
417
- _assertClass(padding_rgba, Rgba);
418
- var ptr0 = padding_rgba.ptr;
419
- padding_rgba.ptr = 0;
420
- var ret = wasm.padding_left(img.ptr, padding, ptr0);
421
- return PhotonImage.__wrap(ret);
422
- };
423
-
424
- /**
425
- * Apply padding on the left side of the PhotonImage
426
- * A padded PhotonImage is returned.
427
- * # Arguments
428
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
429
- * * `padding` - The amount of padding to be applied to the PhotonImage.
430
- * * `padding_rgba` - Tuple containing the RGBA code for padding color.
431
- *
432
- * # Example
433
- *
434
- * ```no_run
435
- * // For example, to apply a padding of 10 pixels on the right side of a PhotonImage:
436
- * use photon_rs::transform::padding_right;
437
- * use photon_rs::native::open_image;
438
- * use photon_rs::Rgba;
439
- *
440
- * let mut img = open_image("img.jpg").expect("File should open");
441
- * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
442
- * padding_right(&img, 10_u32, rgba);
443
- * ```
444
- * @param {PhotonImage} img
445
- * @param {number} padding
446
- * @param {Rgba} padding_rgba
447
- * @returns {PhotonImage}
448
- */
449
- module.exports.padding_right = function(img, padding, padding_rgba) {
450
- _assertClass(img, PhotonImage);
451
- _assertClass(padding_rgba, Rgba);
452
- var ptr0 = padding_rgba.ptr;
453
- padding_rgba.ptr = 0;
454
- var ret = wasm.padding_right(img.ptr, padding, ptr0);
455
- return PhotonImage.__wrap(ret);
456
- };
457
-
458
- /**
459
- * Apply padding on the left side of the PhotonImage
460
- * A padded PhotonImage is returned.
461
- * # Arguments
462
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
463
- * * `padding` - The amount of padding to be applied to the PhotonImage.
464
- * * `padding_rgba` - Tuple containing the RGBA code for padding color.
465
- *
466
- * # Example
467
- *
468
- * ```no_run
469
- * // For example, to apply a padding of 10 pixels on the top of a PhotonImage:
470
- * use photon_rs::transform::padding_top;
471
- * use photon_rs::native::open_image;
472
- * use photon_rs::Rgba;
473
- *
474
- * let mut img = open_image("img.jpg").expect("File should open");
475
- * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
476
- * padding_top(&img, 10_u32, rgba);
477
- * ```
478
- * @param {PhotonImage} img
479
- * @param {number} padding
480
- * @param {Rgba} padding_rgba
481
- * @returns {PhotonImage}
482
- */
483
- module.exports.padding_top = function(img, padding, padding_rgba) {
484
- _assertClass(img, PhotonImage);
485
- _assertClass(padding_rgba, Rgba);
486
- var ptr0 = padding_rgba.ptr;
487
- padding_rgba.ptr = 0;
488
- var ret = wasm.padding_top(img.ptr, padding, ptr0);
489
- return PhotonImage.__wrap(ret);
490
- };
491
-
492
- /**
493
- * Apply padding on the left side of the PhotonImage
494
- * A padded PhotonImage is returned.
495
- * # Arguments
496
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
497
- * * `padding` - The amount of padding to be applied to the PhotonImage.
498
- * * `padding_rgba` - Tuple containing the RGBA code for padding color.
499
- *
500
- * # Example
501
- *
502
- * ```no_run
503
- * // For example, to apply a padding of 10 pixels on the bottom of a PhotonImage:
504
- * use photon_rs::transform::padding_bottom;
505
- * use photon_rs::native::open_image;
506
- * use photon_rs::Rgba;
507
- *
508
- * let mut img = open_image("img.jpg").expect("File should open");
509
- * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
510
- * padding_bottom(&img, 10_u32, rgba);
511
- * ```
512
- * @param {PhotonImage} img
513
- * @param {number} padding
514
- * @param {Rgba} padding_rgba
515
- * @returns {PhotonImage}
516
- */
517
- module.exports.padding_bottom = function(img, padding, padding_rgba) {
518
- _assertClass(img, PhotonImage);
519
- _assertClass(padding_rgba, Rgba);
520
- var ptr0 = padding_rgba.ptr;
521
- padding_rgba.ptr = 0;
522
- var ret = wasm.padding_bottom(img.ptr, padding, ptr0);
523
- return PhotonImage.__wrap(ret);
524
- };
525
-
526
- /**
527
- * Rotate the PhotonImage on an arbitrary angle
528
- * A rotated PhotonImage is returned.
529
- * # NOTE: This is a naive implementation. Paeth rotation should be faster.
530
- *
531
- * # Arguments
532
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
533
- * * `angle` - Rotation angle in degrees.
534
- *
535
- * # Example
536
- *
537
- * ```no_run
538
- * // For example, to rotate a PhotonImage by 30 degrees:
539
- * use photon_rs::native::open_image;
540
- * use photon_rs::transform::rotate;
541
- *
542
- * let img = open_image("img.jpg").expect("File should open");
543
- * let rotated_img = rotate(&img, 30);
544
- * ```
545
- * @param {PhotonImage} img
546
- * @param {number} angle
547
- * @returns {PhotonImage}
548
- */
549
- module.exports.rotate = function(img, angle) {
550
- _assertClass(img, PhotonImage);
551
- var ret = wasm.rotate(img.ptr, angle);
552
- return PhotonImage.__wrap(ret);
553
- };
554
-
555
- /**
556
- * Resample the PhotonImage.
557
- *
558
- * # Arguments
559
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
560
- * * `dst_width` - Target width.
561
- * * `dst_height` - Target height.
562
- *
563
- * # Example
564
- *
565
- * ```no_run
566
- * // For example, to resample a PhotonImage to 1920x1080 size:
567
- * use photon_rs::native::open_image;
568
- * use photon_rs::transform::resample;
569
- *
570
- * let img = open_image("img.jpg").expect("File should open");
571
- * let rotated_img = resample(&img, 1920, 1080);
572
- * ```
573
- * @param {PhotonImage} img
574
- * @param {number} dst_width
575
- * @param {number} dst_height
576
- * @returns {PhotonImage}
577
- */
578
- module.exports.resample = function(img, dst_width, dst_height) {
579
- _assertClass(img, PhotonImage);
580
- var ret = wasm.resample(img.ptr, dst_width, dst_height);
581
- return PhotonImage.__wrap(ret);
582
- };
583
-
584
- /**
585
- * Add bordered-text to an image.
586
- * The only font available as of now is Roboto.
587
- * Note: A graphic design/text-drawing library is currently being developed, so stay tuned.
588
- *
589
- * # Arguments
590
- * * `photon_image` - A PhotonImage.
591
- * * `text` - Text string to be drawn to the image.
592
- * * `x` - x-coordinate of where first letter's 1st pixel should be drawn.
593
- * * `y` - y-coordinate of where first letter's 1st pixel should be drawn.
594
- *
595
- * # Example
596
- *
597
- * ```no_run
598
- * // For example to draw the string "Welcome to Photon!" at 10, 10:
599
- * use photon_rs::native::open_image;
600
- * use photon_rs::text::draw_text_with_border;
601
- *
602
- * // Open the image. A PhotonImage is returned.
603
- * let mut img = open_image("img.jpg").expect("File should open");
604
- * draw_text_with_border(&mut img, "Welcome to Photon!", 10_u32, 10_u32);
605
- * ```
606
- * @param {PhotonImage} photon_img
607
- * @param {string} text
608
- * @param {number} x
609
- * @param {number} y
610
- */
611
- module.exports.draw_text_with_border = function(photon_img, text, x, y) {
612
- _assertClass(photon_img, PhotonImage);
613
- var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
614
- var len0 = WASM_VECTOR_LEN;
615
- wasm.draw_text_with_border(photon_img.ptr, ptr0, len0, x, y);
616
- };
617
-
618
- /**
619
- * Add text to an image.
620
- * The only font available as of now is Roboto.
621
- * Note: A graphic design/text-drawing library is currently being developed, so stay tuned.
622
- *
623
- * # Arguments
624
- * * `photon_image` - A PhotonImage.
625
- * * `text` - Text string to be drawn to the image.
626
- * * `x` - x-coordinate of where first letter's 1st pixel should be drawn.
627
- * * `y` - y-coordinate of where first letter's 1st pixel should be drawn.
628
- *
629
- * # Example
630
- *
631
- * ```no_run
632
- * // For example to draw the string "Welcome to Photon!" at 10, 10:
633
- * use photon_rs::native::open_image;
634
- * use photon_rs::text::draw_text;
635
- *
636
- * // Open the image. A PhotonImage is returned.
637
- * let mut img = open_image("img.jpg").expect("File should open");
638
- * draw_text(&mut img, "Welcome to Photon!", 10_u32, 10_u32);
639
- * ```
640
- * @param {PhotonImage} photon_img
641
- * @param {string} text
642
- * @param {number} x
643
- * @param {number} y
644
- */
645
- module.exports.draw_text = function(photon_img, text, x, y) {
646
- _assertClass(photon_img, PhotonImage);
647
- var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
648
- var len0 = WASM_VECTOR_LEN;
649
- wasm.draw_text(photon_img.ptr, ptr0, len0, x, y);
650
- };
651
-
652
- function passArray8ToWasm0(arg, malloc) {
653
- const ptr = malloc(arg.length * 1);
654
- getUint8Memory0().set(arg, ptr / 1);
655
- WASM_VECTOR_LEN = arg.length;
656
- return ptr;
657
- }
658
-
659
- function getArrayU8FromWasm0(ptr, len) {
660
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
661
- }
662
- /**
663
- *! [temp] Check if WASM is supported.
664
- */
665
- module.exports.run = function() {
666
- wasm.run();
667
- };
668
-
669
- let stack_pointer = 32;
670
-
671
- function addBorrowedObject(obj) {
672
- if (stack_pointer == 1) throw new Error('out of js stack');
673
- heap[--stack_pointer] = obj;
674
- return stack_pointer;
675
- }
676
- /**
677
- * Get the ImageData from a 2D canvas context
678
- * @param {HTMLCanvasElement} canvas
679
- * @param {CanvasRenderingContext2D} ctx
680
- * @returns {ImageData}
681
- */
682
- module.exports.get_image_data = function(canvas, ctx) {
683
- try {
684
- var ret = wasm.get_image_data(addBorrowedObject(canvas), addBorrowedObject(ctx));
685
- return takeObject(ret);
686
- } finally {
687
- heap[stack_pointer++] = undefined;
688
- heap[stack_pointer++] = undefined;
689
- }
690
- };
691
-
692
- /**
693
- * Place a PhotonImage onto a 2D canvas.
694
- * @param {HTMLCanvasElement} canvas
695
- * @param {CanvasRenderingContext2D} ctx
696
- * @param {PhotonImage} new_image
697
- */
698
- module.exports.putImageData = function(canvas, ctx, new_image) {
699
- _assertClass(new_image, PhotonImage);
700
- var ptr0 = new_image.ptr;
701
- new_image.ptr = 0;
702
- wasm.putImageData(addHeapObject(canvas), addHeapObject(ctx), ptr0);
703
- };
704
-
705
- /**
706
- * Convert a HTML5 Canvas Element to a PhotonImage.
707
- *
708
- * This converts the ImageData found in the canvas context to a PhotonImage,
709
- * which can then have effects or filters applied to it.
710
- * @param {HTMLCanvasElement} canvas
711
- * @param {CanvasRenderingContext2D} ctx
712
- * @returns {PhotonImage}
713
- */
714
- module.exports.open_image = function(canvas, ctx) {
715
- var ret = wasm.open_image(addHeapObject(canvas), addHeapObject(ctx));
716
- return PhotonImage.__wrap(ret);
717
- };
718
-
719
- /**
720
- * Convert ImageData to a raw pixel vec of u8s.
721
- * @param {ImageData} imgdata
722
- * @returns {Uint8Array}
723
- */
724
- module.exports.to_raw_pixels = function(imgdata) {
725
- try {
726
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
727
- wasm.to_raw_pixels(retptr, addHeapObject(imgdata));
728
- var r0 = getInt32Memory0()[retptr / 4 + 0];
729
- var r1 = getInt32Memory0()[retptr / 4 + 1];
730
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
731
- wasm.__wbindgen_free(r0, r1 * 1);
732
- return v0;
733
- } finally {
734
- wasm.__wbindgen_add_to_stack_pointer(16);
735
- }
736
- };
737
-
738
- /**
739
- * Convert a base64 string to a PhotonImage.
740
- * @param {string} base64
741
- * @returns {PhotonImage}
742
- */
743
- module.exports.base64_to_image = function(base64) {
744
- var ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
745
- var len0 = WASM_VECTOR_LEN;
746
- var ret = wasm.base64_to_image(ptr0, len0);
747
- return PhotonImage.__wrap(ret);
748
- };
749
-
750
- /**
751
- * Convert a base64 string to a Vec of u8s.
752
- * @param {string} base64
753
- * @returns {Uint8Array}
754
- */
755
- module.exports.base64_to_vec = function(base64) {
756
- try {
757
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
758
- var ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
759
- var len0 = WASM_VECTOR_LEN;
760
- wasm.base64_to_vec(retptr, ptr0, len0);
761
- var r0 = getInt32Memory0()[retptr / 4 + 0];
762
- var r1 = getInt32Memory0()[retptr / 4 + 1];
763
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
764
- wasm.__wbindgen_free(r0, r1 * 1);
765
- return v1;
766
- } finally {
767
- wasm.__wbindgen_add_to_stack_pointer(16);
768
- }
769
- };
770
-
771
- /**
772
- * Convert a PhotonImage to JS-compatible ImageData.
773
- * @param {PhotonImage} photon_image
774
- * @returns {ImageData}
775
- */
776
- module.exports.to_image_data = function(photon_image) {
777
- _assertClass(photon_image, PhotonImage);
778
- var ptr0 = photon_image.ptr;
779
- photon_image.ptr = 0;
780
- var ret = wasm.to_image_data(ptr0);
781
- return takeObject(ret);
782
- };
783
-
784
- /**
785
- * Alter a select channel by incrementing or decrementing its value by a constant.
786
- *
787
- * # Arguments
788
- * * `img` - A PhotonImage.
789
- * * `channel` - The channel you wish to alter, it should be either 0, 1 or 2,
790
- * representing R, G, or B respectively. (O=Red, 1=Green, 2=Blue)
791
- * * `amount` - The amount to increment/decrement the channel's value by for that pixel.
792
- * A positive value will increment/decrement the channel's value, a negative value will decrement the channel's value.
793
- *
794
- * ## Example
795
- *
796
- * ```no_run
797
- * // For example, to increase the Red channel for all pixels by 10:
798
- * use photon_rs::channels::alter_channel;
799
- * use photon_rs::native::{open_image};
800
- *
801
- * let mut img = open_image("img.jpg").expect("File should open");
802
- * alter_channel(&mut img, 0_usize, 10_i16);
803
- * ```
804
- *
805
- * Adds a constant to a select R, G, or B channel's value.
806
- *
807
- * ### Decrease a channel's value
808
- * // For example, to decrease the Green channel for all pixels by 20:
809
- * ```no_run
810
- * use photon_rs::channels::alter_channel;
811
- * use photon_rs::native::open_image;
812
- *
813
- * let mut img = open_image("img.jpg").expect("File should open");
814
- * alter_channel(&mut img, 1_usize, -20_i16);
815
- * ```
816
- * **Note**: Note the use of a minus symbol when decreasing the channel.
817
- * @param {PhotonImage} img
818
- * @param {number} channel
819
- * @param {number} amt
820
- */
821
- module.exports.alter_channel = function(img, channel, amt) {
822
- _assertClass(img, PhotonImage);
823
- wasm.alter_channel(img.ptr, channel, amt);
824
- };
825
-
826
- /**
827
- * Increment or decrement every pixel's Red channel by a constant.
828
- *
829
- * # Arguments
830
- * * `img` - A PhotonImage. See the PhotonImage struct for details.
831
- * * `amt` - The amount to increment or decrement the channel's value by for that pixel.
832
- *
833
- * # Example
834
- *
835
- * ```no_run
836
- * // For example, to increase the Red channel for all pixels by 10:
837
- * use photon_rs::channels::alter_red_channel;
838
- * use photon_rs::native::open_image;
839
- *
840
- * let mut img = open_image("img.jpg").expect("File should open");
841
- * alter_red_channel(&mut img, 10_i16);
842
- * ```
843
- * @param {PhotonImage} photon_image
844
- * @param {number} amt
845
- */
846
- module.exports.alter_red_channel = function(photon_image, amt) {
847
- _assertClass(photon_image, PhotonImage);
848
- wasm.alter_red_channel(photon_image.ptr, amt);
849
- };
850
-
851
- /**
852
- * Increment or decrement every pixel's Green channel by a constant.
853
- *
854
- * # Arguments
855
- * * `img` - A PhotonImage.
856
- * * `amt` - The amount to increment/decrement the channel's value by for that pixel.
857
- *
858
- * # Example
859
- *
860
- * ```no_run
861
- * // For example, to increase the Green channel for all pixels by 20:
862
- * use photon_rs::channels::alter_green_channel;
863
- * use photon_rs::native::open_image;
864
- *
865
- * let mut img = open_image("img.jpg").expect("File should open");
866
- * alter_green_channel(&mut img, 20_i16);
867
- * ```
868
- * @param {PhotonImage} img
869
- * @param {number} amt
870
- */
871
- module.exports.alter_green_channel = function(img, amt) {
872
- _assertClass(img, PhotonImage);
873
- wasm.alter_green_channel(img.ptr, amt);
874
- };
875
-
876
- /**
877
- * Increment or decrement every pixel's Blue channel by a constant.
878
- *
879
- * # Arguments
880
- * * `img` - A PhotonImage.
881
- * * `amt` - The amount to increment or decrement the channel's value by for that pixel.
882
- *
883
- * # Example
884
- *
885
- * ```no_run
886
- * // For example, to increase the Blue channel for all pixels by 10:
887
- * use photon_rs::channels::alter_blue_channel;
888
- * use photon_rs::native::open_image;
889
- *
890
- * let mut img = open_image("img.jpg").expect("File should open");
891
- * alter_blue_channel(&mut img, 10_i16);
892
- * ```
893
- * @param {PhotonImage} img
894
- * @param {number} amt
895
- */
896
- module.exports.alter_blue_channel = function(img, amt) {
897
- _assertClass(img, PhotonImage);
898
- wasm.alter_blue_channel(img.ptr, amt);
899
- };
900
-
901
- /**
902
- * Increment/decrement two channels' values simultaneously by adding an amt to each channel per pixel.
903
- *
904
- * # Arguments
905
- * * `img` - A PhotonImage.
906
- * * `channel1` - A usize from 0 to 2 that represents either the R, G or B channels.
907
- * * `amt1` - The amount to increment/decrement the channel's value by for that pixel.
908
- * * `channel2` -A usize from 0 to 2 that represents either the R, G or B channels.
909
- * * `amt2` - The amount to increment/decrement the channel's value by for that pixel.
910
- *
911
- * # Example
912
- *
913
- * ```no_run
914
- * // For example, to increase the values of the Red and Blue channels per pixel:
915
- * use photon_rs::channels::alter_two_channels;
916
- * use photon_rs::native::open_image;
917
- *
918
- * let mut img = open_image("img.jpg").expect("File should open");
919
- * alter_two_channels(&mut img, 0_usize, 10_i16, 2_usize, 20_i16);
920
- * ```
921
- * @param {PhotonImage} img
922
- * @param {number} channel1
923
- * @param {number} amt1
924
- * @param {number} channel2
925
- * @param {number} amt2
926
- */
927
- module.exports.alter_two_channels = function(img, channel1, amt1, channel2, amt2) {
928
- _assertClass(img, PhotonImage);
929
- wasm.alter_two_channels(img.ptr, channel1, amt1, channel2, amt2);
930
- };
931
-
932
- /**
933
- * Increment all 3 channels' values by adding an amt to each channel per pixel.
934
- *
935
- * # Arguments
936
- * * `img` - A PhotonImage.
937
- * * `r_amt` - The amount to increment/decrement the Red channel by.
938
- * * `g_amt` - The amount to increment/decrement the Green channel by.
939
- * * `b_amt` - The amount to increment/decrement the Blue channel by.
940
- *
941
- * # Example
942
- *
943
- * ```no_run
944
- * // For example, to increase the values of the Red channel by 10, the Green channel by 20,
945
- * // and the Blue channel by 50:
946
- * use photon_rs::channels::alter_channels;
947
- * use photon_rs::native::open_image;
948
- *
949
- * let mut img = open_image("img.jpg").expect("File should open");
950
- * alter_channels(&mut img, 10_i16, 20_i16, 50_i16);
951
- * ```
952
- * @param {PhotonImage} img
953
- * @param {number} r_amt
954
- * @param {number} g_amt
955
- * @param {number} b_amt
956
- */
957
- module.exports.alter_channels = function(img, r_amt, g_amt, b_amt) {
958
- _assertClass(img, PhotonImage);
959
- wasm.alter_channels(img.ptr, r_amt, g_amt, b_amt);
960
- };
961
-
962
- /**
963
- * Set a certain channel to zero, thus removing the channel's influence in the pixels' final rendered colour.
964
- *
965
- * # Arguments
966
- * * `img` - A PhotonImage.
967
- * * `channel` - The channel to be removed; must be a usize from 0 to 2, with 0 representing Red, 1 representing Green, and 2 representing Blue.
968
- * * `min_filter` - Minimum filter. Value between 0 and 255. Only remove the channel if the current pixel's channel value is less than this minimum filter. To completely
969
- * remove the channel, set this value to 255, to leave the channel as is, set to 0, and to set a channel to zero for a pixel whose red value is greater than 50,
970
- * then channel would be 0 and min_filter would be 50.
971
- *
972
- * # Example
973
- *
974
- * ```no_run
975
- * // For example, to remove the Red channel with a min_filter of 100:
976
- * use photon_rs::channels::remove_channel;
977
- * use photon_rs::native::open_image;
978
- *
979
- * let mut img = open_image("img.jpg").expect("File should open");
980
- * remove_channel(&mut img, 0_usize, 100_u8);
981
- * ```
982
- * @param {PhotonImage} img
983
- * @param {number} channel
984
- * @param {number} min_filter
985
- */
986
- module.exports.remove_channel = function(img, channel, min_filter) {
987
- _assertClass(img, PhotonImage);
988
- wasm.remove_channel(img.ptr, channel, min_filter);
989
- };
990
-
991
- /**
992
- * Remove the Red channel's influence in an image.
993
- *
994
- * # Arguments
995
- * * `img` - A PhotonImage.
996
- * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
997
- *
998
- * # Example
999
- *
1000
- * ```no_run
1001
- * // For example, to remove the red channel for red channel pixel values less than 50:
1002
- * use photon_rs::channels::remove_red_channel;
1003
- * use photon_rs::native::open_image;
1004
- *
1005
- * let mut img = open_image("img.jpg").expect("File should open");
1006
- * remove_red_channel(&mut img, 50_u8);
1007
- * ```
1008
- * @param {PhotonImage} img
1009
- * @param {number} min_filter
1010
- */
1011
- module.exports.remove_red_channel = function(img, min_filter) {
1012
- _assertClass(img, PhotonImage);
1013
- wasm.remove_red_channel(img.ptr, min_filter);
1014
- };
1015
-
1016
- /**
1017
- * Remove the Green channel's influence in an image.
1018
- *
1019
- * # Arguments
1020
- * * `img` - A PhotonImage.
1021
- * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
1022
- *
1023
- * # Example
1024
- *
1025
- * ```no_run
1026
- * // For example, to remove the green channel for green channel pixel values less than 50:
1027
- * use photon_rs::channels::remove_green_channel;
1028
- * use photon_rs::native::open_image;
1029
- *
1030
- * let mut img = open_image("img.jpg").expect("File should open");
1031
- * remove_green_channel(&mut img, 50_u8);
1032
- * ```
1033
- * @param {PhotonImage} img
1034
- * @param {number} min_filter
1035
- */
1036
- module.exports.remove_green_channel = function(img, min_filter) {
1037
- _assertClass(img, PhotonImage);
1038
- wasm.remove_green_channel(img.ptr, min_filter);
1039
- };
1040
-
1041
- /**
1042
- * Remove the Blue channel's influence in an image.
1043
- *
1044
- * # Arguments
1045
- * * `img` - A PhotonImage.
1046
- * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
1047
- *
1048
- * # Example
1049
- *
1050
- * ```no_run
1051
- * // For example, to remove the blue channel for blue channel pixel values less than 50:
1052
- * use photon_rs::channels::remove_blue_channel;
1053
- * use photon_rs::native::open_image;
1054
- *
1055
- * let mut img = open_image("img.jpg").expect("File should open");
1056
- * remove_blue_channel(&mut img, 50_u8);
1057
- * ```
1058
- * @param {PhotonImage} img
1059
- * @param {number} min_filter
1060
- */
1061
- module.exports.remove_blue_channel = function(img, min_filter) {
1062
- _assertClass(img, PhotonImage);
1063
- wasm.remove_blue_channel(img.ptr, min_filter);
1064
- };
1065
-
1066
- /**
1067
- * Swap two channels.
1068
- *
1069
- * # Arguments
1070
- * * `img` - A PhotonImage.
1071
- * * `channel1` - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Red would be represented by 0, Green by 1, and Blue by 2.
1072
- * * `channel2` - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Same as above.
1073
- *
1074
- * # Example
1075
- *
1076
- * ```no_run
1077
- * // For example, to swap the values of the Red channel with the values of the Blue channel:
1078
- * use photon_rs::channels::swap_channels;
1079
- * use photon_rs::native::open_image;
1080
- *
1081
- * let mut img = open_image("img.jpg").expect("File should open");
1082
- * swap_channels(&mut img, 0_usize, 2_usize);
1083
- * ```
1084
- * @param {PhotonImage} img
1085
- * @param {number} channel1
1086
- * @param {number} channel2
1087
- */
1088
- module.exports.swap_channels = function(img, channel1, channel2) {
1089
- _assertClass(img, PhotonImage);
1090
- wasm.swap_channels(img.ptr, channel1, channel2);
1091
- };
1092
-
1093
- /**
1094
- * Invert RGB value of an image.
1095
- *
1096
- * # Arguments
1097
- * * `photon_image` - A DynamicImage that contains a view into the image.
1098
- * # Example
1099
- *
1100
- * ```no_run
1101
- * use photon_rs::channels::invert;
1102
- * use photon_rs::native::open_image;
1103
- *
1104
- * let mut img = open_image("img.jpg").expect("File should open");
1105
- * invert(&mut img);
1106
- * ```
1107
- * @param {PhotonImage} photon_image
1108
- */
1109
- module.exports.invert = function(photon_image) {
1110
- _assertClass(photon_image, PhotonImage);
1111
- wasm.invert(photon_image.ptr);
1112
- };
1113
-
1114
- /**
1115
- * Selective hue rotation.
1116
- *
1117
- * Only rotate the hue of a pixel if its RGB values are within a specified range.
1118
- * This function only rotates a pixel's hue to another if it is visually similar to the colour specified.
1119
- * For example, if a user wishes all pixels that are blue to be changed to red, they can selectively specify only the blue pixels to be changed.
1120
- * # Arguments
1121
- * * `img` - A PhotonImage.
1122
- * * `ref_color` - The `RGB` value of the reference color (to be compared to)
1123
- * * `degrees` - The amount of degrees to hue rotate by.
1124
- *
1125
- * # Example
1126
- *
1127
- * ```no_run
1128
- * // For example, to only rotate the pixels that are of RGB value RGB{20, 40, 60}:
1129
- * use photon_rs::Rgb;
1130
- * use photon_rs::channels::selective_hue_rotate;
1131
- * use photon_rs::native::open_image;
1132
- *
1133
- * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
1134
- * let mut img = open_image("img.jpg").expect("File should open");
1135
- * selective_hue_rotate(&mut img, ref_color, 180_f32);
1136
- * ```
1137
- * @param {PhotonImage} photon_image
1138
- * @param {Rgb} ref_color
1139
- * @param {number} degrees
1140
- */
1141
- module.exports.selective_hue_rotate = function(photon_image, ref_color, degrees) {
1142
- _assertClass(photon_image, PhotonImage);
1143
- _assertClass(ref_color, Rgb);
1144
- var ptr0 = ref_color.ptr;
1145
- ref_color.ptr = 0;
1146
- wasm.selective_hue_rotate(photon_image.ptr, ptr0, degrees);
1147
- };
1148
-
1149
- /**
1150
- * Selectively change pixel colours which are similar to the reference colour provided.
1151
- *
1152
- * Similarity between two colours is calculated via the CIE76 formula.
1153
- * Only changes the color of a pixel if its similarity to the reference colour is within the range in the algorithm.
1154
- * For example, with this function, a user can change the color of all blue pixels by mixing them with red by 10%.
1155
- * # Arguments
1156
- * * `photon_image` - A PhotonImage.
1157
- * * `ref_color` - The `RGB` value of the reference color (to be compared to)
1158
- * * `new_color` - The `RGB` value of the new color (to be mixed with the matched pixels)
1159
- * * `fraction` - The amount of mixing the new colour with the matched pixels
1160
- *
1161
- * # Example
1162
- *
1163
- * ```no_run
1164
- * // For example, to only change the color of pixels that are similar to the RGB value RGB{200, 120, 30} by mixing RGB{30, 120, 200} with 25%:
1165
- * use photon_rs::Rgb;
1166
- * use photon_rs::channels::selective_color_convert;
1167
- * use photon_rs::native::open_image;
1168
- *
1169
- * let ref_color = Rgb::new(200, 120, 30);
1170
- * let new_color = Rgb::new(30, 120, 200);
1171
- * let mut img = open_image("img.jpg").expect("File should open");
1172
- * selective_color_convert(&mut img, ref_color, new_color, 0.25);
1173
- * ```
1174
- * @param {PhotonImage} photon_image
1175
- * @param {Rgb} ref_color
1176
- * @param {Rgb} new_color
1177
- * @param {number} fraction
1178
- */
1179
- module.exports.selective_color_convert = function(photon_image, ref_color, new_color, fraction) {
1180
- _assertClass(photon_image, PhotonImage);
1181
- _assertClass(ref_color, Rgb);
1182
- var ptr0 = ref_color.ptr;
1183
- ref_color.ptr = 0;
1184
- _assertClass(new_color, Rgb);
1185
- var ptr1 = new_color.ptr;
1186
- new_color.ptr = 0;
1187
- wasm.selective_color_convert(photon_image.ptr, ptr0, ptr1, fraction);
1188
- };
1189
-
1190
- /**
1191
- * Selectively lighten an image.
1192
- *
1193
- * Only lighten the hue of a pixel if its colour matches or is similar to the RGB colour specified.
1194
- * For example, if a user wishes all pixels that are blue to be lightened, they can selectively specify only the blue pixels to be changed.
1195
- * # Arguments
1196
- * * `img` - A PhotonImage.
1197
- * * `ref_color` - The `RGB` value of the reference color (to be compared to)
1198
- * * `amt` - The level from 0 to 1 to lighten the hue by. Increasing by 10% would have an `amt` of 0.1
1199
- *
1200
- * # Example
1201
- *
1202
- * ```no_run
1203
- * // For example, to only lighten the pixels that are of or similar to RGB value RGB{20, 40, 60}:
1204
- * use photon_rs::Rgb;
1205
- * use photon_rs::channels::selective_lighten;
1206
- * use photon_rs::native::open_image;
1207
- *
1208
- * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
1209
- * let mut img = open_image("img.jpg").expect("File should open");
1210
- * selective_lighten(&mut img, ref_color, 0.2_f32);
1211
- * ```
1212
- * @param {PhotonImage} img
1213
- * @param {Rgb} ref_color
1214
- * @param {number} amt
1215
- */
1216
- module.exports.selective_lighten = function(img, ref_color, amt) {
1217
- _assertClass(img, PhotonImage);
1218
- _assertClass(ref_color, Rgb);
1219
- var ptr0 = ref_color.ptr;
1220
- ref_color.ptr = 0;
1221
- wasm.selective_lighten(img.ptr, ptr0, amt);
1222
- };
1223
-
1224
- /**
1225
- * Selectively desaturate pixel colours which are similar to the reference colour provided.
1226
- *
1227
- * Similarity between two colours is calculated via the CIE76 formula.
1228
- * Only desaturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm.
1229
- * For example, if a user wishes all pixels that are blue to be desaturated by 0.1, they can selectively specify only the blue pixels to be changed.
1230
- * # Arguments
1231
- * * `img` - A PhotonImage.
1232
- * * `ref_color` - The `RGB` value of the reference color (to be compared to)
1233
- * * `amt` - The amount of desaturate the colour by.
1234
- *
1235
- * # Example
1236
- *
1237
- * ```no_run
1238
- * // For example, to only desaturate the pixels that are similar to the RGB value RGB{20, 40, 60}:
1239
- * use photon_rs::Rgb;
1240
- * use photon_rs::channels::selective_desaturate;
1241
- * use photon_rs::native::open_image;
1242
- *
1243
- * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
1244
- * let mut img = open_image("img.jpg").expect("File should open");
1245
- * selective_desaturate(&mut img, ref_color, 0.1_f32);
1246
- * ```
1247
- * @param {PhotonImage} img
1248
- * @param {Rgb} ref_color
1249
- * @param {number} amt
1250
- */
1251
- module.exports.selective_desaturate = function(img, ref_color, amt) {
1252
- _assertClass(img, PhotonImage);
1253
- _assertClass(ref_color, Rgb);
1254
- var ptr0 = ref_color.ptr;
1255
- ref_color.ptr = 0;
1256
- wasm.selective_desaturate(img.ptr, ptr0, amt);
1257
- };
1258
-
1259
- /**
1260
- * Selectively saturate pixel colours which are similar to the reference colour provided.
1261
- *
1262
- * Similarity between two colours is calculated via the CIE76 formula.
1263
- * Only saturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm.
1264
- * For example, if a user wishes all pixels that are blue to have an increase in saturation by 10%, they can selectively specify only the blue pixels to be changed.
1265
- * # Arguments
1266
- * * `img` - A PhotonImage.
1267
- * * `ref_color` - The `RGB` value of the reference color (to be compared to)
1268
- * * `amt` - The amount of saturate the colour by.
1269
- *
1270
- * # Example
1271
- *
1272
- * ```no_run
1273
- * // For example, to only increase the saturation of pixels that are similar to the RGB value RGB{20, 40, 60}:
1274
- * use photon_rs::Rgb;
1275
- * use photon_rs::channels::selective_saturate;
1276
- * use photon_rs::native::open_image;
1277
- *
1278
- * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
1279
- * let mut img = open_image("img.jpg").expect("File should open");
1280
- * selective_saturate(&mut img, ref_color, 0.1_f32);
1281
- * ```
1282
- * @param {PhotonImage} img
1283
- * @param {Rgb} ref_color
1284
- * @param {number} amt
1285
- */
1286
- module.exports.selective_saturate = function(img, ref_color, amt) {
1287
- _assertClass(img, PhotonImage);
1288
- _assertClass(ref_color, Rgb);
1289
- var ptr0 = ref_color.ptr;
1290
- ref_color.ptr = 0;
1291
- wasm.selective_saturate(img.ptr, ptr0, amt);
1292
- };
1293
-
1294
- /**
1295
- * Selectively changes a pixel to greyscale if it is *not* visually similar or close to the colour specified.
1296
- * Only changes the colour of a pixel if its RGB values are within a specified range.
1297
- *
1298
- * (Similarity between two colours is calculated via the CIE76 formula.)
1299
- * For example, if a user wishes all pixels that are *NOT* blue to be displayed in greyscale, they can selectively specify only the blue pixels to be
1300
- * kept in the photo.
1301
- * # Arguments
1302
- * * `img` - A PhotonImage.
1303
- * * `ref_color` - The `RGB` value of the reference color (to be compared to)
1304
- *
1305
- * # Example
1306
- *
1307
- * ```no_run
1308
- * // For example, to greyscale all pixels that are *not* visually similar to the RGB colour RGB{20, 40, 60}:
1309
- * use photon_rs::Rgb;
1310
- * use photon_rs::channels::selective_greyscale;
1311
- * use photon_rs::native::open_image;
1312
- *
1313
- * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
1314
- * let mut img = open_image("img.jpg").expect("File should open");
1315
- * selective_greyscale(img, ref_color);
1316
- * ```
1317
- * @param {PhotonImage} photon_image
1318
- * @param {Rgb} ref_color
1319
- */
1320
- module.exports.selective_greyscale = function(photon_image, ref_color) {
1321
- _assertClass(photon_image, PhotonImage);
1322
- var ptr0 = photon_image.ptr;
1323
- photon_image.ptr = 0;
1324
- _assertClass(ref_color, Rgb);
1325
- var ptr1 = ref_color.ptr;
1326
- ref_color.ptr = 0;
1327
- wasm.selective_greyscale(ptr0, ptr1);
1328
- };
1329
-
1330
- /**
1331
- * Apply a monochrome effect of a certain colour.
1332
- *
1333
- * It does so by averaging the R, G, and B values of a pixel, and then adding a
1334
- * separate value to that averaged value for each channel to produce a tint.
1335
- * # Arguments
1336
- * * `photon_image` - A PhotonImage.
1337
- * * `r_offset` - The value to add to the Red channel per pixel.
1338
- * * `g_offset` - The value to add to the Green channel per pixel.
1339
- * * `b_offset` - The value to add to the Blue channel per pixel.
1340
- *
1341
- * # Example
1342
- *
1343
- * ```no_run
1344
- * // For example, to apply a monochrome effect to an image:
1345
- * use photon_rs::monochrome::monochrome;
1346
- * use photon_rs::native::open_image;
1347
- *
1348
- * let mut img = open_image("img.jpg").expect("File should open");
1349
- * monochrome(&mut img, 40_u32, 50_u32, 100_u32);
1350
- * ```
1351
- * @param {PhotonImage} img
1352
- * @param {number} r_offset
1353
- * @param {number} g_offset
1354
- * @param {number} b_offset
1355
- */
1356
- module.exports.monochrome = function(img, r_offset, g_offset, b_offset) {
1357
- _assertClass(img, PhotonImage);
1358
- wasm.monochrome(img.ptr, r_offset, g_offset, b_offset);
1359
- };
1360
-
1361
- /**
1362
- * Convert an image to sepia.
1363
- *
1364
- * # Arguments
1365
- * * `photon_image` - A PhotonImage.
1366
- * # Example
1367
- *
1368
- * ```no_run
1369
- * // For example, to sepia an image of type `PhotonImage`:
1370
- * use photon_rs::monochrome::sepia;
1371
- * use photon_rs::native::open_image;
1372
- *
1373
- * let mut img = open_image("img.jpg").expect("File should open");
1374
- * sepia(&mut img);
1375
- * ```
1376
- * @param {PhotonImage} img
1377
- */
1378
- module.exports.sepia = function(img) {
1379
- _assertClass(img, PhotonImage);
1380
- wasm.sepia(img.ptr);
1381
- };
1382
-
1383
- /**
1384
- * Convert an image to grayscale using the conventional averaging algorithm.
1385
- *
1386
- * # Arguments
1387
- * * `photon_image` - A PhotonImage.
1388
- * # Example
1389
- *
1390
- * ```no_run
1391
- * // For example, to convert an image of type `PhotonImage` to grayscale:
1392
- * use photon_rs::monochrome::grayscale;
1393
- * use photon_rs::native::open_image;
1394
- *
1395
- * let mut img = open_image("img.jpg").expect("File should open");
1396
- * grayscale(&mut img);
1397
- * ```
1398
- * @param {PhotonImage} img
1399
- */
1400
- module.exports.grayscale = function(img) {
1401
- _assertClass(img, PhotonImage);
1402
- wasm.grayscale(img.ptr);
1403
- };
1404
-
1405
- /**
1406
- * Convert an image to grayscale with a human corrected factor, to account for human vision.
1407
- *
1408
- * # Arguments
1409
- * * `photon_image` - A PhotonImage.
1410
- * # Example
1411
- *
1412
- * ```no_run
1413
- * // For example, to convert an image of type `PhotonImage` to grayscale with a human corrected factor:
1414
- * use photon_rs::monochrome::grayscale_human_corrected;
1415
- * use photon_rs::native::open_image;
1416
- *
1417
- * let mut img = open_image("img.jpg").expect("File should open");
1418
- * grayscale_human_corrected(&mut img);
1419
- * ```
1420
- * @param {PhotonImage} img
1421
- */
1422
- module.exports.grayscale_human_corrected = function(img) {
1423
- _assertClass(img, PhotonImage);
1424
- wasm.grayscale_human_corrected(img.ptr);
1425
- };
1426
-
1427
- /**
1428
- * Desaturate an image by getting the min/max of each pixel's RGB values.
1429
- *
1430
- * # Arguments
1431
- * * `photon_image` - A PhotonImage.
1432
- * # Example
1433
- *
1434
- * ```no_run
1435
- * // For example, to desaturate an image:
1436
- * use photon_rs::monochrome::desaturate;
1437
- * use photon_rs::native::open_image;
1438
- *
1439
- * let mut img = open_image("img.jpg").expect("File should open");
1440
- * desaturate(&mut img);
1441
- * ```
1442
- * @param {PhotonImage} img
1443
- */
1444
- module.exports.desaturate = function(img) {
1445
- _assertClass(img, PhotonImage);
1446
- wasm.desaturate(img.ptr);
1447
- };
1448
-
1449
- /**
1450
- * Uses a min. decomposition algorithm to convert an image to greyscale.
1451
- *
1452
- * # Arguments
1453
- * * `photon_image` - A PhotonImage.
1454
- * # Example
1455
- *
1456
- * ```no_run
1457
- * // For example, to decompose an image with min decomposition:
1458
- * use photon_rs::monochrome::decompose_min;
1459
- * use photon_rs::native::open_image;
1460
- *
1461
- * let mut img = open_image("img.jpg").expect("File should open");
1462
- * decompose_min(&mut img);
1463
- * ```
1464
- * @param {PhotonImage} img
1465
- */
1466
- module.exports.decompose_min = function(img) {
1467
- _assertClass(img, PhotonImage);
1468
- wasm.decompose_min(img.ptr);
1469
- };
1470
-
1471
- /**
1472
- * Uses a max. decomposition algorithm to convert an image to greyscale.
1473
- *
1474
- * # Arguments
1475
- * * `photon_image` - A PhotonImage.
1476
- * # Example
1477
- *
1478
- * ```no_run
1479
- * // For example, to decompose an image with max decomposition:
1480
- * use photon_rs::monochrome::decompose_max;
1481
- * use photon_rs::native::open_image;
1482
- *
1483
- * let mut img = open_image("img.jpg").expect("File should open");
1484
- * decompose_max(&mut img);
1485
- * ```
1486
- * @param {PhotonImage} img
1487
- */
1488
- module.exports.decompose_max = function(img) {
1489
- _assertClass(img, PhotonImage);
1490
- wasm.decompose_max(img.ptr);
1491
- };
1492
-
1493
- /**
1494
- * Employ only a limited number of gray shades in an image.
1495
- *
1496
- * # Arguments
1497
- * * `photon_image` - A PhotonImage.
1498
- * * `num_shades` - The number of grayscale shades to be displayed in the image.
1499
- * # Example
1500
- *
1501
- * ```no_run
1502
- * // For example, to limit an image to four shades of gray only:
1503
- * use photon_rs::monochrome::grayscale_shades;
1504
- * use photon_rs::native::open_image;
1505
- *
1506
- * let mut img = open_image("img.jpg").expect("File should open");
1507
- * grayscale_shades(&mut img, 4_u8);
1508
- * ```
1509
- * @param {PhotonImage} photon_image
1510
- * @param {number} num_shades
1511
- */
1512
- module.exports.grayscale_shades = function(photon_image, num_shades) {
1513
- _assertClass(photon_image, PhotonImage);
1514
- wasm.grayscale_shades(photon_image.ptr, num_shades);
1515
- };
1516
-
1517
- /**
1518
- * Convert an image to grayscale by setting a pixel's 3 RGB values to the Red channel's value.
1519
- *
1520
- * # Arguments
1521
- * * `photon_image` - A PhotonImage.
1522
- * # Example
1523
- *
1524
- * ```no_run
1525
- * use photon_rs::monochrome::r_grayscale;
1526
- * use photon_rs::native::open_image;
1527
- *
1528
- * let mut img = open_image("img.jpg").expect("File should open");
1529
- * r_grayscale(&mut img);
1530
- * ```
1531
- * @param {PhotonImage} photon_image
1532
- */
1533
- module.exports.r_grayscale = function(photon_image) {
1534
- _assertClass(photon_image, PhotonImage);
1535
- wasm.r_grayscale(photon_image.ptr);
1536
- };
1537
-
1538
- /**
1539
- * Convert an image to grayscale by setting a pixel's 3 RGB values to the Green channel's value.
1540
- *
1541
- * # Arguments
1542
- * * `photon_image` - A PhotonImage.
1543
- * # Example
1544
- *
1545
- * ```no_run
1546
- * use photon_rs::monochrome::g_grayscale;
1547
- * use photon_rs::native::open_image;
1548
- *
1549
- * let mut img = open_image("img.jpg").expect("File should open");
1550
- * g_grayscale(&mut img);
1551
- * ```
1552
- * @param {PhotonImage} photon_image
1553
- */
1554
- module.exports.g_grayscale = function(photon_image) {
1555
- _assertClass(photon_image, PhotonImage);
1556
- wasm.g_grayscale(photon_image.ptr);
1557
- };
1558
-
1559
- /**
1560
- * Convert an image to grayscale by setting a pixel's 3 RGB values to the Blue channel's value.
1561
- *
1562
- * # Arguments
1563
- * * `photon_image` - A PhotonImage.
1564
- * # Example
1565
- *
1566
- * ```no_run
1567
- * use photon_rs::monochrome::b_grayscale;
1568
- * use photon_rs::native::open_image;
1569
- *
1570
- * let mut img = open_image("img.jpg").expect("File should open");
1571
- * b_grayscale(&mut img);
1572
- * ```
1573
- * @param {PhotonImage} photon_image
1574
- */
1575
- module.exports.b_grayscale = function(photon_image) {
1576
- _assertClass(photon_image, PhotonImage);
1577
- wasm.b_grayscale(photon_image.ptr);
1578
- };
1579
-
1580
- /**
1581
- * Convert an image to grayscale by setting a pixel's 3 RGB values to a chosen channel's value.
1582
- *
1583
- * # Arguments
1584
- * * `photon_image` - A PhotonImage.
1585
- * * `channel` - A usize representing the channel from 0 to 2. O represents the Red channel, 1 the Green channel, and 2 the Blue channel.
1586
- * # Example
1587
- * To grayscale using only values from the Red channel:
1588
- * ```no_run
1589
- * use photon_rs::monochrome::single_channel_grayscale;
1590
- * use photon_rs::native::open_image;
1591
- *
1592
- * let mut img = open_image("img.jpg").expect("File should open");
1593
- * single_channel_grayscale(&mut img, 0_usize);
1594
- * ```
1595
- * @param {PhotonImage} photon_image
1596
- * @param {number} channel
1597
- */
1598
- module.exports.single_channel_grayscale = function(photon_image, channel) {
1599
- _assertClass(photon_image, PhotonImage);
1600
- wasm.single_channel_grayscale(photon_image.ptr, channel);
1601
- };
1602
-
1603
- /**
1604
- * Threshold an image using a standard thresholding algorithm.
1605
- *
1606
- * # Arguments
1607
- * * `photon_image` - A PhotonImage.
1608
- * * `threshold` - The amount the image should be thresholded by from 0 to 255.
1609
- * # Example
1610
- *
1611
- * ```no_run
1612
- * // For example, to threshold an image of type `PhotonImage`:
1613
- * use photon_rs::monochrome::threshold;
1614
- * use photon_rs::native::open_image;
1615
- *
1616
- * let mut img = open_image("img.jpg").expect("File should open");
1617
- * threshold(&mut img, 30_u32);
1618
- * ```
1619
- * @param {PhotonImage} img
1620
- * @param {number} threshold
1621
- */
1622
- module.exports.threshold = function(img, threshold) {
1623
- _assertClass(img, PhotonImage);
1624
- wasm.threshold(img.ptr, threshold);
1625
- };
1626
-
1627
- /**
1628
- * Adds an offset to the image by a certain number of pixels.
1629
- *
1630
- * This creates an RGB shift effect.
1631
- *
1632
- * # Arguments
1633
- * * `img` - A PhotonImage that contains a view into the image.
1634
- * * `channel_index`: The index of the channel to increment. 0 for red, 1 for green and 2 for blue.
1635
- * * `offset` - The offset is added to the pixels in the image.
1636
- * # Example
1637
- *
1638
- * ```no_run
1639
- * // For example, to offset pixels by 30 pixels on the red channel:
1640
- * use photon_rs::effects::offset;
1641
- * use photon_rs::native::open_image;
1642
- *
1643
- * let mut img = open_image("img.jpg").expect("File should open");
1644
- * offset(&mut img, 0_usize, 30_u32);
1645
- * ```
1646
- * @param {PhotonImage} photon_image
1647
- * @param {number} channel_index
1648
- * @param {number} offset
1649
- */
1650
- module.exports.offset = function(photon_image, channel_index, offset) {
1651
- _assertClass(photon_image, PhotonImage);
1652
- wasm.offset(photon_image.ptr, channel_index, offset);
1653
- };
1654
-
1655
- /**
1656
- * Adds an offset to the red channel by a certain number of pixels.
1657
- *
1658
- * # Arguments
1659
- * * `img` - A PhotonImage that contains a view into the image.
1660
- * * `offset` - The offset you want to move the red channel by.
1661
- * # Example
1662
- *
1663
- * ```no_run
1664
- * // For example, to add an offset to the red channel by 30 pixels.
1665
- * use photon_rs::effects::offset_red;
1666
- * use photon_rs::native::open_image;
1667
- *
1668
- * let mut img = open_image("img.jpg").expect("File should open");
1669
- * offset_red(&mut img, 30_u32);
1670
- * ```
1671
- * @param {PhotonImage} img
1672
- * @param {number} offset_amt
1673
- */
1674
- module.exports.offset_red = function(img, offset_amt) {
1675
- _assertClass(img, PhotonImage);
1676
- wasm.offset_red(img.ptr, offset_amt);
1677
- };
1678
-
1679
- /**
1680
- * Adds an offset to the green channel by a certain number of pixels.
1681
- *
1682
- * # Arguments
1683
- * * `img` - A PhotonImage that contains a view into the image.
1684
- * * `offset` - The offset you want to move the green channel by.
1685
- * # Example
1686
- *
1687
- * ```no_run
1688
- * // For example, to add an offset to the green channel by 30 pixels.
1689
- * use photon_rs::effects::offset_green;
1690
- * use photon_rs::native::open_image;
1691
- *
1692
- * let mut img = open_image("img.jpg").expect("File should open");
1693
- * offset_green(&mut img, 30_u32);
1694
- * ```
1695
- * @param {PhotonImage} img
1696
- * @param {number} offset_amt
1697
- */
1698
- module.exports.offset_green = function(img, offset_amt) {
1699
- _assertClass(img, PhotonImage);
1700
- wasm.offset_green(img.ptr, offset_amt);
1701
- };
1702
-
1703
- /**
1704
- * Adds an offset to the blue channel by a certain number of pixels.
1705
- *
1706
- * # Arguments
1707
- * * `img` - A PhotonImage that contains a view into the image.
1708
- * * `offset_amt` - The offset you want to move the blue channel by.
1709
- * # Example
1710
- * // For example, to add an offset to the green channel by 40 pixels.
1711
- *
1712
- * ```no_run
1713
- * use photon_rs::effects::offset_blue;
1714
- * use photon_rs::native::open_image;
1715
- *
1716
- * let mut img = open_image("img.jpg").expect("File should open");
1717
- * offset_blue(&mut img, 40_u32);
1718
- * ```
1719
- * @param {PhotonImage} img
1720
- * @param {number} offset_amt
1721
- */
1722
- module.exports.offset_blue = function(img, offset_amt) {
1723
- _assertClass(img, PhotonImage);
1724
- wasm.offset_blue(img.ptr, offset_amt);
1725
- };
1726
-
1727
- /**
1728
- * Adds multiple offsets to the image by a certain number of pixels (on two channels).
1729
- *
1730
- * # Arguments
1731
- * * `img` - A PhotonImage that contains a view into the image.
1732
- * * `offset` - The offset is added to the pixels in the image.
1733
- * # Example
1734
- *
1735
- * ```no_run
1736
- * // For example, to add a 30-pixel offset to both the red and blue channels:
1737
- * use photon_rs::effects::multiple_offsets;
1738
- * use photon_rs::native::open_image;
1739
- *
1740
- * let mut img = open_image("img.jpg").expect("File should open");
1741
- * multiple_offsets(&mut img, 30_u32, 0_usize, 2_usize);
1742
- * ```
1743
- * @param {PhotonImage} photon_image
1744
- * @param {number} offset
1745
- * @param {number} channel_index
1746
- * @param {number} channel_index2
1747
- */
1748
- module.exports.multiple_offsets = function(photon_image, offset, channel_index, channel_index2) {
1749
- _assertClass(photon_image, PhotonImage);
1750
- wasm.multiple_offsets(photon_image.ptr, offset, channel_index, channel_index2);
1751
- };
1752
-
1753
- /**
1754
- * Reduces an image to the primary colours.
1755
- *
1756
- * # Arguments
1757
- * * `img` - A PhotonImage that contains a view into the image.
1758
- * # Example
1759
- *
1760
- * ```no_run
1761
- * // For example, to add a primary colour effect to an image of type `DynamicImage`:
1762
- * use photon_rs::effects::primary;
1763
- * use photon_rs::native::open_image;
1764
- *
1765
- * let mut img = open_image("img.jpg").expect("File should open");
1766
- * primary(&mut img);
1767
- * ```
1768
- * @param {PhotonImage} img
1769
- */
1770
- module.exports.primary = function(img) {
1771
- _assertClass(img, PhotonImage);
1772
- wasm.primary(img.ptr);
1773
- };
1774
-
1775
- /**
1776
- * Colorizes the green channels of the image.
1777
- *
1778
- * # Arguments
1779
- * * `img` - A PhotonImage that contains a view into the image.
1780
- * # Example
1781
- *
1782
- * ```no_run
1783
- * // For example, to colorize an image of type `PhotonImage`:
1784
- * use photon_rs::effects::colorize;
1785
- * use photon_rs::native::open_image;
1786
- *
1787
- * let mut img = open_image("img.jpg").expect("File should open");
1788
- * colorize(&mut img);
1789
- * ```
1790
- * @param {PhotonImage} photon_image
1791
- */
1792
- module.exports.colorize = function(photon_image) {
1793
- _assertClass(photon_image, PhotonImage);
1794
- wasm.colorize(photon_image.ptr);
1795
- };
1796
-
1797
- /**
1798
- * Applies a solarizing effect to an image.
1799
- *
1800
- * # Arguments
1801
- * * `img` - A PhotonImage that contains a view into the image.
1802
- * # Example
1803
- *
1804
- * ```no_run
1805
- * // For example, to colorize an image of type `PhotonImage`:
1806
- * use photon_rs::effects::solarize;
1807
- * use photon_rs::native::open_image;
1808
- *
1809
- * let mut img = open_image("img.jpg").expect("File should open");
1810
- * solarize(&mut img);
1811
- * ```
1812
- * @param {PhotonImage} photon_image
1813
- */
1814
- module.exports.solarize = function(photon_image) {
1815
- _assertClass(photon_image, PhotonImage);
1816
- wasm.solarize(photon_image.ptr);
1817
- };
1818
-
1819
- /**
1820
- * Applies a solarizing effect to an image and returns the resulting PhotonImage.
1821
- *
1822
- * # Arguments
1823
- * * `img` - A PhotonImage that contains a view into the image.
1824
- * # Example
1825
- *
1826
- * ```no_run
1827
- * // For example, to solarize "retimg" an image of type `PhotonImage`:
1828
- * use photon_rs::effects::solarize_retimg;
1829
- * use photon_rs::native::open_image;
1830
- * use photon_rs::PhotonImage;
1831
- *
1832
- * let img = open_image("img.jpg").expect("File should open");
1833
- * let result: PhotonImage = solarize_retimg(&img);
1834
- * ```
1835
- * @param {PhotonImage} photon_image
1836
- * @returns {PhotonImage}
1837
- */
1838
- module.exports.solarize_retimg = function(photon_image) {
1839
- _assertClass(photon_image, PhotonImage);
1840
- var ret = wasm.solarize_retimg(photon_image.ptr);
1841
- return PhotonImage.__wrap(ret);
1842
- };
1843
-
1844
- /**
1845
- * Increase the brightness of an image by a factor.
1846
- *
1847
- * # Arguments
1848
- * * `img` - A PhotonImage that contains a view into the image.
1849
- * * `brightness` - A u8 to add to the brightness.
1850
- * # Example
1851
- *
1852
- * ```no_run
1853
- * use photon_rs::effects::inc_brightness;
1854
- * use photon_rs::native::open_image;
1855
- *
1856
- * let mut img = open_image("img.jpg").expect("File should open");
1857
- * inc_brightness(&mut img, 10_u8);
1858
- * ```
1859
- * @param {PhotonImage} photon_image
1860
- * @param {number} brightness
1861
- */
1862
- module.exports.inc_brightness = function(photon_image, brightness) {
1863
- _assertClass(photon_image, PhotonImage);
1864
- wasm.inc_brightness(photon_image.ptr, brightness);
1865
- };
1866
-
1867
- /**
1868
- * Adjust the contrast of an image by a factor.
1869
- *
1870
- * # Arguments
1871
- * * `photon_image` - A PhotonImage that contains a view into the image.
1872
- * * `contrast` - An f32 factor used to adjust contrast. Between [-255.0, 255.0]. The algorithm will
1873
- * clamp results if passed factor is out of range.
1874
- * # Example
1875
- *
1876
- * ```no_run
1877
- * use photon_rs::effects::adjust_contrast;
1878
- * use photon_rs::native::open_image;
1879
- *
1880
- * let mut img = open_image("img.jpg").expect("File should open");
1881
- * adjust_contrast(&mut img, 30_f32);
1882
- * ```
1883
- * @param {PhotonImage} photon_image
1884
- * @param {number} contrast
1885
- */
1886
- module.exports.adjust_contrast = function(photon_image, contrast) {
1887
- _assertClass(photon_image, PhotonImage);
1888
- wasm.adjust_contrast(photon_image.ptr, contrast);
1889
- };
1890
-
1891
- /**
1892
- * Tint an image by adding an offset to averaged RGB channel values.
1893
- *
1894
- * # Arguments
1895
- * * `img` - A PhotonImage that contains a view into the image.
1896
- * * `r_offset` - The amount the R channel should be incremented by.
1897
- * * `g_offset` - The amount the G channel should be incremented by.
1898
- * * `b_offset` - The amount the B channel should be incremented by.
1899
- * # Example
1900
- *
1901
- * ```no_run
1902
- * // For example, to tint an image of type `PhotonImage`:
1903
- * use photon_rs::effects::tint;
1904
- * use photon_rs::native::open_image;
1905
- *
1906
- * let mut img = open_image("img.jpg").expect("File should open");
1907
- * tint(&mut img, 10_u32, 20_u32, 15_u32);
1908
- * ```
1909
- * @param {PhotonImage} photon_image
1910
- * @param {number} r_offset
1911
- * @param {number} g_offset
1912
- * @param {number} b_offset
1913
- */
1914
- module.exports.tint = function(photon_image, r_offset, g_offset, b_offset) {
1915
- _assertClass(photon_image, PhotonImage);
1916
- wasm.tint(photon_image.ptr, r_offset, g_offset, b_offset);
1917
- };
1918
-
1919
- /**
1920
- * Horizontal strips. Divide an image into a series of equal-height strips, for an artistic effect.
1921
- *
1922
- * # Arguments
1923
- * * `img` - A PhotonImage that contains a view into the image.
1924
- * * `num_strips` - The number of strips
1925
- * # Example
1926
- *
1927
- * ```no_run
1928
- * // For example, to draw horizontal strips on a `PhotonImage`:
1929
- * use photon_rs::effects::horizontal_strips;
1930
- * use photon_rs::native::open_image;
1931
- *
1932
- * let mut img = open_image("img.jpg").expect("File should open");
1933
- * horizontal_strips(&mut img, 8u8);
1934
- * ```
1935
- * @param {PhotonImage} photon_image
1936
- * @param {number} num_strips
1937
- */
1938
- module.exports.horizontal_strips = function(photon_image, num_strips) {
1939
- _assertClass(photon_image, PhotonImage);
1940
- wasm.horizontal_strips(photon_image.ptr, num_strips);
1941
- };
1942
-
1943
- /**
1944
- * Horizontal strips. Divide an image into a series of equal-width strips, for an artistic effect. Sepcify a color as well.
1945
- *
1946
- * # Arguments
1947
- * * `img` - A PhotonImage that contains a view into the image.
1948
- * * `num_strips` - The numbder of strips
1949
- * * `color` - Color of strips.
1950
- * # Example
1951
- *
1952
- * ```no_run
1953
- * // For example, to draw blue horizontal strips on a `PhotonImage`:
1954
- * use photon_rs::effects::color_horizontal_strips;
1955
- * use photon_rs::native::open_image;
1956
- * use photon_rs::Rgb;
1957
- *
1958
- * let color = Rgb::new(255u8, 0u8, 0u8);
1959
- * let mut img = open_image("img.jpg").expect("File should open");
1960
- * color_horizontal_strips(&mut img, 8u8, color);
1961
- * ```
1962
- * @param {PhotonImage} photon_image
1963
- * @param {number} num_strips
1964
- * @param {Rgb} color
1965
- */
1966
- module.exports.color_horizontal_strips = function(photon_image, num_strips, color) {
1967
- _assertClass(photon_image, PhotonImage);
1968
- _assertClass(color, Rgb);
1969
- var ptr0 = color.ptr;
1970
- color.ptr = 0;
1971
- wasm.color_horizontal_strips(photon_image.ptr, num_strips, ptr0);
1972
- };
1973
-
1974
- /**
1975
- * Vertical strips. Divide an image into a series of equal-width strips, for an artistic effect.
1976
- *
1977
- * # Arguments
1978
- * * `img` - A PhotonImage that contains a view into the image.
1979
- * * `num_strips` - The numbder of strips
1980
- * # Example
1981
- *
1982
- * ```no_run
1983
- * // For example, to draw vertical strips on a `PhotonImage`:
1984
- * use photon_rs::effects::vertical_strips;
1985
- * use photon_rs::native::open_image;
1986
- *
1987
- * let mut img = open_image("img.jpg").expect("File should open");
1988
- * vertical_strips(&mut img, 8u8);
1989
- * ```
1990
- * @param {PhotonImage} photon_image
1991
- * @param {number} num_strips
1992
- */
1993
- module.exports.vertical_strips = function(photon_image, num_strips) {
1994
- _assertClass(photon_image, PhotonImage);
1995
- wasm.vertical_strips(photon_image.ptr, num_strips);
1996
- };
1997
-
1998
- /**
1999
- * Vertical strips. Divide an image into a series of equal-width strips, for an artistic effect. Sepcify a color as well.
2000
- *
2001
- * # Arguments
2002
- * * `img` - A PhotonImage that contains a view into the image.
2003
- * * `num_strips` - The numbder of strips
2004
- * * `color` - Color of strips.
2005
- * # Example
2006
- *
2007
- * ```no_run
2008
- * // For example, to draw red vertical strips on a `PhotonImage`:
2009
- * use photon_rs::effects::color_vertical_strips;
2010
- * use photon_rs::native::open_image;
2011
- * use photon_rs::Rgb;
2012
- *
2013
- * let color = Rgb::new(255u8, 0u8, 0u8);
2014
- * let mut img = open_image("img.jpg").expect("File should open");
2015
- * color_vertical_strips(&mut img, 8u8, color);
2016
- * ```
2017
- * @param {PhotonImage} photon_image
2018
- * @param {number} num_strips
2019
- * @param {Rgb} color
2020
- */
2021
- module.exports.color_vertical_strips = function(photon_image, num_strips, color) {
2022
- _assertClass(photon_image, PhotonImage);
2023
- _assertClass(color, Rgb);
2024
- var ptr0 = color.ptr;
2025
- color.ptr = 0;
2026
- wasm.color_vertical_strips(photon_image.ptr, num_strips, ptr0);
2027
- };
2028
-
2029
- /**
2030
- * Turn an image into an oil painting
2031
- *
2032
- * # Arguments
2033
- * * `img` - A PhotonImage that contains a view into the image.
2034
- * * `radius` - Radius of each paint particle
2035
- * * `intesnity` - How artsy an Image should be
2036
- * # Example
2037
- *
2038
- * ```no_run
2039
- * // For example, to oil an image of type `PhotonImage`:
2040
- * use photon_rs::effects::oil;
2041
- * use photon_rs::native::open_image;
2042
- *
2043
- * let mut img = open_image("img.jpg").expect("File should open");
2044
- * oil(&mut img, 4i32, 55.0);
2045
- * ```
2046
- * @param {PhotonImage} photon_image
2047
- * @param {number} radius
2048
- * @param {number} intensity
2049
- */
2050
- module.exports.oil = function(photon_image, radius, intensity) {
2051
- _assertClass(photon_image, PhotonImage);
2052
- wasm.oil(photon_image.ptr, radius, intensity);
2053
- };
2054
-
2055
- /**
2056
- * Turn an image into an frosted glass see through
2057
- *
2058
- * # Arguments
2059
- * * `img` - A PhotonImage that contains a view into the image.
2060
- * # Example
2061
- *
2062
- * ```no_run
2063
- * // For example, to turn an image of type `PhotonImage` into frosted glass see through:
2064
- * use photon_rs::effects::frosted_glass;
2065
- * use photon_rs::native::open_image;
2066
- *
2067
- * let mut img = open_image("img.jpg").expect("File should open");
2068
- * frosted_glass(&mut img);
2069
- * ```
2070
- * @param {PhotonImage} photon_image
2071
- */
2072
- module.exports.frosted_glass = function(photon_image) {
2073
- _assertClass(photon_image, PhotonImage);
2074
- wasm.frosted_glass(photon_image.ptr);
2075
- };
2076
-
2077
- /**
2078
- * Pixelize an image.
2079
- *
2080
- * # Arguments
2081
- * * `photon_image` - A PhotonImage that contains a view into the image.
2082
- * * `pixel_size` - Targeted pixel size of generated image.
2083
- * # Example
2084
- *
2085
- * ```no_run
2086
- * // For example, to turn an image of type `PhotonImage` into a pixelized image with 50 pixels blocks:
2087
- * use photon_rs::effects::pixelize;
2088
- * use photon_rs::native::open_image;
2089
- *
2090
- * let mut img = open_image("img.jpg").expect("File should open");
2091
- * pixelize(&mut img, 50);
2092
- * ```
2093
- * @param {PhotonImage} photon_image
2094
- * @param {number} pixel_size
2095
- */
2096
- module.exports.pixelize = function(photon_image, pixel_size) {
2097
- _assertClass(photon_image, PhotonImage);
2098
- wasm.pixelize(photon_image.ptr, pixel_size);
2099
- };
2100
-
2101
- /**
2102
- * Normalizes an image by remapping its range of pixels values. Only RGB
2103
- * channels are processed and each channel is stretched to \[0, 255\] range
2104
- * independently. This process is also known as contrast stretching.
2105
- * # Arguments
2106
- * * `photon_image` - A PhotonImage that contains a view into the image.
2107
- * # Example
2108
- *
2109
- * ```no_run
2110
- * // For example, to turn an image of type `PhotonImage` into a normalized image:
2111
- * use photon_rs::effects::normalize;
2112
- * use photon_rs::native::open_image;
2113
- *
2114
- * let mut img = open_image("img.jpg").expect("File should open");
2115
- * normalize(&mut img);
2116
- * ```
2117
- * @param {PhotonImage} photon_image
2118
- */
2119
- module.exports.normalize = function(photon_image) {
2120
- _assertClass(photon_image, PhotonImage);
2121
- wasm.normalize(photon_image.ptr);
2122
- };
2123
-
2124
- /**
2125
- * Applies Floyd-Steinberg dithering to an image.
2126
- * Only RGB channels are processed, alpha remains unchanged.
2127
- * # Arguments
2128
- * * `photon_image` - A PhotonImage that contains a view into the image.
2129
- * * `depth` - bits per channel. Clamped between 1 and 8.
2130
- * # Example
2131
- *
2132
- * ```no_run
2133
- * // For example, to turn an image of type `PhotonImage` into a dithered image:
2134
- * use photon_rs::effects::dither;
2135
- * use photon_rs::native::open_image;
2136
- *
2137
- * let mut img = open_image("img.jpg").expect("File should open");
2138
- * let depth = 1;
2139
- * dither(&mut img, depth);
2140
- * ```
2141
- * @param {PhotonImage} photon_image
2142
- * @param {number} depth
2143
- */
2144
- module.exports.dither = function(photon_image, depth) {
2145
- _assertClass(photon_image, PhotonImage);
2146
- wasm.dither(photon_image.ptr, depth);
2147
- };
2148
-
2149
- /**
2150
- * @param {PhotonImage} photon_image
2151
- * @param {Rgb} color_a
2152
- * @param {Rgb} color_b
2153
- */
2154
- module.exports.duotone = function(photon_image, color_a, color_b) {
2155
- _assertClass(photon_image, PhotonImage);
2156
- _assertClass(color_a, Rgb);
2157
- var ptr0 = color_a.ptr;
2158
- color_a.ptr = 0;
2159
- _assertClass(color_b, Rgb);
2160
- var ptr1 = color_b.ptr;
2161
- color_b.ptr = 0;
2162
- wasm.duotone(photon_image.ptr, ptr0, ptr1);
2163
- };
2164
-
2165
- /**
2166
- * Solarization on the Blue channel.
2167
- *
2168
- * # Arguments
2169
- * * `img` - A PhotonImage.
2170
- * # Example
2171
- *
2172
- * ```no_run
2173
- * use photon_rs::filters::neue;
2174
- * use photon_rs::native::open_image;
2175
- *
2176
- * let mut img = open_image("img.jpg").expect("File should open");
2177
- * neue(&mut img);
2178
- * ```
2179
- * @param {PhotonImage} photon_image
2180
- */
2181
- module.exports.neue = function(photon_image) {
2182
- _assertClass(photon_image, PhotonImage);
2183
- wasm.neue(photon_image.ptr);
2184
- };
2185
-
2186
- /**
2187
- * Solarization on the Red and Green channels.
2188
- *
2189
- * # Arguments
2190
- * * `img` - A PhotonImage.
2191
- * # Example
2192
- *
2193
- * ```no_run
2194
- * use photon_rs::filters::lix;
2195
- * use photon_rs::native::open_image;
2196
- *
2197
- * let mut img = open_image("img.jpg").expect("File should open");
2198
- * lix(&mut img);
2199
- * ```
2200
- * @param {PhotonImage} photon_image
2201
- */
2202
- module.exports.lix = function(photon_image) {
2203
- _assertClass(photon_image, PhotonImage);
2204
- wasm.lix(photon_image.ptr);
2205
- };
2206
-
2207
- /**
2208
- * Solarization on the Red and Blue channels.
2209
- *
2210
- * # Arguments
2211
- * * `img` - A PhotonImage.
2212
- * # Example
2213
- *
2214
- * ```no_run
2215
- * use photon_rs::filters::ryo;
2216
- * use photon_rs::native::open_image;
2217
- *
2218
- * let mut img = open_image("img.jpg").expect("File should open");
2219
- * ryo(&mut img);
2220
- * ```
2221
- * @param {PhotonImage} photon_image
2222
- */
2223
- module.exports.ryo = function(photon_image) {
2224
- _assertClass(photon_image, PhotonImage);
2225
- wasm.ryo(photon_image.ptr);
2226
- };
2227
-
2228
- /**
2229
- * Apply a filter to an image. Over 20 filters are available.
2230
- * The filters are as follows:
2231
- * * **oceanic**: Add an aquamarine-tinted hue to an image.
2232
- * * **islands**: Aquamarine tint.
2233
- * * **marine**: Add a green/blue mixed hue to an image.
2234
- * * **seagreen**: Dark green hue, with tones of blue.
2235
- * * **flagblue**: Royal blue tint
2236
- * * **liquid**: Blue-inspired tint.
2237
- * * **diamante**: Custom filter with a blue/turquoise tint.
2238
- * * **radio**: Fallout-style radio effect.
2239
- * * **twenties**: Slight-blue tinted historical effect.
2240
- * * **rosetint**: Rose-tinted filter.
2241
- * * **mauve**: Purple-infused filter.
2242
- * * **bluechrome**: Blue monochrome effect.
2243
- * * **vintage**: Vintage filter with a red tint.
2244
- * * **perfume**: Increase the blue channel, with moderate increases in the Red and Green channels.
2245
- * * **serenity**: Custom filter with an increase in the Blue channel's values.
2246
- * # Arguments
2247
- * * `img` - A PhotonImage.
2248
- * * `filter_name` - The filter's name. Choose from the selection above, eg: "oceanic"
2249
- * # Example
2250
- *
2251
- * ```no_run
2252
- * // For example, to add a filter called "vintage" to an image:
2253
- * use photon_rs::filters::filter;
2254
- * use photon_rs::native::open_image;
2255
- *
2256
- * let mut img = open_image("img.jpg").expect("File should open");
2257
- * filter(&mut img, "vintage");
2258
- * ```
2259
- * @param {PhotonImage} img
2260
- * @param {string} filter_name
2261
- */
2262
- module.exports.filter = function(img, filter_name) {
2263
- _assertClass(img, PhotonImage);
2264
- var ptr0 = passStringToWasm0(filter_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2265
- var len0 = WASM_VECTOR_LEN;
2266
- wasm.filter(img.ptr, ptr0, len0);
2267
- };
2268
-
2269
- /**
2270
- * Apply a lofi effect to an image.
2271
- *
2272
- * # Arguments
2273
- * * `img` - A PhotonImage.
2274
- * # Example
2275
- *
2276
- * ```no_run
2277
- * use photon_rs::filters::lofi;
2278
- * use photon_rs::native::open_image;
2279
- *
2280
- * let mut img = open_image("img.jpg").expect("File should open");
2281
- * lofi(&mut img);
2282
- * ```
2283
- * @param {PhotonImage} img
2284
- */
2285
- module.exports.lofi = function(img) {
2286
- _assertClass(img, PhotonImage);
2287
- wasm.lofi(img.ptr);
2288
- };
2289
-
2290
- /**
2291
- * Apply a rose tint to an image.
2292
- *
2293
- * # Arguments
2294
- * * `img` - A PhotonImage.
2295
- * # Example
2296
- *
2297
- * ```no_run
2298
- * use photon_rs::filters::pastel_pink;
2299
- * use photon_rs::native::open_image;
2300
- *
2301
- * let mut img = open_image("img.jpg").expect("File should open");
2302
- * pastel_pink(&mut img);
2303
- * ```
2304
- * @param {PhotonImage} img
2305
- */
2306
- module.exports.pastel_pink = function(img) {
2307
- _assertClass(img, PhotonImage);
2308
- wasm.pastel_pink(img.ptr);
2309
- };
2310
-
2311
- /**
2312
- * Apply a vintage, golden hue to an image.
2313
- *
2314
- * # Arguments
2315
- * * `img` - A PhotonImage.
2316
- * # Example
2317
- *
2318
- * ```no_run
2319
- * use photon_rs::filters::golden;
2320
- * use photon_rs::native::open_image;
2321
- *
2322
- * let mut img = open_image("img.jpg").expect("File should open");
2323
- * golden(&mut img);
2324
- * ```
2325
- * @param {PhotonImage} img
2326
- */
2327
- module.exports.golden = function(img) {
2328
- _assertClass(img, PhotonImage);
2329
- wasm.golden(img.ptr);
2330
- };
2331
-
2332
- /**
2333
- * Increased contrast filter effect.
2334
- *
2335
- * # Arguments
2336
- * * `img` - A PhotonImage.
2337
- * # Example
2338
- *
2339
- * ```no_run
2340
- * use photon_rs::filters::cali;
2341
- * use photon_rs::native::open_image;
2342
- *
2343
- * let mut img = open_image("img.jpg").expect("File should open");
2344
- * cali(&mut img);
2345
- * ```
2346
- * @param {PhotonImage} img
2347
- */
2348
- module.exports.cali = function(img) {
2349
- _assertClass(img, PhotonImage);
2350
- wasm.cali(img.ptr);
2351
- };
2352
-
2353
- /**
2354
- * Greyscale effect with increased contrast.
2355
- *
2356
- * # Arguments
2357
- * * `img` - A PhotonImage.
2358
- * # Example
2359
- *
2360
- * ```no_run
2361
- * use photon_rs::filters::dramatic;
2362
- * use photon_rs::native::open_image;
2363
- *
2364
- * let mut img = open_image("img.jpg").expect("File should open");
2365
- * dramatic(&mut img);
2366
- * ```
2367
- * @param {PhotonImage} img
2368
- */
2369
- module.exports.dramatic = function(img) {
2370
- _assertClass(img, PhotonImage);
2371
- wasm.dramatic(img.ptr);
2372
- };
2373
-
2374
- /**
2375
- * Monochrome tint effect with increased contrast
2376
- *
2377
- * # Arguments
2378
- * * `img` - A PhotonImage.
2379
- * * `rgb_color` - RGB color
2380
- * # Example
2381
- *
2382
- * ```no_run
2383
- * use photon_rs::filters::monochrome_tint;
2384
- * use photon_rs::native::open_image;
2385
- * use photon_rs::Rgb;
2386
- *
2387
- * let mut img = open_image("img.jpg").expect("File should open");
2388
- * let rgb_color = Rgb::new(12, 12, 10);
2389
- * monochrome_tint(&mut img, rgb_color);
2390
- * ```
2391
- * @param {PhotonImage} img
2392
- * @param {Rgb} rgb_color
2393
- */
2394
- module.exports.monochrome_tint = function(img, rgb_color) {
2395
- _assertClass(img, PhotonImage);
2396
- _assertClass(rgb_color, Rgb);
2397
- var ptr0 = rgb_color.ptr;
2398
- rgb_color.ptr = 0;
2399
- wasm.monochrome_tint(img.ptr, ptr0);
2400
- };
2401
-
2402
- /**
2403
- * Duotone effect with blue and purple tones.
2404
- *
2405
- * # Arguments
2406
- * * `img` - A PhotonImage.
2407
- * # Example
2408
- *
2409
- * ```no_run
2410
- * use photon_rs::filters::duotone_violette;
2411
- * use photon_rs::native::open_image;
2412
- *
2413
- * let mut img = open_image("img.jpg").expect("File should open");
2414
- * duotone_violette(&mut img);
2415
- * ```
2416
- * @param {PhotonImage} img
2417
- */
2418
- module.exports.duotone_violette = function(img) {
2419
- _assertClass(img, PhotonImage);
2420
- wasm.duotone_violette(img.ptr);
2421
- };
2422
-
2423
- /**
2424
- * Duotone effect with purple tones.
2425
- *
2426
- * # Arguments
2427
- * * `img` - A PhotonImage.
2428
- * # Example
2429
- *
2430
- * ```no_run
2431
- * use photon_rs::filters::duotone_horizon;
2432
- * use photon_rs::native::open_image;
2433
- *
2434
- * let mut img = open_image("img.jpg").expect("File should open");
2435
- * duotone_horizon(&mut img);
2436
- * ```
2437
- * @param {PhotonImage} img
2438
- */
2439
- module.exports.duotone_horizon = function(img) {
2440
- _assertClass(img, PhotonImage);
2441
- wasm.duotone_horizon(img.ptr);
2442
- };
2443
-
2444
- /**
2445
- * A duotone filter with a user-specified color and a gray color
2446
- *
2447
- * # Arguments
2448
- * * `img` - A PhotonImage.
2449
- * * `rgb_color` - RGB color
2450
- * # Example
2451
- *
2452
- * ```no_run
2453
- * use photon_rs::filters::duotone_tint;
2454
- * use photon_rs::native::open_image;
2455
- * use photon_rs::Rgb;
2456
- *
2457
- * let mut img = open_image("img.jpg").expect("File should open");
2458
- * let rgb_color = Rgb::new(12, 12, 10);
2459
- * duotone_tint(&mut img, rgb_color);
2460
- * ```
2461
- * @param {PhotonImage} img
2462
- * @param {Rgb} rgb_color
2463
- */
2464
- module.exports.duotone_tint = function(img, rgb_color) {
2465
- _assertClass(img, PhotonImage);
2466
- _assertClass(rgb_color, Rgb);
2467
- var ptr0 = rgb_color.ptr;
2468
- rgb_color.ptr = 0;
2469
- wasm.duotone_tint(img.ptr, ptr0);
2470
- };
2471
-
2472
- /**
2473
- * Duotone effect with a lilac hue
2474
- *
2475
- * # Arguments
2476
- * * `img` - A PhotonImage.
2477
- * # Example
2478
- *
2479
- * ```no_run
2480
- * use photon_rs::filters::duotone_lilac;
2481
- * use photon_rs::native::open_image;
2482
- *
2483
- * let mut img = open_image("img.jpg").expect("File should open");
2484
- * duotone_lilac(&mut img);
2485
- * ```
2486
- * @param {PhotonImage} img
2487
- */
2488
- module.exports.duotone_lilac = function(img) {
2489
- _assertClass(img, PhotonImage);
2490
- wasm.duotone_lilac(img.ptr);
2491
- };
2492
-
2493
- /**
2494
- * A duotone ochre tint effect
2495
- *
2496
- * # Arguments
2497
- * * `img` - A PhotonImage.
2498
- * # Example
2499
- *
2500
- * ```no_run
2501
- * use photon_rs::filters::duotone_ochre;
2502
- * use photon_rs::native::open_image;
2503
- *
2504
- * let mut img = open_image("img.jpg").expect("File should open");
2505
- * duotone_ochre(&mut img);
2506
- * ```
2507
- * @param {PhotonImage} img
2508
- */
2509
- module.exports.duotone_ochre = function(img) {
2510
- _assertClass(img, PhotonImage);
2511
- wasm.duotone_ochre(img.ptr);
2512
- };
2513
-
2514
- /**
2515
- * Apply a red hue, with increased contrast and brightness.
2516
- *
2517
- * # Arguments
2518
- * * `img` - A PhotonImage.
2519
- * # Example
2520
- *
2521
- * ```no_run
2522
- * use photon_rs::filters::firenze;
2523
- * use photon_rs::native::open_image;
2524
- *
2525
- * let mut img = open_image("img.jpg").expect("File should open");
2526
- * firenze(&mut img);
2527
- * ```
2528
- * @param {PhotonImage} img
2529
- */
2530
- module.exports.firenze = function(img) {
2531
- _assertClass(img, PhotonImage);
2532
- wasm.firenze(img.ptr);
2533
- };
2534
-
2535
- /**
2536
- * Apply a greyscale effect with increased contrast.
2537
- *
2538
- * # Arguments
2539
- * * `img` - A PhotonImage.
2540
- * # Example
2541
- *
2542
- * ```no_run
2543
- * use photon_rs::filters::obsidian;
2544
- * use photon_rs::native::open_image;
2545
- *
2546
- * let mut img = open_image("img.jpg").expect("File should open");
2547
- * obsidian(&mut img);
2548
- * ```
2549
- * @param {PhotonImage} img
2550
- */
2551
- module.exports.obsidian = function(img) {
2552
- _assertClass(img, PhotonImage);
2553
- wasm.obsidian(img.ptr);
2554
- };
2555
-
2556
- /**
2557
- * Applies gamma correction to an image.
2558
- * # Arguments
2559
- * * `photon_image` - A PhotonImage that contains a view into the image.
2560
- * * `red` - Gamma value for red channel.
2561
- * * `green` - Gamma value for green channel.
2562
- * * `blue` - Gamma value for blue channel.
2563
- * # Example
2564
- *
2565
- * ```no_run
2566
- * // For example, to turn an image of type `PhotonImage` into a gamma corrected image:
2567
- * use photon_rs::colour_spaces::gamma_correction;
2568
- * use photon_rs::native::open_image;
2569
- *
2570
- * let mut img = open_image("img.jpg").expect("File should open");
2571
- * gamma_correction(&mut img, 2.2, 2.2, 2.2);
2572
- * ```
2573
- * @param {PhotonImage} photon_image
2574
- * @param {number} red
2575
- * @param {number} green
2576
- * @param {number} blue
2577
- */
2578
- module.exports.gamma_correction = function(photon_image, red, green, blue) {
2579
- _assertClass(photon_image, PhotonImage);
2580
- wasm.gamma_correction(photon_image.ptr, red, green, blue);
2581
- };
2582
-
2583
- /**
2584
- * Image manipulation effects in the HSLuv colour space
2585
- *
2586
- * Effects include:
2587
- * * **saturate** - Saturation increase.
2588
- * * **desaturate** - Desaturate the image.
2589
- * * **shift_hue** - Hue rotation by a specified number of degrees.
2590
- * * **darken** - Decrease the brightness.
2591
- * * **lighten** - Increase the brightness.
2592
- *
2593
- * # Arguments
2594
- * * `photon_image` - A PhotonImage.
2595
- * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
2596
- * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
2597
- * # Example
2598
- * ```no_run
2599
- * // For example to increase the saturation by 10%:
2600
- * use photon_rs::colour_spaces::hsluv;
2601
- * use photon_rs::native::open_image;
2602
- *
2603
- * // Open the image. A PhotonImage is returned.
2604
- * let mut img = open_image("img.jpg").expect("File should open");
2605
- * hsluv(&mut img, "saturate", 0.1_f32);
2606
- * ```
2607
- * @param {PhotonImage} photon_image
2608
- * @param {string} mode
2609
- * @param {number} amt
2610
- */
2611
- module.exports.hsluv = function(photon_image, mode, amt) {
2612
- _assertClass(photon_image, PhotonImage);
2613
- var ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2614
- var len0 = WASM_VECTOR_LEN;
2615
- wasm.hsluv(photon_image.ptr, ptr0, len0, amt);
2616
- };
2617
-
2618
- /**
2619
- * Image manipulation effects in the LCh colour space
2620
- *
2621
- * Effects include:
2622
- * * **saturate** - Saturation increase.
2623
- * * **desaturate** - Desaturate the image.
2624
- * * **shift_hue** - Hue rotation by a specified number of degrees.
2625
- * * **darken** - Decrease the brightness.
2626
- * * **lighten** - Increase the brightness.
2627
- *
2628
- * # Arguments
2629
- * * `photon_image` - A PhotonImage.
2630
- * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
2631
- * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
2632
- * # Example
2633
- * ```no_run
2634
- * // For example to increase the saturation by 10%:
2635
- * use photon_rs::colour_spaces::lch;
2636
- * use photon_rs::native::open_image;
2637
- *
2638
- * // Open the image. A PhotonImage is returned.
2639
- * let mut img = open_image("img.jpg").expect("File should open");
2640
- * lch(&mut img, "saturate", 0.1_f32);
2641
- * ```
2642
- * @param {PhotonImage} photon_image
2643
- * @param {string} mode
2644
- * @param {number} amt
2645
- */
2646
- module.exports.lch = function(photon_image, mode, amt) {
2647
- _assertClass(photon_image, PhotonImage);
2648
- var ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2649
- var len0 = WASM_VECTOR_LEN;
2650
- wasm.lch(photon_image.ptr, ptr0, len0, amt);
2651
- };
2652
-
2653
- /**
2654
- * Image manipulation effects in the HSL colour space.
2655
- *
2656
- * Effects include:
2657
- * * **saturate** - Saturation increase.
2658
- * * **desaturate** - Desaturate the image.
2659
- * * **shift_hue** - Hue rotation by a specified number of degrees.
2660
- * * **darken** - Decrease the brightness.
2661
- * * **lighten** - Increase the brightness.
2662
- *
2663
- * # Arguments
2664
- * * `photon_image` - A PhotonImage.
2665
- * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
2666
- * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
2667
- * # Example
2668
- * ```no_run
2669
- * // For example to increase the saturation by 10%:
2670
- * use photon_rs::colour_spaces::hsl;
2671
- * use photon_rs::native::open_image;
2672
- *
2673
- * // Open the image. A PhotonImage is returned.
2674
- * let mut img = open_image("img.jpg").expect("File should open");
2675
- * hsl(&mut img, "saturate", 0.1_f32);
2676
- * ```
2677
- * @param {PhotonImage} photon_image
2678
- * @param {string} mode
2679
- * @param {number} amt
2680
- */
2681
- module.exports.hsl = function(photon_image, mode, amt) {
2682
- _assertClass(photon_image, PhotonImage);
2683
- var ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2684
- var len0 = WASM_VECTOR_LEN;
2685
- wasm.hsl(photon_image.ptr, ptr0, len0, amt);
2686
- };
2687
-
2688
- /**
2689
- * Image manipulation in the HSV colour space.
2690
- *
2691
- * Effects include:
2692
- * * **saturate** - Saturation increase.
2693
- * * **desaturate** - Desaturate the image.
2694
- * * **shift_hue** - Hue rotation by a specified number of degrees.
2695
- * * **darken** - Decrease the brightness.
2696
- * * **lighten** - Increase the brightness.
2697
- *
2698
- * # Arguments
2699
- * * `photon_image` - A PhotonImage.
2700
- * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
2701
- * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
2702
- *
2703
- * # Example
2704
- * ```no_run
2705
- * // For example to increase the saturation by 10%:
2706
- * use photon_rs::colour_spaces::hsv;
2707
- * use photon_rs::native::open_image;
2708
- *
2709
- * // Open the image. A PhotonImage is returned.
2710
- * let mut img = open_image("img.jpg").expect("File should open");
2711
- * hsv(&mut img, "saturate", 0.1_f32);
2712
- * ```
2713
- * @param {PhotonImage} photon_image
2714
- * @param {string} mode
2715
- * @param {number} amt
2716
- */
2717
- module.exports.hsv = function(photon_image, mode, amt) {
2718
- _assertClass(photon_image, PhotonImage);
2719
- var ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2720
- var len0 = WASM_VECTOR_LEN;
2721
- wasm.hsv(photon_image.ptr, ptr0, len0, amt);
2722
- };
2723
-
2724
- /**
2725
- * Shift hue by a specified number of degrees in the HSL colour space.
2726
- * # Arguments
2727
- * * `img` - A PhotonImage.
2728
- * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
2729
- *
2730
- * # Example
2731
- * ```no_run
2732
- * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
2733
- * use photon_rs::colour_spaces::hue_rotate_hsl;
2734
- * use photon_rs::native::open_image;
2735
- *
2736
- * // Open the image. A PhotonImage is returned.
2737
- * let mut img = open_image("img.jpg").expect("File should open");
2738
- * hue_rotate_hsl(&mut img, 120_f32);
2739
- * ```
2740
- * @param {PhotonImage} img
2741
- * @param {number} degrees
2742
- */
2743
- module.exports.hue_rotate_hsl = function(img, degrees) {
2744
- _assertClass(img, PhotonImage);
2745
- wasm.hue_rotate_hsl(img.ptr, degrees);
2746
- };
2747
-
2748
- /**
2749
- * Shift hue by a specified number of degrees in the HSV colour space.
2750
- * # Arguments
2751
- * * `img` - A PhotonImage.
2752
- * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
2753
- *
2754
- * # Example
2755
- * ```no_run
2756
- * // For example to hue rotate/shift the hue by 120 degrees in the HSV colour space:
2757
- * use photon_rs::colour_spaces::hue_rotate_hsv;
2758
- * use photon_rs::native::open_image;
2759
- *
2760
- * // Open the image. A PhotonImage is returned.
2761
- * let mut img = open_image("img.jpg").expect("File should open");
2762
- * hue_rotate_hsv(&mut img, 120_f32);
2763
- * ```
2764
- * @param {PhotonImage} img
2765
- * @param {number} degrees
2766
- */
2767
- module.exports.hue_rotate_hsv = function(img, degrees) {
2768
- _assertClass(img, PhotonImage);
2769
- wasm.hue_rotate_hsv(img.ptr, degrees);
2770
- };
2771
-
2772
- /**
2773
- * Shift hue by a specified number of degrees in the LCh colour space.
2774
- * # Arguments
2775
- * * `img` - A PhotonImage.
2776
- * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
2777
- *
2778
- * # Example
2779
- * ```no_run
2780
- * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
2781
- * use photon_rs::colour_spaces::hue_rotate_lch;
2782
- * use photon_rs::native::open_image;
2783
- *
2784
- * // Open the image. A PhotonImage is returned.
2785
- * let mut img = open_image("img.jpg").expect("File should open");
2786
- * hue_rotate_lch(&mut img, 120_f32);
2787
- * ```
2788
- * @param {PhotonImage} img
2789
- * @param {number} degrees
2790
- */
2791
- module.exports.hue_rotate_lch = function(img, degrees) {
2792
- _assertClass(img, PhotonImage);
2793
- wasm.hue_rotate_lch(img.ptr, degrees);
2794
- };
2795
-
2796
- /**
2797
- * Shift hue by a specified number of degrees in the HSLuv colour space.
2798
- * # Arguments
2799
- * * `img` - A PhotonImage.
2800
- * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
2801
- *
2802
- * # Example
2803
- * ```no_run
2804
- * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
2805
- * use photon_rs::colour_spaces::hue_rotate_hsluv;
2806
- * use photon_rs::native::open_image;
2807
- *
2808
- * // Open the image. A PhotonImage is returned.
2809
- * let mut img = open_image("img.jpg").expect("File should open");
2810
- * hue_rotate_hsluv(&mut img, 120_f32);
2811
- * ```
2812
- * @param {PhotonImage} img
2813
- * @param {number} degrees
2814
- */
2815
- module.exports.hue_rotate_hsluv = function(img, degrees) {
2816
- _assertClass(img, PhotonImage);
2817
- wasm.hue_rotate_hsluv(img.ptr, degrees);
2818
- };
2819
-
2820
- /**
2821
- * Increase the image's saturation by converting each pixel's colour to the HSL colour space
2822
- * and increasing the colour's saturation.
2823
- * # Arguments
2824
- * * `img` - A PhotonImage.
2825
- * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
2826
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2827
- * Increasing saturation by 80% would be represented by a `level` of 0.8
2828
- *
2829
- * # Example
2830
- * ```no_run
2831
- * // For example to increase saturation by 10% in the HSL colour space:
2832
- * use photon_rs::colour_spaces::saturate_hsl;
2833
- * use photon_rs::native::open_image;
2834
- *
2835
- * // Open the image. A PhotonImage is returned.
2836
- * let mut img = open_image("img.jpg").expect("File should open");
2837
- * saturate_hsl(&mut img, 0.1_f32);
2838
- * ```
2839
- * @param {PhotonImage} img
2840
- * @param {number} level
2841
- */
2842
- module.exports.saturate_hsl = function(img, level) {
2843
- _assertClass(img, PhotonImage);
2844
- wasm.saturate_hsl(img.ptr, level);
2845
- };
2846
-
2847
- /**
2848
- * Increase the image's saturation in the LCh colour space.
2849
- * # Arguments
2850
- * * `img` - A PhotonImage.
2851
- * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
2852
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2853
- * Increasing saturation by 80% would be represented by a `level` of 0.8
2854
- *
2855
- * # Example
2856
- * ```no_run
2857
- * // For example to increase saturation by 40% in the Lch colour space:
2858
- * use photon_rs::colour_spaces::saturate_lch;
2859
- * use photon_rs::native::open_image;
2860
- *
2861
- * // Open the image. A PhotonImage is returned.
2862
- * let mut img = open_image("img.jpg").expect("File should open");
2863
- * saturate_lch(&mut img, 0.4_f32);
2864
- * ```
2865
- * @param {PhotonImage} img
2866
- * @param {number} level
2867
- */
2868
- module.exports.saturate_lch = function(img, level) {
2869
- _assertClass(img, PhotonImage);
2870
- wasm.saturate_lch(img.ptr, level);
2871
- };
2872
-
2873
- /**
2874
- * Increase the image's saturation in the HSLuv colour space.
2875
- * # Arguments
2876
- * * `img` - A PhotonImage.
2877
- * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
2878
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2879
- * Increasing saturation by 80% would be represented by a `level` of 0.8
2880
- *
2881
- * # Example
2882
- * ```no_run
2883
- * // For example to increase saturation by 40% in the HSLuv colour space:
2884
- * use photon_rs::colour_spaces::saturate_hsluv;
2885
- * use photon_rs::native::open_image;
2886
- *
2887
- * // Open the image. A PhotonImage is returned.
2888
- * let mut img = open_image("img.jpg").expect("File should open");
2889
- * saturate_hsluv(&mut img, 0.4_f32);
2890
- * ```
2891
- * @param {PhotonImage} img
2892
- * @param {number} level
2893
- */
2894
- module.exports.saturate_hsluv = function(img, level) {
2895
- _assertClass(img, PhotonImage);
2896
- wasm.saturate_hsluv(img.ptr, level);
2897
- };
2898
-
2899
- /**
2900
- * Increase the image's saturation in the HSV colour space.
2901
- * # Arguments
2902
- * * `img` - A PhotonImage.
2903
- * * `level` - Float value from 0 to 1 representing the level by which to increase the saturation by.
2904
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2905
- * Increasing saturation by 80% would be represented by a `level` of 0.8
2906
- *
2907
- * # Example
2908
- * ```no_run
2909
- * // For example to increase saturation by 30% in the HSV colour space:
2910
- * use photon_rs::colour_spaces::saturate_hsv;
2911
- * use photon_rs::native::open_image;
2912
- *
2913
- * // Open the image. A PhotonImage is returned.
2914
- * let mut img = open_image("img.jpg").expect("File should open");
2915
- * saturate_hsv(&mut img, 0.3_f32);
2916
- * ```
2917
- * @param {PhotonImage} img
2918
- * @param {number} level
2919
- */
2920
- module.exports.saturate_hsv = function(img, level) {
2921
- _assertClass(img, PhotonImage);
2922
- wasm.saturate_hsv(img.ptr, level);
2923
- };
2924
-
2925
- /**
2926
- * Lighten an image by a specified amount in the LCh colour space.
2927
- *
2928
- * # Arguments
2929
- * * `img` - A PhotonImage.
2930
- * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
2931
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2932
- * Lightening by 80% would be represented by a `level` of 0.8
2933
- *
2934
- * # Example
2935
- * ```no_run
2936
- * // For example to lighten an image by 10% in the LCh colour space:
2937
- * use photon_rs::colour_spaces::lighten_lch;
2938
- * use photon_rs::native::open_image;
2939
- *
2940
- * // Open the image. A PhotonImage is returned.
2941
- * let mut img = open_image("img.jpg").expect("File should open");
2942
- * lighten_lch(&mut img, 0.1_f32);
2943
- * ```
2944
- * @param {PhotonImage} img
2945
- * @param {number} level
2946
- */
2947
- module.exports.lighten_lch = function(img, level) {
2948
- _assertClass(img, PhotonImage);
2949
- wasm.lighten_lch(img.ptr, level);
2950
- };
2951
-
2952
- /**
2953
- * Lighten an image by a specified amount in the HSLuv colour space.
2954
- *
2955
- * # Arguments
2956
- * * `img` - A PhotonImage.
2957
- * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
2958
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2959
- * Lightening by 80% would be represented by a `level` of 0.8
2960
- *
2961
- * # Example
2962
- * ```no_run
2963
- * // For example to lighten an image by 10% in the HSLuv colour space:
2964
- * use photon_rs::colour_spaces::lighten_hsluv;
2965
- * use photon_rs::native::open_image;
2966
- *
2967
- * // Open the image. A PhotonImage is returned.
2968
- * let mut img = open_image("img.jpg").expect("File should open");
2969
- * lighten_hsluv(&mut img, 0.1_f32);
2970
- * ```
2971
- * @param {PhotonImage} img
2972
- * @param {number} level
2973
- */
2974
- module.exports.lighten_hsluv = function(img, level) {
2975
- _assertClass(img, PhotonImage);
2976
- wasm.lighten_hsluv(img.ptr, level);
2977
- };
2978
-
2979
- /**
2980
- * Lighten an image by a specified amount in the HSL colour space.
2981
- * # Arguments
2982
- * * `img` - A PhotonImage.
2983
- * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
2984
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
2985
- * Lightening by 80% would be represented by a `level` of 0.8
2986
- *
2987
- * # Example
2988
- * ```no_run
2989
- * // For example to lighten an image by 10% in the HSL colour space:
2990
- * use photon_rs::colour_spaces::lighten_hsl;
2991
- * use photon_rs::native::open_image;
2992
- *
2993
- * // Open the image. A PhotonImage is returned.
2994
- * let mut img = open_image("img.jpg").expect("File should open");
2995
- * lighten_hsl(&mut img, 0.1_f32);
2996
- * ```
2997
- * @param {PhotonImage} img
2998
- * @param {number} level
2999
- */
3000
- module.exports.lighten_hsl = function(img, level) {
3001
- _assertClass(img, PhotonImage);
3002
- wasm.lighten_hsl(img.ptr, level);
3003
- };
3004
-
3005
- /**
3006
- * Lighten an image by a specified amount in the HSV colour space.
3007
- *
3008
- * # Arguments
3009
- * * `img` - A PhotonImage.
3010
- * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
3011
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3012
- * Lightening by 80% would be represented by a `level` of 0.8
3013
- *
3014
- * # Example
3015
- * ```no_run
3016
- * // For example to lighten an image by 10% in the HSV colour space:
3017
- * use photon_rs::colour_spaces::lighten_hsv;
3018
- * use photon_rs::native::open_image;
3019
- *
3020
- * // Open the image. A PhotonImage is returned.
3021
- * let mut img = open_image("img.jpg").expect("File should open");
3022
- * lighten_hsv(&mut img, 0.1_f32);
3023
- * ```
3024
- * @param {PhotonImage} img
3025
- * @param {number} level
3026
- */
3027
- module.exports.lighten_hsv = function(img, level) {
3028
- _assertClass(img, PhotonImage);
3029
- wasm.lighten_hsv(img.ptr, level);
3030
- };
3031
-
3032
- /**
3033
- * Darken the image by a specified amount in the LCh colour space.
3034
- *
3035
- * # Arguments
3036
- * * `img` - A PhotonImage.
3037
- * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
3038
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3039
- * Darkening by 80% would be represented by a `level` of 0.8
3040
- *
3041
- * # Example
3042
- * ```no_run
3043
- * // For example to darken an image by 10% in the LCh colour space:
3044
- * use photon_rs::colour_spaces::darken_lch;
3045
- * use photon_rs::native::open_image;
3046
- *
3047
- * // Open the image. A PhotonImage is returned.
3048
- * let mut img = open_image("img.jpg").expect("File should open");
3049
- * darken_lch(&mut img, 0.1_f32);
3050
- * ```
3051
- * @param {PhotonImage} img
3052
- * @param {number} level
3053
- */
3054
- module.exports.darken_lch = function(img, level) {
3055
- _assertClass(img, PhotonImage);
3056
- wasm.darken_lch(img.ptr, level);
3057
- };
3058
-
3059
- /**
3060
- * Darken the image by a specified amount in the HSLuv colour space.
3061
- *
3062
- * # Arguments
3063
- * * `img` - A PhotonImage.
3064
- * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
3065
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3066
- * Darkening by 80% would be represented by a `level` of 0.8
3067
- *
3068
- * # Example
3069
- * ```no_run
3070
- * // For example to darken an image by 10% in the HSLuv colour space:
3071
- * use photon_rs::colour_spaces::darken_hsluv;
3072
- * use photon_rs::native::open_image;
3073
- *
3074
- * // Open the image. A PhotonImage is returned.
3075
- * let mut img = open_image("img.jpg").expect("File should open");
3076
- * darken_hsluv(&mut img, 0.1_f32);
3077
- * ```
3078
- * @param {PhotonImage} img
3079
- * @param {number} level
3080
- */
3081
- module.exports.darken_hsluv = function(img, level) {
3082
- _assertClass(img, PhotonImage);
3083
- wasm.darken_hsluv(img.ptr, level);
3084
- };
3085
-
3086
- /**
3087
- * Darken the image by a specified amount in the HSL colour space.
3088
- *
3089
- * # Arguments
3090
- * * `img` - A PhotonImage.
3091
- * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
3092
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3093
- * Darkening by 80% would be represented by a `level` of 0.8
3094
- *
3095
- * # Example
3096
- * ```no_run
3097
- * // For example to darken an image by 10% in the HSL colour space:
3098
- * use photon_rs::colour_spaces::darken_hsl;
3099
- * use photon_rs::native::open_image;
3100
- *
3101
- * // Open the image. A PhotonImage is returned.
3102
- * let mut img = open_image("img.jpg").expect("File should open");
3103
- * darken_hsl(&mut img, 0.1_f32);
3104
- * ```
3105
- * @param {PhotonImage} img
3106
- * @param {number} level
3107
- */
3108
- module.exports.darken_hsl = function(img, level) {
3109
- _assertClass(img, PhotonImage);
3110
- wasm.darken_hsl(img.ptr, level);
3111
- };
3112
-
3113
- /**
3114
- * Darken the image's colours by a specified amount in the HSV colour space.
3115
- *
3116
- * # Arguments
3117
- * * `img` - A PhotonImage.
3118
- * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
3119
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3120
- * Darkening by 80% would be represented by a `level` of 0.8
3121
- *
3122
- * # Example
3123
- * ```no_run
3124
- * // For example to darken an image by 10% in the HSV colour space:
3125
- * use photon_rs::colour_spaces::darken_hsv;
3126
- * use photon_rs::native::open_image;
3127
- *
3128
- * // Open the image. A PhotonImage is returned.
3129
- * let mut img = open_image("img.jpg").expect("File should open");
3130
- * darken_hsv(&mut img, 0.1_f32);
3131
- * ```
3132
- * @param {PhotonImage} img
3133
- * @param {number} level
3134
- */
3135
- module.exports.darken_hsv = function(img, level) {
3136
- _assertClass(img, PhotonImage);
3137
- wasm.darken_hsv(img.ptr, level);
3138
- };
3139
-
3140
- /**
3141
- * Desaturate the image by a specified amount in the HSV colour space.
3142
- *
3143
- * # Arguments
3144
- * * `img` - A PhotonImage.
3145
- * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
3146
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3147
- * Desaturating by 80% would be represented by a `level` of 0.8
3148
- *
3149
- * # Example
3150
- * ```no_run
3151
- * // For example to desaturate an image by 10% in the HSV colour space:
3152
- * use photon_rs::colour_spaces::desaturate_hsv;
3153
- * use photon_rs::native::open_image;
3154
- *
3155
- * // Open the image. A PhotonImage is returned.
3156
- * let mut img = open_image("img.jpg").expect("File should open");
3157
- * desaturate_hsv(&mut img, 0.1_f32);
3158
- * ```
3159
- * @param {PhotonImage} img
3160
- * @param {number} level
3161
- */
3162
- module.exports.desaturate_hsv = function(img, level) {
3163
- _assertClass(img, PhotonImage);
3164
- wasm.desaturate_hsv(img.ptr, level);
3165
- };
3166
-
3167
- /**
3168
- * Desaturate the image by a specified amount in the HSL colour space.
3169
- *
3170
- * # Arguments
3171
- * * `img` - A PhotonImage.
3172
- * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
3173
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3174
- * Desaturating by 80% would be represented by a `level` of 0.8
3175
- *
3176
- * # Example
3177
- * ```no_run
3178
- * // For example to desaturate an image by 10% in the LCh colour space:
3179
- * use photon_rs::colour_spaces::desaturate_hsl;
3180
- * use photon_rs::native::open_image;
3181
- *
3182
- * // Open the image. A PhotonImage is returned.
3183
- * let mut img = open_image("img.jpg").expect("File should open");
3184
- * desaturate_hsl(&mut img, 0.1_f32);
3185
- * ```
3186
- * @param {PhotonImage} img
3187
- * @param {number} level
3188
- */
3189
- module.exports.desaturate_hsl = function(img, level) {
3190
- _assertClass(img, PhotonImage);
3191
- wasm.desaturate_hsl(img.ptr, level);
3192
- };
3193
-
3194
- /**
3195
- * Desaturate the image by a specified amount in the LCh colour space.
3196
- *
3197
- * # Arguments
3198
- * * `img` - A PhotonImage.
3199
- * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
3200
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3201
- * Desaturating by 80% would be represented by a `level` of 0.8
3202
- *
3203
- * # Example
3204
- * ```no_run
3205
- * // For example to desaturate an image by 10% in the LCh colour space:
3206
- * use photon_rs::colour_spaces::desaturate_lch;
3207
- * use photon_rs::native::open_image;
3208
- *
3209
- * // Open the image. A PhotonImage is returned.
3210
- * let mut img = open_image("img.jpg").expect("File should open");
3211
- * desaturate_lch(&mut img, 0.1_f32);
3212
- * ```
3213
- * @param {PhotonImage} img
3214
- * @param {number} level
3215
- */
3216
- module.exports.desaturate_lch = function(img, level) {
3217
- _assertClass(img, PhotonImage);
3218
- wasm.desaturate_lch(img.ptr, level);
3219
- };
3220
-
3221
- /**
3222
- * Desaturate the image by a specified amount in the HSLuv colour space.
3223
- *
3224
- * # Arguments
3225
- * * `img` - A PhotonImage.
3226
- * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
3227
- * The `level` must be from 0 to 1 in floating-point, `f32` format.
3228
- * Desaturating by 80% would be represented by a `level` of 0.8
3229
- *
3230
- * # Example
3231
- * ```no_run
3232
- * // For example to desaturate an image by 10% in the HSLuv colour space:
3233
- * use photon_rs::colour_spaces::desaturate_hsluv;
3234
- * use photon_rs::native::open_image;
3235
- *
3236
- * // Open the image. A PhotonImage is returned.
3237
- * let mut img = open_image("img.jpg").expect("File should open");
3238
- * desaturate_hsluv(&mut img, 0.1_f32);
3239
- * ```
3240
- * @param {PhotonImage} img
3241
- * @param {number} level
3242
- */
3243
- module.exports.desaturate_hsluv = function(img, level) {
3244
- _assertClass(img, PhotonImage);
3245
- wasm.desaturate_hsluv(img.ptr, level);
3246
- };
3247
-
3248
- /**
3249
- * Mix image with a single color, supporting passing `opacity`.
3250
- * The algorithm comes from Jimp. See `function mix` and `function colorFn` at following link:
3251
- * https://github.com/oliver-moran/jimp/blob/29679faa597228ff2f20d34c5758e4d2257065a3/packages/plugin-color/src/index.js
3252
- * Specifically, result_value = (mix_color_value - origin_value) * opacity + origin_value =
3253
- * mix_color_value * opacity + (1 - opacity) * origin_value for each
3254
- * of RGB channel.
3255
- *
3256
- * # Arguments
3257
- * * `photon_image` - A PhotonImage that contains a view into the image.
3258
- * * `mix_color` - the color to be mixed in, as an RGB value.
3259
- * * `opacity` - the opacity of color when mixed to image. Float value from 0 to 1.
3260
- * # Example
3261
- *
3262
- * ```no_run
3263
- * // For example, to mix an image with rgb (50, 255, 254) and opacity 0.4:
3264
- * use photon_rs::Rgb;
3265
- * use photon_rs::colour_spaces::mix_with_colour;
3266
- * use photon_rs::native::open_image;
3267
- *
3268
- * let mix_colour = Rgb::new(50_u8, 255_u8, 254_u8);
3269
- * let mut img = open_image("img.jpg").expect("File should open");
3270
- * mix_with_colour(&mut img, mix_colour, 0.4_f32);
3271
- * ```
3272
- * @param {PhotonImage} photon_image
3273
- * @param {Rgb} mix_colour
3274
- * @param {number} opacity
3275
- */
3276
- module.exports.mix_with_colour = function(photon_image, mix_colour, opacity) {
3277
- _assertClass(photon_image, PhotonImage);
3278
- _assertClass(mix_colour, Rgb);
3279
- var ptr0 = mix_colour.ptr;
3280
- mix_colour.ptr = 0;
3281
- wasm.mix_with_colour(photon_image.ptr, ptr0, opacity);
3282
- };
3283
-
3284
- /**
3285
- * Add a watermark to an image.
3286
- *
3287
- * # Arguments
3288
- * * `img` - A DynamicImage that contains a view into the image.
3289
- * * `watermark` - The watermark to be placed onto the `img` image.
3290
- * * `x` - The x coordinate where the watermark's top corner should be positioned.
3291
- * * `y` - The y coordinate where the watermark's top corner should be positioned.
3292
- * # Example
3293
- *
3294
- * ```no_run
3295
- * // For example, to add a watermark to an image at x: 30, y: 40:
3296
- * use photon_rs::multiple::watermark;
3297
- * use photon_rs::native::open_image;
3298
- *
3299
- * let mut img = open_image("img.jpg").expect("File should open");
3300
- * let water_mark = open_image("watermark.jpg").expect("File should open");
3301
- * watermark(&mut img, &water_mark, 30_u32, 40_u32);
3302
- * ```
3303
- * @param {PhotonImage} img
3304
- * @param {PhotonImage} watermark
3305
- * @param {number} x
3306
- * @param {number} y
3307
- */
3308
- module.exports.watermark = function(img, watermark, x, y) {
3309
- _assertClass(img, PhotonImage);
3310
- _assertClass(watermark, PhotonImage);
3311
- wasm.watermark(img.ptr, watermark.ptr, x, y);
3312
- };
3313
-
3314
- /**
3315
- * Blend two images together.
3316
- *
3317
- * The `blend_mode` (3rd param) determines which blending mode to use; change this for varying effects.
3318
- * The blend modes available include: `overlay`, `over`, `atop`, `xor`, `multiply`, `burn`, `soft_light`, `hard_light`,
3319
- * `difference`, `lighten`, `darken`, `dodge`, `plus`, `exclusion` (more to come)
3320
- * NOTE: The first image must be smaller than the second image passed as params.
3321
- * If the first image were larger than the second, then there would be overflowing pixels which would have no corresponding pixels
3322
- * in the second image.
3323
- * # Arguments
3324
- * * `img` - A DynamicImage that contains a view into the image.
3325
- * * `img2` - The 2nd DynamicImage to be blended with the first.
3326
- * * `blend_mode` - The blending mode to use. See above for complete list of blend modes available.
3327
- * # Example
3328
- *
3329
- * ```no_run
3330
- * // For example, to blend two images with the `multiply` blend mode:
3331
- * use photon_rs::multiple::blend;
3332
- * use photon_rs::native::open_image;
3333
- *
3334
- * let mut img = open_image("img.jpg").expect("File should open");
3335
- * let img2 = open_image("img2.jpg").expect("File should open");
3336
- * blend(&mut img, &img2, "multiply");
3337
- * ```
3338
- * @param {PhotonImage} photon_image
3339
- * @param {PhotonImage} photon_image2
3340
- * @param {string} blend_mode
3341
- */
3342
- module.exports.blend = function(photon_image, photon_image2, blend_mode) {
3343
- _assertClass(photon_image, PhotonImage);
3344
- _assertClass(photon_image2, PhotonImage);
3345
- var ptr0 = passStringToWasm0(blend_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3346
- var len0 = WASM_VECTOR_LEN;
3347
- wasm.blend(photon_image.ptr, photon_image2.ptr, ptr0, len0);
3348
- };
3349
-
3350
- /**
3351
- * @param {number} width
3352
- * @param {number} height
3353
- * @returns {PhotonImage}
3354
- */
3355
- module.exports.create_gradient = function(width, height) {
3356
- var ret = wasm.create_gradient(width, height);
3357
- return PhotonImage.__wrap(ret);
3358
- };
3359
-
3360
- /**
3361
- * Apply a gradient to an image.
3362
- * @param {PhotonImage} image
3363
- */
3364
- module.exports.apply_gradient = function(image) {
3365
- _assertClass(image, PhotonImage);
3366
- wasm.apply_gradient(image.ptr);
3367
- };
3368
-
3369
- /**
3370
- * Noise reduction.
3371
- *
3372
- * # Arguments
3373
- * * `img` - A PhotonImage.
3374
- *
3375
- * # Example
3376
- *
3377
- * ```no_run
3378
- * // For example, to noise reduct an image:
3379
- * use photon_rs::conv::noise_reduction;
3380
- * use photon_rs::native::open_image;
3381
- *
3382
- * let mut img = open_image("img.jpg").expect("File should open");
3383
- * noise_reduction(&mut img);
3384
- * ```
3385
- * Adds a constant to a select R, G, or B channel's value.
3386
- * @param {PhotonImage} photon_image
3387
- */
3388
- module.exports.noise_reduction = function(photon_image) {
3389
- _assertClass(photon_image, PhotonImage);
3390
- wasm.noise_reduction(photon_image.ptr);
3391
- };
3392
-
3393
- /**
3394
- * Sharpen an image.
3395
- *
3396
- * # Arguments
3397
- * * `img` - A PhotonImage.
3398
- *
3399
- * # Example
3400
- *
3401
- * ```no_run
3402
- * // For example, to sharpen an image:
3403
- * use photon_rs::conv::sharpen;
3404
- * use photon_rs::native::open_image;
3405
- *
3406
- * let mut img = open_image("img.jpg").expect("File should open");
3407
- * sharpen(&mut img);
3408
- * ```
3409
- * Adds a constant to a select R, G, or B channel's value.
3410
- * @param {PhotonImage} photon_image
3411
- */
3412
- module.exports.sharpen = function(photon_image) {
3413
- _assertClass(photon_image, PhotonImage);
3414
- wasm.sharpen(photon_image.ptr);
3415
- };
3416
-
3417
- /**
3418
- * Apply edge detection to an image, to create a dark version with its edges highlighted.
3419
- *
3420
- * # Arguments
3421
- * * `img` - A PhotonImage.
3422
- *
3423
- * # Example
3424
- *
3425
- * ```no_run
3426
- * // For example, to increase the Red channel for all pixels by 10:
3427
- * use photon_rs::conv::edge_detection;
3428
- * use photon_rs::native::open_image;
3429
- *
3430
- * let mut img = open_image("img.jpg").expect("File should open");
3431
- * edge_detection(&mut img);
3432
- * ```
3433
- * @param {PhotonImage} photon_image
3434
- */
3435
- module.exports.edge_detection = function(photon_image) {
3436
- _assertClass(photon_image, PhotonImage);
3437
- wasm.edge_detection(photon_image.ptr);
3438
- };
3439
-
3440
- /**
3441
- * Apply an identity kernel convolution to an image.
3442
- *
3443
- * # Arguments
3444
- * * `img` -A PhotonImage.
3445
- *
3446
- * # Example
3447
- *
3448
- * ```no_run
3449
- * // For example, to apply an identity kernel convolution:
3450
- * use photon_rs::conv::identity;
3451
- * use photon_rs::native::open_image;
3452
- *
3453
- * let mut img = open_image("img.jpg").expect("File should open");
3454
- * identity(&mut img);
3455
- * ```
3456
- * @param {PhotonImage} photon_image
3457
- */
3458
- module.exports.identity = function(photon_image) {
3459
- _assertClass(photon_image, PhotonImage);
3460
- wasm.identity(photon_image.ptr);
3461
- };
3462
-
3463
- /**
3464
- * Apply a box blur effect.
3465
- *
3466
- * # Arguments
3467
- * * `img` - A PhotonImage.
3468
- *
3469
- * # Example
3470
- *
3471
- * ```no_run
3472
- * // For example, to apply a box blur effect:
3473
- * use photon_rs::conv::box_blur;
3474
- * use photon_rs::native::open_image;
3475
- *
3476
- * let mut img = open_image("img.jpg").expect("File should open");
3477
- * box_blur(&mut img);
3478
- * ```
3479
- * @param {PhotonImage} photon_image
3480
- */
3481
- module.exports.box_blur = function(photon_image) {
3482
- _assertClass(photon_image, PhotonImage);
3483
- wasm.box_blur(photon_image.ptr);
3484
- };
3485
-
3486
- /**
3487
- * Gaussian blur in linear time.
3488
- *
3489
- * Reference: http://blog.ivank.net/fastest-gaussian-blur.html
3490
- *
3491
- * # Arguments
3492
- * * `photon_image` - A PhotonImage
3493
- * * `radius` - blur radius
3494
- * # Example
3495
- *
3496
- * ```no_run
3497
- * use photon_rs::conv::gaussian_blur;
3498
- * use photon_rs::native::open_image;
3499
- *
3500
- * let mut img = open_image("img.jpg").expect("File should open");
3501
- * gaussian_blur(&mut img, 3_i32);
3502
- * ```
3503
- * @param {PhotonImage} photon_image
3504
- * @param {number} radius
3505
- */
3506
- module.exports.gaussian_blur = function(photon_image, radius) {
3507
- _assertClass(photon_image, PhotonImage);
3508
- wasm.gaussian_blur(photon_image.ptr, radius);
3509
- };
3510
-
3511
- /**
3512
- * Detect horizontal lines in an image, and highlight these only.
3513
- *
3514
- * # Arguments
3515
- * * `img` - A PhotonImage.
3516
- *
3517
- * # Example
3518
- *
3519
- * ```no_run
3520
- * // For example, to display the horizontal lines in an image:
3521
- * use photon_rs::conv::detect_horizontal_lines;
3522
- * use photon_rs::native::open_image;
3523
- *
3524
- * let mut img = open_image("img.jpg").expect("File should open");
3525
- * detect_horizontal_lines(&mut img);
3526
- * ```
3527
- * @param {PhotonImage} photon_image
3528
- */
3529
- module.exports.detect_horizontal_lines = function(photon_image) {
3530
- _assertClass(photon_image, PhotonImage);
3531
- wasm.detect_horizontal_lines(photon_image.ptr);
3532
- };
3533
-
3534
- /**
3535
- * Detect vertical lines in an image, and highlight these only.
3536
- *
3537
- * # Arguments
3538
- * * `img` - A PhotonImage.
3539
- *
3540
- * # Example
3541
- *
3542
- * ```no_run
3543
- * // For example, to display the vertical lines in an image:
3544
- * use photon_rs::conv::detect_vertical_lines;
3545
- * use photon_rs::native::open_image;
3546
- *
3547
- * let mut img = open_image("img.jpg").expect("File should open");
3548
- * detect_vertical_lines(&mut img);
3549
- * ```
3550
- * @param {PhotonImage} photon_image
3551
- */
3552
- module.exports.detect_vertical_lines = function(photon_image) {
3553
- _assertClass(photon_image, PhotonImage);
3554
- wasm.detect_vertical_lines(photon_image.ptr);
3555
- };
3556
-
3557
- /**
3558
- * Detect lines at a forty five degree angle in an image, and highlight these only.
3559
- *
3560
- * # Arguments
3561
- * * `img` - A PhotonImage.
3562
- *
3563
- * # Example
3564
- *
3565
- * ```no_run
3566
- * // For example, to display the lines at a forty five degree angle in an image:
3567
- * use photon_rs::conv::detect_45_deg_lines;
3568
- * use photon_rs::native::open_image;
3569
- *
3570
- * let mut img = open_image("img.jpg").expect("File should open");
3571
- * detect_45_deg_lines(&mut img);
3572
- * ```
3573
- * @param {PhotonImage} photon_image
3574
- */
3575
- module.exports.detect_45_deg_lines = function(photon_image) {
3576
- _assertClass(photon_image, PhotonImage);
3577
- wasm.detect_45_deg_lines(photon_image.ptr);
3578
- };
3579
-
3580
- /**
3581
- * Detect lines at a 135 degree angle in an image, and highlight these only.
3582
- *
3583
- * # Arguments
3584
- * * `img` - A PhotonImage.
3585
- *
3586
- * # Example
3587
- *
3588
- * ```no_run
3589
- * // For example, to display the lines at a 135 degree angle in an image:
3590
- * use photon_rs::conv::detect_135_deg_lines;
3591
- * use photon_rs::native::open_image;
3592
- *
3593
- * let mut img = open_image("img.jpg").expect("File should open");
3594
- * detect_135_deg_lines(&mut img);
3595
- * ```
3596
- * @param {PhotonImage} photon_image
3597
- */
3598
- module.exports.detect_135_deg_lines = function(photon_image) {
3599
- _assertClass(photon_image, PhotonImage);
3600
- wasm.detect_135_deg_lines(photon_image.ptr);
3601
- };
3602
-
3603
- /**
3604
- * Apply a standard laplace convolution.
3605
- *
3606
- * # Arguments
3607
- * * `img` - A PhotonImage.
3608
- *
3609
- * # Example
3610
- *
3611
- * ```no_run
3612
- * // For example, to apply a laplace effect:
3613
- * use photon_rs::conv::laplace;
3614
- * use photon_rs::native::open_image;
3615
- *
3616
- * let mut img = open_image("img.jpg").expect("File should open");
3617
- * laplace(&mut img);
3618
- * ```
3619
- * @param {PhotonImage} photon_image
3620
- */
3621
- module.exports.laplace = function(photon_image) {
3622
- _assertClass(photon_image, PhotonImage);
3623
- wasm.laplace(photon_image.ptr);
3624
- };
3625
-
3626
- /**
3627
- * Preset edge effect.
3628
- *
3629
- * # Arguments
3630
- * * `img` - A PhotonImage.
3631
- *
3632
- * # Example
3633
- *
3634
- * ```no_run
3635
- * // For example, to apply this effect:
3636
- * use photon_rs::conv::edge_one;
3637
- * use photon_rs::native::open_image;
3638
- *
3639
- * let mut img = open_image("img.jpg").expect("File should open");
3640
- * edge_one(&mut img);
3641
- * ```
3642
- * @param {PhotonImage} photon_image
3643
- */
3644
- module.exports.edge_one = function(photon_image) {
3645
- _assertClass(photon_image, PhotonImage);
3646
- wasm.edge_one(photon_image.ptr);
3647
- };
3648
-
3649
- /**
3650
- * Apply an emboss effect to an image.
3651
- *
3652
- * # Arguments
3653
- * * `img` - A PhotonImage.
3654
- *
3655
- * # Example
3656
- *
3657
- * ```no_run
3658
- * // For example, to apply an emboss effect:
3659
- * use photon_rs::conv::emboss;
3660
- * use photon_rs::native::open_image;
3661
- *
3662
- * let mut img = open_image("img.jpg").expect("File should open");
3663
- * emboss(&mut img);
3664
- * ```
3665
- * @param {PhotonImage} photon_image
3666
- */
3667
- module.exports.emboss = function(photon_image) {
3668
- _assertClass(photon_image, PhotonImage);
3669
- wasm.emboss(photon_image.ptr);
3670
- };
3671
-
3672
- /**
3673
- * Apply a horizontal Sobel filter to an image.
3674
- *
3675
- * # Arguments
3676
- * * `img` - A PhotonImage.
3677
- *
3678
- * # Example
3679
- *
3680
- * ```no_run
3681
- * // For example, to apply a horizontal Sobel filter:
3682
- * use photon_rs::conv::sobel_horizontal;
3683
- * use photon_rs::native::open_image;
3684
- *
3685
- * let mut img = open_image("img.jpg").expect("File should open");
3686
- * sobel_horizontal(&mut img);
3687
- * ```
3688
- * @param {PhotonImage} photon_image
3689
- */
3690
- module.exports.sobel_horizontal = function(photon_image) {
3691
- _assertClass(photon_image, PhotonImage);
3692
- wasm.sobel_horizontal(photon_image.ptr);
3693
- };
3694
-
3695
- /**
3696
- * Apply a horizontal Prewitt convolution to an image.
3697
- *
3698
- * # Arguments
3699
- * * `img` - A PhotonImage.
3700
- *
3701
- * # Example
3702
- *
3703
- * ```no_run
3704
- * // For example, to apply a horizontal Prewitt convolution effect:
3705
- * use photon_rs::conv::prewitt_horizontal;
3706
- * use photon_rs::native::open_image;
3707
- *
3708
- * let mut img = open_image("img.jpg").expect("File should open");
3709
- * prewitt_horizontal(&mut img);
3710
- * ```
3711
- * @param {PhotonImage} photon_image
3712
- */
3713
- module.exports.prewitt_horizontal = function(photon_image) {
3714
- _assertClass(photon_image, PhotonImage);
3715
- wasm.prewitt_horizontal(photon_image.ptr);
3716
- };
3717
-
3718
- /**
3719
- * Apply a vertical Sobel filter to an image.
3720
- *
3721
- * # Arguments
3722
- * * `img` - A PhotonImage.
3723
- *
3724
- * # Example
3725
- *
3726
- * ```no_run
3727
- * // For example, to apply a vertical Sobel filter:
3728
- * use photon_rs::conv::sobel_vertical;
3729
- * use photon_rs::native::open_image;
3730
- *
3731
- * let mut img = open_image("img.jpg").expect("File should open");
3732
- * sobel_vertical(&mut img);
3733
- * ```
3734
- * @param {PhotonImage} photon_image
3735
- */
3736
- module.exports.sobel_vertical = function(photon_image) {
3737
- _assertClass(photon_image, PhotonImage);
3738
- wasm.sobel_vertical(photon_image.ptr);
3739
- };
3740
-
3741
- function isLikeNone(x) {
3742
- return x === undefined || x === null;
3743
- }
3744
-
3745
- function handleError(f, args) {
3746
- try {
3747
- return f.apply(this, args);
3748
- } catch (e) {
3749
- wasm.__wbindgen_exn_store(addHeapObject(e));
3750
- }
3751
- }
3752
-
3753
- let cachegetUint8ClampedMemory0 = null;
3754
- function getUint8ClampedMemory0() {
3755
- if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {
3756
- cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
3757
- }
3758
- return cachegetUint8ClampedMemory0;
3759
- }
3760
-
3761
- function getClampedArrayU8FromWasm0(ptr, len) {
3762
- return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);
3763
- }
3764
- /**
3765
- */
3766
- module.exports.SamplingFilter = Object.freeze({ Nearest:1,"1":"Nearest",Triangle:2,"2":"Triangle",CatmullRom:3,"3":"CatmullRom",Gaussian:4,"4":"Gaussian",Lanczos3:5,"5":"Lanczos3", });
3767
- /**
3768
- * Provides the image's height, width, and contains the image's raw pixels.
3769
- * For use when communicating between JS and WASM, and also natively.
3770
- */
3771
- class PhotonImage {
3772
-
3773
- static __wrap(ptr) {
3774
- const obj = Object.create(PhotonImage.prototype);
3775
- obj.ptr = ptr;
3776
-
3777
- return obj;
3778
- }
3779
-
3780
- __destroy_into_raw() {
3781
- const ptr = this.ptr;
3782
- this.ptr = 0;
3783
-
3784
- return ptr;
3785
- }
3786
-
3787
- free() {
3788
- const ptr = this.__destroy_into_raw();
3789
- wasm.__wbg_photonimage_free(ptr);
3790
- }
3791
- /**
3792
- * Create a new PhotonImage from a Vec of u8s, which represent raw pixels.
3793
- * @param {Uint8Array} raw_pixels
3794
- * @param {number} width
3795
- * @param {number} height
3796
- */
3797
- constructor(raw_pixels, width, height) {
3798
- var ptr0 = passArray8ToWasm0(raw_pixels, wasm.__wbindgen_malloc);
3799
- var len0 = WASM_VECTOR_LEN;
3800
- var ret = wasm.photonimage_new(ptr0, len0, width, height);
3801
- return PhotonImage.__wrap(ret);
3802
- }
3803
- /**
3804
- * Create a new PhotonImage from a base64 string.
3805
- * @param {string} base64
3806
- * @returns {PhotonImage}
3807
- */
3808
- static new_from_base64(base64) {
3809
- var ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3810
- var len0 = WASM_VECTOR_LEN;
3811
- var ret = wasm.base64_to_image(ptr0, len0);
3812
- return PhotonImage.__wrap(ret);
3813
- }
3814
- /**
3815
- * Create a new PhotonImage from a byteslice.
3816
- * @param {Uint8Array} vec
3817
- * @returns {PhotonImage}
3818
- */
3819
- static new_from_byteslice(vec) {
3820
- var ptr0 = passArray8ToWasm0(vec, wasm.__wbindgen_malloc);
3821
- var len0 = WASM_VECTOR_LEN;
3822
- var ret = wasm.photonimage_new_from_byteslice(ptr0, len0);
3823
- return PhotonImage.__wrap(ret);
3824
- }
3825
- /**
3826
- * Get the width of the PhotonImage.
3827
- * @returns {number}
3828
- */
3829
- get_width() {
3830
- var ret = wasm.photonimage_get_width(this.ptr);
3831
- return ret >>> 0;
3832
- }
3833
- /**
3834
- * Get the PhotonImage's pixels as a Vec of u8s.
3835
- * @returns {Uint8Array}
3836
- */
3837
- get_raw_pixels() {
3838
- try {
3839
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3840
- wasm.photonimage_get_raw_pixels(retptr, this.ptr);
3841
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3842
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3843
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3844
- wasm.__wbindgen_free(r0, r1 * 1);
3845
- return v0;
3846
- } finally {
3847
- wasm.__wbindgen_add_to_stack_pointer(16);
3848
- }
3849
- }
3850
- /**
3851
- * Get the height of the PhotonImage.
3852
- * @returns {number}
3853
- */
3854
- get_height() {
3855
- var ret = wasm.photonimage_get_height(this.ptr);
3856
- return ret >>> 0;
3857
- }
3858
- /**
3859
- * Convert the PhotonImage to base64.
3860
- * @returns {string}
3861
- */
3862
- get_base64() {
3863
- try {
3864
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3865
- wasm.photonimage_get_base64(retptr, this.ptr);
3866
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3867
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3868
- return getStringFromWasm0(r0, r1);
3869
- } finally {
3870
- wasm.__wbindgen_add_to_stack_pointer(16);
3871
- wasm.__wbindgen_free(r0, r1);
3872
- }
3873
- }
3874
- /**
3875
- * Convert the PhotonImage to raw bytes. Returns JPEG.
3876
- * @returns {Uint8Array}
3877
- */
3878
- get_bytes() {
3879
- try {
3880
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3881
- wasm.photonimage_get_bytes(retptr, this.ptr);
3882
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3883
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3884
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3885
- wasm.__wbindgen_free(r0, r1 * 1);
3886
- return v0;
3887
- } finally {
3888
- wasm.__wbindgen_add_to_stack_pointer(16);
3889
- }
3890
- }
3891
- /**
3892
- * Convert the PhotonImage to raw bytes. Returns a JPEG.
3893
- * @param {number} quality
3894
- * @returns {Uint8Array}
3895
- */
3896
- get_bytes_jpeg(quality) {
3897
- try {
3898
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3899
- wasm.photonimage_get_bytes_jpeg(retptr, this.ptr, quality);
3900
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3901
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3902
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3903
- wasm.__wbindgen_free(r0, r1 * 1);
3904
- return v0;
3905
- } finally {
3906
- wasm.__wbindgen_add_to_stack_pointer(16);
3907
- }
3908
- }
3909
- /**
3910
- * Convert the PhotonImage's raw pixels to JS-compatible ImageData.
3911
- * @returns {ImageData}
3912
- */
3913
- get_image_data() {
3914
- var ret = wasm.photonimage_get_image_data(this.ptr);
3915
- return takeObject(ret);
3916
- }
3917
- /**
3918
- * Convert ImageData to raw pixels, and update the PhotonImage's raw pixels to this.
3919
- * @param {ImageData} img_data
3920
- */
3921
- set_imgdata(img_data) {
3922
- wasm.photonimage_set_imgdata(this.ptr, addHeapObject(img_data));
3923
- }
3924
- }
3925
- module.exports.PhotonImage = PhotonImage;
3926
- /**
3927
- * RGB color type.
3928
- */
3929
- class Rgb {
3930
-
3931
- static __wrap(ptr) {
3932
- const obj = Object.create(Rgb.prototype);
3933
- obj.ptr = ptr;
3934
-
3935
- return obj;
3936
- }
3937
-
3938
- __destroy_into_raw() {
3939
- const ptr = this.ptr;
3940
- this.ptr = 0;
3941
-
3942
- return ptr;
3943
- }
3944
-
3945
- free() {
3946
- const ptr = this.__destroy_into_raw();
3947
- wasm.__wbg_rgb_free(ptr);
3948
- }
3949
- /**
3950
- * Create a new RGB struct.
3951
- * @param {number} r
3952
- * @param {number} g
3953
- * @param {number} b
3954
- */
3955
- constructor(r, g, b) {
3956
- var ret = wasm.rgb_new(r, g, b);
3957
- return Rgb.__wrap(ret);
3958
- }
3959
- /**
3960
- * Set the Red value.
3961
- * @param {number} r
3962
- */
3963
- set_red(r) {
3964
- wasm.rgb_set_red(this.ptr, r);
3965
- }
3966
- /**
3967
- * Get the Green value.
3968
- * @param {number} g
3969
- */
3970
- set_green(g) {
3971
- wasm.rgb_set_green(this.ptr, g);
3972
- }
3973
- /**
3974
- * Set the Blue value.
3975
- * @param {number} b
3976
- */
3977
- set_blue(b) {
3978
- wasm.rgb_set_blue(this.ptr, b);
3979
- }
3980
- /**
3981
- * Get the Red value.
3982
- * @returns {number}
3983
- */
3984
- get_red() {
3985
- var ret = wasm.rgb_get_red(this.ptr);
3986
- return ret;
3987
- }
3988
- /**
3989
- * Get the Green value.
3990
- * @returns {number}
3991
- */
3992
- get_green() {
3993
- var ret = wasm.rgb_get_green(this.ptr);
3994
- return ret;
3995
- }
3996
- /**
3997
- * Get the Blue value.
3998
- * @returns {number}
3999
- */
4000
- get_blue() {
4001
- var ret = wasm.rgb_get_blue(this.ptr);
4002
- return ret;
4003
- }
4004
- }
4005
- module.exports.Rgb = Rgb;
4006
- /**
4007
- * RGBA color type.
4008
- */
4009
- class Rgba {
4010
-
4011
- static __wrap(ptr) {
4012
- const obj = Object.create(Rgba.prototype);
4013
- obj.ptr = ptr;
4014
-
4015
- return obj;
4016
- }
4017
-
4018
- __destroy_into_raw() {
4019
- const ptr = this.ptr;
4020
- this.ptr = 0;
4021
-
4022
- return ptr;
4023
- }
4024
-
4025
- free() {
4026
- const ptr = this.__destroy_into_raw();
4027
- wasm.__wbg_rgba_free(ptr);
4028
- }
4029
- /**
4030
- * Create a new RGBA struct.
4031
- * @param {number} r
4032
- * @param {number} g
4033
- * @param {number} b
4034
- * @param {number} a
4035
- */
4036
- constructor(r, g, b, a) {
4037
- var ret = wasm.rgba_new(r, g, b, a);
4038
- return Rgba.__wrap(ret);
4039
- }
4040
- /**
4041
- * Set the Red value.
4042
- * @param {number} r
4043
- */
4044
- set_red(r) {
4045
- wasm.rgb_set_red(this.ptr, r);
4046
- }
4047
- /**
4048
- * Get the Green value.
4049
- * @param {number} g
4050
- */
4051
- set_green(g) {
4052
- wasm.rgb_set_green(this.ptr, g);
4053
- }
4054
- /**
4055
- * Set the Blue value.
4056
- * @param {number} b
4057
- */
4058
- set_blue(b) {
4059
- wasm.rgb_set_blue(this.ptr, b);
4060
- }
4061
- /**
4062
- * Set the alpha value.
4063
- * @param {number} a
4064
- */
4065
- set_alpha(a) {
4066
- wasm.rgba_set_alpha(this.ptr, a);
4067
- }
4068
- /**
4069
- * Get the Red value.
4070
- * @returns {number}
4071
- */
4072
- get_red() {
4073
- var ret = wasm.rgb_get_red(this.ptr);
4074
- return ret;
4075
- }
4076
- /**
4077
- * Get the Green value.
4078
- * @returns {number}
4079
- */
4080
- get_green() {
4081
- var ret = wasm.rgb_get_green(this.ptr);
4082
- return ret;
4083
- }
4084
- /**
4085
- * Get the Blue value.
4086
- * @returns {number}
4087
- */
4088
- get_blue() {
4089
- var ret = wasm.rgb_get_blue(this.ptr);
4090
- return ret;
4091
- }
4092
- /**
4093
- * Get the alpha value for this color.
4094
- * @returns {number}
4095
- */
4096
- get_alpha() {
4097
- var ret = wasm.rgba_get_alpha(this.ptr);
4098
- return ret;
4099
- }
4100
- }
4101
- module.exports.Rgba = Rgba;
4102
-
4103
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
4104
- takeObject(arg0);
4105
- };
4106
-
4107
- module.exports.__wbg_new_693216e109162396 = function() {
4108
- var ret = new Error();
4109
- return addHeapObject(ret);
4110
- };
4111
-
4112
- module.exports.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {
4113
- var ret = getObject(arg1).stack;
4114
- var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4115
- var len0 = WASM_VECTOR_LEN;
4116
- getInt32Memory0()[arg0 / 4 + 1] = len0;
4117
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
4118
- };
4119
-
4120
- module.exports.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
4121
- try {
4122
- console.error(getStringFromWasm0(arg0, arg1));
4123
- } finally {
4124
- wasm.__wbindgen_free(arg0, arg1);
4125
- }
4126
- };
4127
-
4128
- module.exports.__wbg_instanceof_Window_c4b70662a0d2c5ec = function(arg0) {
4129
- var ret = getObject(arg0) instanceof Window;
4130
- return ret;
4131
- };
4132
-
4133
- module.exports.__wbg_document_1c64944725c0d81d = function(arg0) {
4134
- var ret = getObject(arg0).document;
4135
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4136
- };
4137
-
4138
- module.exports.__wbg_body_78ae4fd43b446013 = function(arg0) {
4139
- var ret = getObject(arg0).body;
4140
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4141
- };
4142
-
4143
- module.exports.__wbg_createElement_86c152812a141a62 = function() { return handleError(function (arg0, arg1, arg2) {
4144
- var ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));
4145
- return addHeapObject(ret);
4146
- }, arguments) };
4147
-
4148
- module.exports.__wbg_width_16bd64d09cbf5661 = function(arg0) {
4149
- var ret = getObject(arg0).width;
4150
- return ret;
4151
- };
4152
-
4153
- module.exports.__wbg_height_368bb86c37d51bc9 = function(arg0) {
4154
- var ret = getObject(arg0).height;
4155
- return ret;
4156
- };
4157
-
4158
- module.exports.__wbg_data_1ae7496c58caf755 = function(arg0, arg1) {
4159
- var ret = getObject(arg1).data;
4160
- var ptr0 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
4161
- var len0 = WASM_VECTOR_LEN;
4162
- getInt32Memory0()[arg0 / 4 + 1] = len0;
4163
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
4164
- };
4165
-
4166
- module.exports.__wbg_newwithu8clampedarrayandsh_1b8c6e1bede43657 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
4167
- var ret = new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
4168
- return addHeapObject(ret);
4169
- }, arguments) };
4170
-
4171
- module.exports.__wbg_instanceof_CanvasRenderingContext2d_3abbe7ec7af32cae = function(arg0) {
4172
- var ret = getObject(arg0) instanceof CanvasRenderingContext2D;
4173
- return ret;
4174
- };
4175
-
4176
- module.exports.__wbg_drawImage_9e2d13329d92a0a3 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
4177
- getObject(arg0).drawImage(getObject(arg1), arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
4178
- }, arguments) };
4179
-
4180
- module.exports.__wbg_getImageData_9ffc3df78ca3dbc9 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4181
- var ret = getObject(arg0).getImageData(arg1, arg2, arg3, arg4);
4182
- return addHeapObject(ret);
4183
- }, arguments) };
4184
-
4185
- module.exports.__wbg_putImageData_b9544b271e569392 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
4186
- getObject(arg0).putImageData(getObject(arg1), arg2, arg3);
4187
- }, arguments) };
4188
-
4189
- module.exports.__wbg_settextContent_799ebbf96e16265d = function(arg0, arg1, arg2) {
4190
- getObject(arg0).textContent = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
4191
- };
4192
-
4193
- module.exports.__wbg_appendChild_d318db34c4559916 = function() { return handleError(function (arg0, arg1) {
4194
- var ret = getObject(arg0).appendChild(getObject(arg1));
4195
- return addHeapObject(ret);
4196
- }, arguments) };
4197
-
4198
- module.exports.__wbg_instanceof_HtmlCanvasElement_25d964a0dde6717e = function(arg0) {
4199
- var ret = getObject(arg0) instanceof HTMLCanvasElement;
4200
- return ret;
4201
- };
4202
-
4203
- module.exports.__wbg_width_555f63ab09ba7d3f = function(arg0) {
4204
- var ret = getObject(arg0).width;
4205
- return ret;
4206
- };
4207
-
4208
- module.exports.__wbg_setwidth_c1a7061891b71f25 = function(arg0, arg1) {
4209
- getObject(arg0).width = arg1 >>> 0;
4210
- };
4211
-
4212
- module.exports.__wbg_height_7153faec70fbaf7b = function(arg0) {
4213
- var ret = getObject(arg0).height;
4214
- return ret;
4215
- };
4216
-
4217
- module.exports.__wbg_setheight_88894b05710ff752 = function(arg0, arg1) {
4218
- getObject(arg0).height = arg1 >>> 0;
4219
- };
4220
-
4221
- module.exports.__wbg_getContext_f701d0231ae22393 = function() { return handleError(function (arg0, arg1, arg2) {
4222
- var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
4223
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4224
- }, arguments) };
4225
-
4226
- module.exports.__wbg_newnoargs_be86524d73f67598 = function(arg0, arg1) {
4227
- var ret = new Function(getStringFromWasm0(arg0, arg1));
4228
- return addHeapObject(ret);
4229
- };
4230
-
4231
- module.exports.__wbg_call_888d259a5fefc347 = function() { return handleError(function (arg0, arg1) {
4232
- var ret = getObject(arg0).call(getObject(arg1));
4233
- return addHeapObject(ret);
4234
- }, arguments) };
4235
-
4236
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
4237
- var ret = getObject(arg0);
4238
- return addHeapObject(ret);
4239
- };
4240
-
4241
- module.exports.__wbg_self_c6fbdfc2918d5e58 = function() { return handleError(function () {
4242
- var ret = self.self;
4243
- return addHeapObject(ret);
4244
- }, arguments) };
4245
-
4246
- module.exports.__wbg_window_baec038b5ab35c54 = function() { return handleError(function () {
4247
- var ret = window.window;
4248
- return addHeapObject(ret);
4249
- }, arguments) };
4250
-
4251
- module.exports.__wbg_globalThis_3f735a5746d41fbd = function() { return handleError(function () {
4252
- var ret = globalThis.globalThis;
4253
- return addHeapObject(ret);
4254
- }, arguments) };
4255
-
4256
- module.exports.__wbg_global_1bc0b39582740e95 = function() { return handleError(function () {
4257
- var ret = global.global;
4258
- return addHeapObject(ret);
4259
- }, arguments) };
4260
-
4261
- module.exports.__wbindgen_is_undefined = function(arg0) {
4262
- var ret = getObject(arg0) === undefined;
4263
- return ret;
4264
- };
4265
-
4266
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
4267
- var ret = debugString(getObject(arg1));
4268
- var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4269
- var len0 = WASM_VECTOR_LEN;
4270
- getInt32Memory0()[arg0 / 4 + 1] = len0;
4271
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
4272
- };
4273
-
4274
- module.exports.__wbindgen_throw = function(arg0, arg1) {
4275
- throw new Error(getStringFromWasm0(arg0, arg1));
4276
- };
4277
-
4278
- module.exports.__wbindgen_rethrow = function(arg0) {
4279
- throw takeObject(arg0);
4280
- };
4281
-
4282
- const path = (__webpack_require__("path")/* .join */.join)(__dirname, 'photon_rs_bg.wasm');
4283
- const bytes = (__webpack_require__("fs")/* .readFileSync */.readFileSync)(path);
4284
-
4285
- const wasmModule = new WebAssembly.Module(bytes);
4286
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
4287
- wasm = wasmInstance.exports;
4288
- module.exports.__wasm = wasm;
4289
-
4290
-
4291
-
4292
- },
4293
-
4294
- };
4295
- ;