@oh-my-pi/pi-coding-agent 5.6.77 → 5.7.67

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.
@@ -0,0 +1,3013 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Provides the image's height, width, and contains the image's raw pixels.
6
+ * For use when communicating between JS and WASM, and also natively.
7
+ */
8
+ export class PhotonImage {
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ /**
12
+ * Convert the PhotonImage to base64.
13
+ */
14
+ get_base64(): string;
15
+ /**
16
+ * Convert the PhotonImage to raw bytes. Returns PNG.
17
+ */
18
+ get_bytes(): Uint8Array;
19
+ /**
20
+ * Convert the PhotonImage to raw bytes. Returns a JPEG.
21
+ */
22
+ get_bytes_jpeg(quality: number): Uint8Array;
23
+ /**
24
+ * Convert the PhotonImage to raw bytes. Returns a WEBP.
25
+ */
26
+ get_bytes_webp(): Uint8Array;
27
+ /**
28
+ * Calculates estimated filesize and returns number of bytes
29
+ */
30
+ get_estimated_filesize(): bigint;
31
+ /**
32
+ * Get the height of the PhotonImage.
33
+ */
34
+ get_height(): number;
35
+ /**
36
+ * Convert the PhotonImage's raw pixels to JS-compatible ImageData.
37
+ */
38
+ get_image_data(): ImageData;
39
+ /**
40
+ * Get the PhotonImage's pixels as a Vec of u8s.
41
+ */
42
+ get_raw_pixels(): Uint8Array;
43
+ /**
44
+ * Get the width of the PhotonImage.
45
+ */
46
+ get_width(): number;
47
+ /**
48
+ * Create a new PhotonImage from a Vec of u8s, which represent raw pixels.
49
+ */
50
+ constructor(raw_pixels: Uint8Array, width: number, height: number);
51
+ /**
52
+ * Create a new PhotonImage from a base64 string.
53
+ */
54
+ static new_from_base64(base64: string): PhotonImage;
55
+ /**
56
+ * Create a new PhotonImage from a Blob/File.
57
+ */
58
+ static new_from_blob(blob: Blob): PhotonImage;
59
+ /**
60
+ * Create a new PhotonImage from a byteslice.
61
+ */
62
+ static new_from_byteslice(vec: Uint8Array): PhotonImage;
63
+ /**
64
+ * Create a new PhotonImage from a HTMLImageElement
65
+ */
66
+ static new_from_image(image: HTMLImageElement): PhotonImage;
67
+ /**
68
+ * Convert ImageData to raw pixels, and update the PhotonImage's raw pixels to this.
69
+ */
70
+ set_imgdata(img_data: ImageData): void;
71
+ }
72
+
73
+ /**
74
+ * RGB color type.
75
+ */
76
+ export class Rgb {
77
+ free(): void;
78
+ [Symbol.dispose](): void;
79
+ /**
80
+ * Get the Blue value.
81
+ */
82
+ get_blue(): number;
83
+ /**
84
+ * Get the Green value.
85
+ */
86
+ get_green(): number;
87
+ /**
88
+ * Get the Red value.
89
+ */
90
+ get_red(): number;
91
+ /**
92
+ * Create a new RGB struct.
93
+ */
94
+ constructor(r: number, g: number, b: number);
95
+ /**
96
+ * Set the Blue value.
97
+ */
98
+ set_blue(b: number): void;
99
+ /**
100
+ * Get the Green value.
101
+ */
102
+ set_green(g: number): void;
103
+ /**
104
+ * Set the Red value.
105
+ */
106
+ set_red(r: number): void;
107
+ }
108
+
109
+ /**
110
+ * RGBA color type.
111
+ */
112
+ export class Rgba {
113
+ free(): void;
114
+ [Symbol.dispose](): void;
115
+ /**
116
+ * Get the alpha value for this color.
117
+ */
118
+ get_alpha(): number;
119
+ /**
120
+ * Get the Blue value.
121
+ */
122
+ get_blue(): number;
123
+ /**
124
+ * Get the Green value.
125
+ */
126
+ get_green(): number;
127
+ /**
128
+ * Get the Red value.
129
+ */
130
+ get_red(): number;
131
+ /**
132
+ * Create a new RGBA struct.
133
+ */
134
+ constructor(r: number, g: number, b: number, a: number);
135
+ /**
136
+ * Set the alpha value.
137
+ */
138
+ set_alpha(a: number): void;
139
+ /**
140
+ * Set the Blue value.
141
+ */
142
+ set_blue(b: number): void;
143
+ /**
144
+ * Get the Green value.
145
+ */
146
+ set_green(g: number): void;
147
+ /**
148
+ * Set the Red value.
149
+ */
150
+ set_red(r: number): void;
151
+ }
152
+
153
+ export enum SamplingFilter {
154
+ Nearest = 1,
155
+ Triangle = 2,
156
+ CatmullRom = 3,
157
+ Gaussian = 4,
158
+ Lanczos3 = 5,
159
+ }
160
+
161
+ /**
162
+ * Add randomized noise to an image.
163
+ * This function adds a Gaussian Noise Sample to each pixel through incrementing each channel by a randomized offset.
164
+ * This randomized offset is generated by creating a randomized thread pool.
165
+ * **[WASM SUPPORT IS AVAILABLE]**: Randomized thread pools cannot be created with WASM, but
166
+ * a workaround using js_sys::Math::random works now.
167
+ * # Arguments
168
+ * * `img` - A PhotonImage.
169
+ *
170
+ * # Example
171
+ *
172
+ * ```no_run
173
+ * // For example:
174
+ * use photon_rs::native::open_image;
175
+ * use photon_rs::noise::add_noise_rand;
176
+ * use photon_rs::PhotonImage;
177
+ *
178
+ * let mut img = open_image("img.jpg").expect("File should open");
179
+ * add_noise_rand(&mut img);
180
+ * ```
181
+ */
182
+ export function add_noise_rand(photon_image: PhotonImage): void;
183
+
184
+ /**
185
+ * Adjust the brightness of an image by a factor.
186
+ *
187
+ * # Arguments
188
+ * * `img` - A PhotonImage that contains a view into the image.
189
+ * * `brightness` - A u8 to add or subtract to the brightness. To increase
190
+ * the brightness, pass a positive number (up to 255). To decrease the brightness,
191
+ * pass a negative number instead.
192
+ * # Example
193
+ *
194
+ * ```no_run
195
+ * use photon_rs::effects::adjust_brightness;
196
+ * use photon_rs::native::open_image;
197
+ *
198
+ * let mut img = open_image("img.jpg").expect("File should open");
199
+ * adjust_brightness(&mut img, 10_i16);
200
+ * ```
201
+ */
202
+ export function adjust_brightness(photon_image: PhotonImage, brightness: number): void;
203
+
204
+ /**
205
+ * Adjust the contrast of an image by a factor.
206
+ *
207
+ * # Arguments
208
+ * * `photon_image` - A PhotonImage that contains a view into the image.
209
+ * * `contrast` - An f32 factor used to adjust contrast. Between [-255.0, 255.0]. The algorithm will
210
+ * clamp results if passed factor is out of range.
211
+ * # Example
212
+ *
213
+ * ```no_run
214
+ * use photon_rs::effects::adjust_contrast;
215
+ * use photon_rs::native::open_image;
216
+ *
217
+ * let mut img = open_image("img.jpg").expect("File should open");
218
+ * adjust_contrast(&mut img, 30_f32);
219
+ * ```
220
+ */
221
+ export function adjust_contrast(photon_image: PhotonImage, contrast: number): void;
222
+
223
+ /**
224
+ * Increment or decrement every pixel's Blue channel by a constant.
225
+ *
226
+ * # Arguments
227
+ * * `img` - A PhotonImage.
228
+ * * `amt` - The amount to increment or decrement the channel's value by for that pixel.
229
+ *
230
+ * # Example
231
+ *
232
+ * ```no_run
233
+ * // For example, to increase the Blue channel for all pixels by 10:
234
+ * use photon_rs::channels::alter_blue_channel;
235
+ * use photon_rs::native::open_image;
236
+ *
237
+ * let mut img = open_image("img.jpg").expect("File should open");
238
+ * alter_blue_channel(&mut img, 10_i16);
239
+ * ```
240
+ */
241
+ export function alter_blue_channel(img: PhotonImage, amt: number): void;
242
+
243
+ /**
244
+ * Alter a select channel by incrementing or decrementing its value by a constant.
245
+ *
246
+ * # Arguments
247
+ * * `img` - A PhotonImage.
248
+ * * `channel` - The channel you wish to alter, it should be either 0, 1 or 2,
249
+ * representing R, G, or B respectively. (O=Red, 1=Green, 2=Blue)
250
+ * * `amount` - The amount to increment/decrement the channel's value by for that pixel.
251
+ * A positive value will increment/decrement the channel's value, a negative value will decrement the channel's value.
252
+ *
253
+ * ## Example
254
+ *
255
+ * ```no_run
256
+ * // For example, to increase the Red channel for all pixels by 10:
257
+ * use photon_rs::channels::alter_channel;
258
+ * use photon_rs::native::{open_image};
259
+ *
260
+ * let mut img = open_image("img.jpg").expect("File should open");
261
+ * alter_channel(&mut img, 0_usize, 10_i16);
262
+ * ```
263
+ *
264
+ * Adds a constant to a select R, G, or B channel's value.
265
+ *
266
+ * ### Decrease a channel's value
267
+ * // For example, to decrease the Green channel for all pixels by 20:
268
+ * ```no_run
269
+ * use photon_rs::channels::alter_channel;
270
+ * use photon_rs::native::open_image;
271
+ *
272
+ * let mut img = open_image("img.jpg").expect("File should open");
273
+ * alter_channel(&mut img, 1_usize, -20_i16);
274
+ * ```
275
+ * **Note**: Note the use of a minus symbol when decreasing the channel.
276
+ */
277
+ export function alter_channel(img: PhotonImage, channel: number, amt: number): void;
278
+
279
+ /**
280
+ * Increment all 3 channels' values by adding an amt to each channel per pixel.
281
+ *
282
+ * # Arguments
283
+ * * `img` - A PhotonImage.
284
+ * * `r_amt` - The amount to increment/decrement the Red channel by.
285
+ * * `g_amt` - The amount to increment/decrement the Green channel by.
286
+ * * `b_amt` - The amount to increment/decrement the Blue channel by.
287
+ *
288
+ * # Example
289
+ *
290
+ * ```no_run
291
+ * // For example, to increase the values of the Red channel by 10, the Green channel by 20,
292
+ * // and the Blue channel by 50:
293
+ * use photon_rs::channels::alter_channels;
294
+ * use photon_rs::native::open_image;
295
+ *
296
+ * let mut img = open_image("img.jpg").expect("File should open");
297
+ * alter_channels(&mut img, 10_i16, 20_i16, 50_i16);
298
+ * ```
299
+ */
300
+ export function alter_channels(img: PhotonImage, r_amt: number, g_amt: number, b_amt: number): void;
301
+
302
+ /**
303
+ * Increment or decrement every pixel's Green channel by a constant.
304
+ *
305
+ * # Arguments
306
+ * * `img` - A PhotonImage.
307
+ * * `amt` - The amount to increment/decrement the channel's value by for that pixel.
308
+ *
309
+ * # Example
310
+ *
311
+ * ```no_run
312
+ * // For example, to increase the Green channel for all pixels by 20:
313
+ * use photon_rs::channels::alter_green_channel;
314
+ * use photon_rs::native::open_image;
315
+ *
316
+ * let mut img = open_image("img.jpg").expect("File should open");
317
+ * alter_green_channel(&mut img, 20_i16);
318
+ * ```
319
+ */
320
+ export function alter_green_channel(img: PhotonImage, amt: number): void;
321
+
322
+ /**
323
+ * Increment or decrement every pixel's Red channel by a constant.
324
+ *
325
+ * # Arguments
326
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
327
+ * * `amt` - The amount to increment or decrement the channel's value by for that pixel.
328
+ *
329
+ * # Example
330
+ *
331
+ * ```no_run
332
+ * // For example, to increase the Red channel for all pixels by 10:
333
+ * use photon_rs::channels::alter_red_channel;
334
+ * use photon_rs::native::open_image;
335
+ *
336
+ * let mut img = open_image("img.jpg").expect("File should open");
337
+ * alter_red_channel(&mut img, 10_i16);
338
+ * ```
339
+ */
340
+ export function alter_red_channel(photon_image: PhotonImage, amt: number): void;
341
+
342
+ /**
343
+ * Increment/decrement two channels' values simultaneously by adding an amt to each channel per pixel.
344
+ *
345
+ * # Arguments
346
+ * * `img` - A PhotonImage.
347
+ * * `channel1` - A usize from 0 to 2 that represents either the R, G or B channels.
348
+ * * `amt1` - The amount to increment/decrement the channel's value by for that pixel.
349
+ * * `channel2` -A usize from 0 to 2 that represents either the R, G or B channels.
350
+ * * `amt2` - The amount to increment/decrement the channel's value by for that pixel.
351
+ *
352
+ * # Example
353
+ *
354
+ * ```no_run
355
+ * // For example, to increase the values of the Red and Blue channels per pixel:
356
+ * use photon_rs::channels::alter_two_channels;
357
+ * use photon_rs::native::open_image;
358
+ *
359
+ * let mut img = open_image("img.jpg").expect("File should open");
360
+ * alter_two_channels(&mut img, 0_usize, 10_i16, 2_usize, 20_i16);
361
+ * ```
362
+ */
363
+ export function alter_two_channels(img: PhotonImage, channel1: number, amt1: number, channel2: number, amt2: number): void;
364
+
365
+ /**
366
+ * Apply a gradient to an image.
367
+ */
368
+ export function apply_gradient(image: PhotonImage): void;
369
+
370
+ /**
371
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to the Blue channel's value.
372
+ *
373
+ * # Arguments
374
+ * * `photon_image` - A PhotonImage.
375
+ *
376
+ * # Example
377
+ *
378
+ * ```no_run
379
+ * use photon_rs::monochrome::b_grayscale;
380
+ * use photon_rs::native::open_image;
381
+ *
382
+ * let mut img = open_image("img.jpg").expect("File should open");
383
+ * b_grayscale(&mut img);
384
+ * ```
385
+ */
386
+ export function b_grayscale(photon_image: PhotonImage): void;
387
+
388
+ /**
389
+ * Convert a base64 string to a PhotonImage.
390
+ */
391
+ export function base64_to_image(base64: string): PhotonImage;
392
+
393
+ /**
394
+ * Convert a base64 string to a Vec of u8s.
395
+ */
396
+ export function base64_to_vec(base64: string): Uint8Array;
397
+
398
+ /**
399
+ * Blend two images together.
400
+ *
401
+ * The `blend_mode` (3rd param) determines which blending mode to use; change this for varying effects.
402
+ * The blend modes available include: `overlay`, `over`, `atop`, `xor`, `plus`, `multiply`, `burn`,
403
+ * `difference`, `soft_light`, `screen`, `hard_light`, `dodge`, `exclusion`, `lighten`, `darken` (more to come)
404
+ * NOTE: The first image must be smaller than the second image passed as params.
405
+ * If the first image were larger than the second, then there would be overflowing pixels which would have no corresponding pixels
406
+ * in the second image.
407
+ * # Arguments
408
+ * * `img` - A DynamicImage that contains a view into the image.
409
+ * * `img2` - The 2nd DynamicImage to be blended with the first.
410
+ * * `blend_mode` - The blending mode to use. See above for complete list of blend modes available.
411
+ * # Example
412
+ *
413
+ * ```no_run
414
+ * // For example, to blend two images with the `multiply` blend mode:
415
+ * use photon_rs::multiple::blend;
416
+ * use photon_rs::native::open_image;
417
+ *
418
+ * let mut img = open_image("img.jpg").expect("File should open");
419
+ * let img2 = open_image("img2.jpg").expect("File should open");
420
+ * blend(&mut img, &img2, "multiply");
421
+ * ```
422
+ */
423
+ export function blend(photon_image: PhotonImage, photon_image2: PhotonImage, blend_mode: string): void;
424
+
425
+ /**
426
+ * Apply a box blur effect.
427
+ *
428
+ * # Arguments
429
+ * * `img` - A PhotonImage.
430
+ *
431
+ * # Example
432
+ *
433
+ * ```no_run
434
+ * // For example, to apply a box blur effect:
435
+ * use photon_rs::conv::box_blur;
436
+ * use photon_rs::native::open_image;
437
+ *
438
+ * let mut img = open_image("img.jpg").expect("File should open");
439
+ * box_blur(&mut img);
440
+ * ```
441
+ */
442
+ export function box_blur(photon_image: PhotonImage): void;
443
+
444
+ /**
445
+ * Increased contrast filter effect.
446
+ *
447
+ * # Arguments
448
+ * * `img` - A PhotonImage.
449
+ * # Example
450
+ *
451
+ * ```no_run
452
+ * use photon_rs::filters::cali;
453
+ * use photon_rs::native::open_image;
454
+ *
455
+ * let mut img = open_image("img.jpg").expect("File should open");
456
+ * cali(&mut img);
457
+ * ```
458
+ */
459
+ export function cali(img: PhotonImage): void;
460
+
461
+ /**
462
+ * Horizontal strips. Divide an image into a series of equal-width strips, for an artistic effect. Sepcify a color as well.
463
+ *
464
+ * # Arguments
465
+ * * `img` - A PhotonImage that contains a view into the image.
466
+ * * `num_strips` - The numbder of strips
467
+ * * `color` - Color of strips.
468
+ * # Example
469
+ *
470
+ * ```no_run
471
+ * // For example, to draw blue horizontal strips on a `PhotonImage`:
472
+ * use photon_rs::effects::color_horizontal_strips;
473
+ * use photon_rs::native::open_image;
474
+ * use photon_rs::Rgb;
475
+ *
476
+ * let color = Rgb::new(255u8, 0u8, 0u8);
477
+ * let mut img = open_image("img.jpg").expect("File should open");
478
+ * color_horizontal_strips(&mut img, 8u8, color);
479
+ * ```
480
+ */
481
+ export function color_horizontal_strips(photon_image: PhotonImage, num_strips: number, color: Rgb): void;
482
+
483
+ /**
484
+ * Vertical strips. Divide an image into a series of equal-width strips, for an artistic effect. Sepcify a color as well.
485
+ *
486
+ * # Arguments
487
+ * * `img` - A PhotonImage that contains a view into the image.
488
+ * * `num_strips` - The numbder of strips
489
+ * * `color` - Color of strips.
490
+ * # Example
491
+ *
492
+ * ```no_run
493
+ * // For example, to draw red vertical strips on a `PhotonImage`:
494
+ * use photon_rs::effects::color_vertical_strips;
495
+ * use photon_rs::native::open_image;
496
+ * use photon_rs::Rgb;
497
+ *
498
+ * let color = Rgb::new(255u8, 0u8, 0u8);
499
+ * let mut img = open_image("img.jpg").expect("File should open");
500
+ * color_vertical_strips(&mut img, 8u8, color);
501
+ * ```
502
+ */
503
+ export function color_vertical_strips(photon_image: PhotonImage, num_strips: number, color: Rgb): void;
504
+
505
+ /**
506
+ * Colorizes the green channels of the image.
507
+ *
508
+ * # Arguments
509
+ * * `img` - A PhotonImage that contains a view into the image.
510
+ * # Example
511
+ *
512
+ * ```no_run
513
+ * // For example, to colorize an image of type `PhotonImage`:
514
+ * use photon_rs::effects::colorize;
515
+ * use photon_rs::native::open_image;
516
+ *
517
+ * let mut img = open_image("img.jpg").expect("File should open");
518
+ * colorize(&mut img);
519
+ * ```
520
+ */
521
+ export function colorize(photon_image: PhotonImage): void;
522
+
523
+ export function create_gradient(width: number, height: number): PhotonImage;
524
+
525
+ /**
526
+ * Crop an image.
527
+ *
528
+ * # Arguments
529
+ * * `img` - A PhotonImage.
530
+ *
531
+ * # Example
532
+ *
533
+ * ```no_run
534
+ * // For example, to crop an image at (0, 0) to (500, 800)
535
+ * use photon_rs::native::{open_image};
536
+ * use photon_rs::transform::crop;
537
+ * use photon_rs::PhotonImage;
538
+ *
539
+ * let mut img = open_image("img.jpg").expect("File should open");
540
+ * let cropped_img: PhotonImage = crop(&img, 0_u32, 0_u32, 500_u32, 800_u32);
541
+ * // Write the contents of this image in JPG format.
542
+ * ```
543
+ */
544
+ export function crop(photon_image: PhotonImage, x1: number, y1: number, x2: number, y2: number): PhotonImage;
545
+
546
+ export function crop_img_browser(source_canvas: HTMLCanvasElement, width: number, height: number, left: number, top: number): HTMLCanvasElement;
547
+
548
+ /**
549
+ * Darken the image by a specified amount in the HSL colour space.
550
+ *
551
+ * # Arguments
552
+ * * `img` - A PhotonImage.
553
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
554
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
555
+ * Darkening by 80% would be represented by a `level` of 0.8
556
+ *
557
+ * # Example
558
+ * ```no_run
559
+ * // For example to darken an image by 10% in the HSL colour space:
560
+ * use photon_rs::colour_spaces::darken_hsl;
561
+ * use photon_rs::native::open_image;
562
+ *
563
+ * // Open the image. A PhotonImage is returned.
564
+ * let mut img = open_image("img.jpg").expect("File should open");
565
+ * darken_hsl(&mut img, 0.1_f32);
566
+ * ```
567
+ */
568
+ export function darken_hsl(img: PhotonImage, level: number): void;
569
+
570
+ /**
571
+ * Darken the image by a specified amount in the HSLuv colour space.
572
+ *
573
+ * # Arguments
574
+ * * `img` - A PhotonImage.
575
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
576
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
577
+ * Darkening by 80% would be represented by a `level` of 0.8
578
+ *
579
+ * # Example
580
+ * ```no_run
581
+ * // For example to darken an image by 10% in the HSLuv colour space:
582
+ * use photon_rs::colour_spaces::darken_hsluv;
583
+ * use photon_rs::native::open_image;
584
+ *
585
+ * // Open the image. A PhotonImage is returned.
586
+ * let mut img = open_image("img.jpg").expect("File should open");
587
+ * darken_hsluv(&mut img, 0.1_f32);
588
+ * ```
589
+ */
590
+ export function darken_hsluv(img: PhotonImage, level: number): void;
591
+
592
+ /**
593
+ * Darken the image's colours by a specified amount in the HSV colour space.
594
+ *
595
+ * # Arguments
596
+ * * `img` - A PhotonImage.
597
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
598
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
599
+ * Darkening by 80% would be represented by a `level` of 0.8
600
+ *
601
+ * # Example
602
+ * ```no_run
603
+ * // For example to darken an image by 10% in the HSV colour space:
604
+ * use photon_rs::colour_spaces::darken_hsv;
605
+ * use photon_rs::native::open_image;
606
+ *
607
+ * // Open the image. A PhotonImage is returned.
608
+ * let mut img = open_image("img.jpg").expect("File should open");
609
+ * darken_hsv(&mut img, 0.1_f32);
610
+ * ```
611
+ */
612
+ export function darken_hsv(img: PhotonImage, level: number): void;
613
+
614
+ /**
615
+ * Darken the image by a specified amount in the LCh colour space.
616
+ *
617
+ * # Arguments
618
+ * * `img` - A PhotonImage.
619
+ * * `level` - Float value from 0 to 1 representing the level to which to darken the image by.
620
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
621
+ * Darkening by 80% would be represented by a `level` of 0.8
622
+ *
623
+ * # Example
624
+ * ```no_run
625
+ * // For example to darken an image by 10% in the LCh colour space:
626
+ * use photon_rs::colour_spaces::darken_lch;
627
+ * use photon_rs::native::open_image;
628
+ *
629
+ * // Open the image. A PhotonImage is returned.
630
+ * let mut img = open_image("img.jpg").expect("File should open");
631
+ * darken_lch(&mut img, 0.1_f32);
632
+ * ```
633
+ */
634
+ export function darken_lch(img: PhotonImage, level: number): void;
635
+
636
+ /**
637
+ * Decrease the brightness of an image by a constant.
638
+ *
639
+ * # Arguments
640
+ * * `img` - A PhotonImage that contains a view into the image.
641
+ * * `brightness` - A u8 to subtract from the brightness. It should be a positive number,
642
+ * and this value will then be subtracted from the brightness.
643
+ * # Example
644
+ *
645
+ * ```no_run
646
+ * use photon_rs::effects::dec_brightness;
647
+ * use photon_rs::native::open_image;
648
+ *
649
+ * let mut img = open_image("img.jpg").expect("File should open");
650
+ * dec_brightness(&mut img, 10_u8);
651
+ * ```
652
+ */
653
+ export function dec_brightness(photon_image: PhotonImage, brightness: number): void;
654
+
655
+ /**
656
+ * Uses a max. decomposition algorithm to convert an image to greyscale.
657
+ *
658
+ * # Arguments
659
+ * * `photon_image` - A PhotonImage.
660
+ *
661
+ * # Example
662
+ *
663
+ * ```no_run
664
+ * // For example, to decompose an image with max decomposition:
665
+ * use photon_rs::monochrome::decompose_max;
666
+ * use photon_rs::native::open_image;
667
+ *
668
+ * let mut img = open_image("img.jpg").expect("File should open");
669
+ * decompose_max(&mut img);
670
+ * ```
671
+ */
672
+ export function decompose_max(img: PhotonImage): void;
673
+
674
+ /**
675
+ * Uses a min. decomposition algorithm to convert an image to greyscale.
676
+ *
677
+ * # Arguments
678
+ * * `photon_image` - A PhotonImage.
679
+ *
680
+ * # Example
681
+ *
682
+ * ```no_run
683
+ * // For example, to decompose an image with min decomposition:
684
+ * use photon_rs::monochrome::decompose_min;
685
+ * use photon_rs::native::open_image;
686
+ *
687
+ * let mut img = open_image("img.jpg").expect("File should open");
688
+ * decompose_min(&mut img);
689
+ * ```
690
+ */
691
+ export function decompose_min(img: PhotonImage): void;
692
+
693
+ /**
694
+ * Desaturate an image by getting the min/max of each pixel's RGB values.
695
+ *
696
+ * # Arguments
697
+ * * `photon_image` - A PhotonImage.
698
+ * # Example
699
+ *
700
+ * ```no_run
701
+ * // For example, to desaturate an image:
702
+ * use photon_rs::monochrome::desaturate;
703
+ * use photon_rs::native::open_image;
704
+ *
705
+ * let mut img = open_image("img.jpg").expect("File should open");
706
+ * desaturate(&mut img);
707
+ * ```
708
+ */
709
+ export function desaturate(img: PhotonImage): void;
710
+
711
+ /**
712
+ * Desaturate the image by a specified amount in the HSL colour space.
713
+ *
714
+ * # Arguments
715
+ * * `img` - A PhotonImage.
716
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
717
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
718
+ * Desaturating by 80% would be represented by a `level` of 0.8
719
+ *
720
+ * # Example
721
+ * ```no_run
722
+ * // For example to desaturate an image by 10% in the LCh colour space:
723
+ * use photon_rs::colour_spaces::desaturate_hsl;
724
+ * use photon_rs::native::open_image;
725
+ *
726
+ * // Open the image. A PhotonImage is returned.
727
+ * let mut img = open_image("img.jpg").expect("File should open");
728
+ * desaturate_hsl(&mut img, 0.1_f32);
729
+ * ```
730
+ */
731
+ export function desaturate_hsl(img: PhotonImage, level: number): void;
732
+
733
+ /**
734
+ * Desaturate the image by a specified amount in the HSLuv colour space.
735
+ *
736
+ * # Arguments
737
+ * * `img` - A PhotonImage.
738
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
739
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
740
+ * Desaturating by 80% would be represented by a `level` of 0.8
741
+ *
742
+ * # Example
743
+ * ```no_run
744
+ * // For example to desaturate an image by 10% in the HSLuv colour space:
745
+ * use photon_rs::colour_spaces::desaturate_hsluv;
746
+ * use photon_rs::native::open_image;
747
+ *
748
+ * // Open the image. A PhotonImage is returned.
749
+ * let mut img = open_image("img.jpg").expect("File should open");
750
+ * desaturate_hsluv(&mut img, 0.1_f32);
751
+ * ```
752
+ */
753
+ export function desaturate_hsluv(img: PhotonImage, level: number): void;
754
+
755
+ /**
756
+ * Desaturate the image by a specified amount in the HSV colour space.
757
+ *
758
+ * # Arguments
759
+ * * `img` - A PhotonImage.
760
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
761
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
762
+ * Desaturating by 80% would be represented by a `level` of 0.8
763
+ *
764
+ * # Example
765
+ * ```no_run
766
+ * // For example to desaturate an image by 10% in the HSV colour space:
767
+ * use photon_rs::colour_spaces::desaturate_hsv;
768
+ * use photon_rs::native::open_image;
769
+ *
770
+ * // Open the image. A PhotonImage is returned.
771
+ * let mut img = open_image("img.jpg").expect("File should open");
772
+ * desaturate_hsv(&mut img, 0.1_f32);
773
+ * ```
774
+ */
775
+ export function desaturate_hsv(img: PhotonImage, level: number): void;
776
+
777
+ /**
778
+ * Desaturate the image by a specified amount in the LCh colour space.
779
+ *
780
+ * # Arguments
781
+ * * `img` - A PhotonImage.
782
+ * * `level` - Float value from 0 to 1 representing the level to which to desaturate the image by.
783
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
784
+ * Desaturating by 80% would be represented by a `level` of 0.8
785
+ *
786
+ * # Example
787
+ * ```no_run
788
+ * // For example to desaturate an image by 10% in the LCh colour space:
789
+ * use photon_rs::colour_spaces::desaturate_lch;
790
+ * use photon_rs::native::open_image;
791
+ *
792
+ * // Open the image. A PhotonImage is returned.
793
+ * let mut img = open_image("img.jpg").expect("File should open");
794
+ * desaturate_lch(&mut img, 0.1_f32);
795
+ * ```
796
+ */
797
+ export function desaturate_lch(img: PhotonImage, level: number): void;
798
+
799
+ /**
800
+ * Detect lines at a 135 degree angle in an image, and highlight these only.
801
+ *
802
+ * # Arguments
803
+ * * `img` - A PhotonImage.
804
+ *
805
+ * # Example
806
+ *
807
+ * ```no_run
808
+ * // For example, to display the lines at a 135 degree angle in an image:
809
+ * use photon_rs::conv::detect_135_deg_lines;
810
+ * use photon_rs::native::open_image;
811
+ *
812
+ * let mut img = open_image("img.jpg").expect("File should open");
813
+ * detect_135_deg_lines(&mut img);
814
+ * ```
815
+ */
816
+ export function detect_135_deg_lines(photon_image: PhotonImage): void;
817
+
818
+ /**
819
+ * Detect lines at a forty five degree angle in an image, and highlight these only.
820
+ *
821
+ * # Arguments
822
+ * * `img` - A PhotonImage.
823
+ *
824
+ * # Example
825
+ *
826
+ * ```no_run
827
+ * // For example, to display the lines at a forty five degree angle in an image:
828
+ * use photon_rs::conv::detect_45_deg_lines;
829
+ * use photon_rs::native::open_image;
830
+ *
831
+ * let mut img = open_image("img.jpg").expect("File should open");
832
+ * detect_45_deg_lines(&mut img);
833
+ * ```
834
+ */
835
+ export function detect_45_deg_lines(photon_image: PhotonImage): void;
836
+
837
+ /**
838
+ * Detect horizontal lines in an image, and highlight these only.
839
+ *
840
+ * # Arguments
841
+ * * `img` - A PhotonImage.
842
+ *
843
+ * # Example
844
+ *
845
+ * ```no_run
846
+ * // For example, to display the horizontal lines in an image:
847
+ * use photon_rs::conv::detect_horizontal_lines;
848
+ * use photon_rs::native::open_image;
849
+ *
850
+ * let mut img = open_image("img.jpg").expect("File should open");
851
+ * detect_horizontal_lines(&mut img);
852
+ * ```
853
+ */
854
+ export function detect_horizontal_lines(photon_image: PhotonImage): void;
855
+
856
+ /**
857
+ * Detect vertical lines in an image, and highlight these only.
858
+ *
859
+ * # Arguments
860
+ * * `img` - A PhotonImage.
861
+ *
862
+ * # Example
863
+ *
864
+ * ```no_run
865
+ * // For example, to display the vertical lines in an image:
866
+ * use photon_rs::conv::detect_vertical_lines;
867
+ * use photon_rs::native::open_image;
868
+ *
869
+ * let mut img = open_image("img.jpg").expect("File should open");
870
+ * detect_vertical_lines(&mut img);
871
+ * ```
872
+ */
873
+ export function detect_vertical_lines(photon_image: PhotonImage): void;
874
+
875
+ /**
876
+ * Applies Floyd-Steinberg dithering to an image.
877
+ * Only RGB channels are processed, alpha remains unchanged.
878
+ * # Arguments
879
+ * * `photon_image` - A PhotonImage that contains a view into the image.
880
+ * * `depth` - bits per channel. Clamped between 1 and 8.
881
+ * # Example
882
+ *
883
+ * ```no_run
884
+ * // For example, to turn an image of type `PhotonImage` into a dithered image:
885
+ * use photon_rs::effects::dither;
886
+ * use photon_rs::native::open_image;
887
+ *
888
+ * let mut img = open_image("img.jpg").expect("File should open");
889
+ * let depth = 1;
890
+ * dither(&mut img, depth);
891
+ * ```
892
+ */
893
+ export function dither(photon_image: PhotonImage, depth: number): void;
894
+
895
+ /**
896
+ * Greyscale effect with increased contrast.
897
+ *
898
+ * # Arguments
899
+ * * `img` - A PhotonImage.
900
+ * # Example
901
+ *
902
+ * ```no_run
903
+ * use photon_rs::filters::dramatic;
904
+ * use photon_rs::native::open_image;
905
+ *
906
+ * let mut img = open_image("img.jpg").expect("File should open");
907
+ * dramatic(&mut img);
908
+ * ```
909
+ */
910
+ export function dramatic(img: PhotonImage): void;
911
+
912
+ /**
913
+ * Add text to an image.
914
+ * The only font available as of now is Roboto.
915
+ * Note: A graphic design/text-drawing library is currently being developed, so stay tuned.
916
+ *
917
+ * # Arguments
918
+ * * `photon_image` - A PhotonImage.
919
+ * * `text` - Text string to be drawn to the image.
920
+ * * `x` - x-coordinate of where first letter's 1st pixel should be drawn.
921
+ * * `y` - y-coordinate of where first letter's 1st pixel should be drawn.
922
+ * * `font_size` - Font size in pixels of the text to be drawn.
923
+ *
924
+ * # Example
925
+ *
926
+ * ```no_run
927
+ * // For example to draw the string "Welcome to Photon!" at 10, 10:
928
+ * use photon_rs::native::open_image;
929
+ * use photon_rs::text::draw_text;
930
+ *
931
+ * // Open the image. A PhotonImage is returned.
932
+ * let mut img = open_image("img.jpg").expect("File should open");
933
+ * draw_text(&mut img, "Welcome to Photon!", 10_i32, 10_i32, 90_f32);
934
+ * ```
935
+ */
936
+ export function draw_text(photon_img: PhotonImage, text: string, x: number, y: number, font_size: number): void;
937
+
938
+ /**
939
+ * Add bordered-text to an image.
940
+ * The only font available as of now is Roboto.
941
+ * Note: A graphic design/text-drawing library is currently being developed, so stay tuned.
942
+ *
943
+ * # Arguments
944
+ * * `photon_image` - A PhotonImage.
945
+ * * `text` - Text string to be drawn to the image.
946
+ * * `x` - x-coordinate of where first letter's 1st pixel should be drawn.
947
+ * * `y` - y-coordinate of where first letter's 1st pixel should be drawn.
948
+ * * `font_size` - Font size in pixels of the text to be drawn.
949
+ *
950
+ * # Example
951
+ *
952
+ * ```no_run
953
+ * // For example to draw the string "Welcome to Photon!" at 10, 10:
954
+ * use photon_rs::native::open_image;
955
+ * use photon_rs::text::draw_text_with_border;
956
+ *
957
+ * // Open the image. A PhotonImage is returned.
958
+ * let mut img = open_image("img.jpg").expect("File should open");
959
+ * draw_text_with_border(&mut img, "Welcome to Photon!", 10_i32, 10_i32, 90_f32);
960
+ * ```
961
+ */
962
+ export function draw_text_with_border(photon_img: PhotonImage, text: string, x: number, y: number, font_size: number): void;
963
+
964
+ export function duotone(photon_image: PhotonImage, color_a: Rgb, color_b: Rgb): void;
965
+
966
+ /**
967
+ * Duotone effect with purple tones.
968
+ *
969
+ * # Arguments
970
+ * * `img` - A PhotonImage.
971
+ * # Example
972
+ *
973
+ * ```no_run
974
+ * use photon_rs::filters::duotone_horizon;
975
+ * use photon_rs::native::open_image;
976
+ *
977
+ * let mut img = open_image("img.jpg").expect("File should open");
978
+ * duotone_horizon(&mut img);
979
+ * ```
980
+ */
981
+ export function duotone_horizon(img: PhotonImage): void;
982
+
983
+ /**
984
+ * Duotone effect with a lilac hue
985
+ *
986
+ * # Arguments
987
+ * * `img` - A PhotonImage.
988
+ * # Example
989
+ *
990
+ * ```no_run
991
+ * use photon_rs::filters::duotone_lilac;
992
+ * use photon_rs::native::open_image;
993
+ *
994
+ * let mut img = open_image("img.jpg").expect("File should open");
995
+ * duotone_lilac(&mut img);
996
+ * ```
997
+ */
998
+ export function duotone_lilac(img: PhotonImage): void;
999
+
1000
+ /**
1001
+ * A duotone ochre tint effect
1002
+ *
1003
+ * # Arguments
1004
+ * * `img` - A PhotonImage.
1005
+ * # Example
1006
+ *
1007
+ * ```no_run
1008
+ * use photon_rs::filters::duotone_ochre;
1009
+ * use photon_rs::native::open_image;
1010
+ *
1011
+ * let mut img = open_image("img.jpg").expect("File should open");
1012
+ * duotone_ochre(&mut img);
1013
+ * ```
1014
+ */
1015
+ export function duotone_ochre(img: PhotonImage): void;
1016
+
1017
+ /**
1018
+ * A duotone filter with a user-specified color and a gray color
1019
+ *
1020
+ * # Arguments
1021
+ * * `img` - A PhotonImage.
1022
+ * * `rgb_color` - RGB color
1023
+ * # Example
1024
+ *
1025
+ * ```no_run
1026
+ * use photon_rs::filters::duotone_tint;
1027
+ * use photon_rs::native::open_image;
1028
+ * use photon_rs::Rgb;
1029
+ *
1030
+ * let mut img = open_image("img.jpg").expect("File should open");
1031
+ * let rgb_color = Rgb::new(12, 12, 10);
1032
+ * duotone_tint(&mut img, rgb_color);
1033
+ * ```
1034
+ */
1035
+ export function duotone_tint(img: PhotonImage, rgb_color: Rgb): void;
1036
+
1037
+ /**
1038
+ * Duotone effect with blue and purple tones.
1039
+ *
1040
+ * # Arguments
1041
+ * * `img` - A PhotonImage.
1042
+ * # Example
1043
+ *
1044
+ * ```no_run
1045
+ * use photon_rs::filters::duotone_violette;
1046
+ * use photon_rs::native::open_image;
1047
+ *
1048
+ * let mut img = open_image("img.jpg").expect("File should open");
1049
+ * duotone_violette(&mut img);
1050
+ * ```
1051
+ */
1052
+ export function duotone_violette(img: PhotonImage): void;
1053
+
1054
+ /**
1055
+ * Apply edge detection to an image, to create a dark version with its edges highlighted.
1056
+ *
1057
+ * # Arguments
1058
+ * * `img` - A PhotonImage.
1059
+ *
1060
+ * # Example
1061
+ *
1062
+ * ```no_run
1063
+ * // For example, to increase the Red channel for all pixels by 10:
1064
+ * use photon_rs::conv::edge_detection;
1065
+ * use photon_rs::native::open_image;
1066
+ *
1067
+ * let mut img = open_image("img.jpg").expect("File should open");
1068
+ * edge_detection(&mut img);
1069
+ * ```
1070
+ */
1071
+ export function edge_detection(photon_image: PhotonImage): void;
1072
+
1073
+ /**
1074
+ * Preset edge effect.
1075
+ *
1076
+ * # Arguments
1077
+ * * `img` - A PhotonImage.
1078
+ *
1079
+ * # Example
1080
+ *
1081
+ * ```no_run
1082
+ * // For example, to apply this effect:
1083
+ * use photon_rs::conv::edge_one;
1084
+ * use photon_rs::native::open_image;
1085
+ *
1086
+ * let mut img = open_image("img.jpg").expect("File should open");
1087
+ * edge_one(&mut img);
1088
+ * ```
1089
+ */
1090
+ export function edge_one(photon_image: PhotonImage): void;
1091
+
1092
+ /**
1093
+ * Apply an emboss effect to an image.
1094
+ *
1095
+ * # Arguments
1096
+ * * `img` - A PhotonImage.
1097
+ *
1098
+ * # Example
1099
+ *
1100
+ * ```no_run
1101
+ * // For example, to apply an emboss effect:
1102
+ * use photon_rs::conv::emboss;
1103
+ * use photon_rs::native::open_image;
1104
+ *
1105
+ * let mut img = open_image("img.jpg").expect("File should open");
1106
+ * emboss(&mut img);
1107
+ * ```
1108
+ */
1109
+ export function emboss(photon_image: PhotonImage): void;
1110
+
1111
+ /**
1112
+ * Apply a filter to an image. Over 20 filters are available.
1113
+ * The filters are as follows:
1114
+ * * **oceanic**: Add an aquamarine-tinted hue to an image.
1115
+ * * **islands**: Aquamarine tint.
1116
+ * * **marine**: Add a green/blue mixed hue to an image.
1117
+ * * **seagreen**: Dark green hue, with tones of blue.
1118
+ * * **flagblue**: Royal blue tint
1119
+ * * **liquid**: Blue-inspired tint.
1120
+ * * **diamante**: Custom filter with a blue/turquoise tint.
1121
+ * * **radio**: Fallout-style radio effect.
1122
+ * * **twenties**: Slight-blue tinted historical effect.
1123
+ * * **rosetint**: Rose-tinted filter.
1124
+ * * **mauve**: Purple-infused filter.
1125
+ * * **bluechrome**: Blue monochrome effect.
1126
+ * * **vintage**: Vintage filter with a red tint.
1127
+ * * **perfume**: Increase the blue channel, with moderate increases in the Red and Green channels.
1128
+ * * **serenity**: Custom filter with an increase in the Blue channel's values.
1129
+ * # Arguments
1130
+ * * `img` - A PhotonImage.
1131
+ * * `filter_name` - The filter's name. Choose from the selection above, eg: "oceanic"
1132
+ * # Example
1133
+ *
1134
+ * ```no_run
1135
+ * // For example, to add a filter called "vintage" to an image:
1136
+ * use photon_rs::filters::filter;
1137
+ * use photon_rs::native::open_image;
1138
+ *
1139
+ * let mut img = open_image("img.jpg").expect("File should open");
1140
+ * filter(&mut img, "vintage");
1141
+ * ```
1142
+ */
1143
+ export function filter(img: PhotonImage, filter_name: string): void;
1144
+
1145
+ /**
1146
+ * Apply a red hue, with increased contrast and brightness.
1147
+ *
1148
+ * # Arguments
1149
+ * * `img` - A PhotonImage.
1150
+ * # Example
1151
+ *
1152
+ * ```no_run
1153
+ * use photon_rs::filters::firenze;
1154
+ * use photon_rs::native::open_image;
1155
+ *
1156
+ * let mut img = open_image("img.jpg").expect("File should open");
1157
+ * firenze(&mut img);
1158
+ * ```
1159
+ */
1160
+ export function firenze(img: PhotonImage): void;
1161
+
1162
+ /**
1163
+ * Flip an image horizontally.
1164
+ *
1165
+ * # Arguments
1166
+ * * `img` - A PhotonImage.
1167
+ *
1168
+ * # Example
1169
+ *
1170
+ * ```no_run
1171
+ * // For example, to flip an image horizontally:
1172
+ * use photon_rs::native::open_image;
1173
+ * use photon_rs::transform::fliph;
1174
+ *
1175
+ * let mut img = open_image("img.jpg").expect("File should open");
1176
+ * fliph(&mut img);
1177
+ * ```
1178
+ */
1179
+ export function fliph(photon_image: PhotonImage): void;
1180
+
1181
+ /**
1182
+ * Flip an image vertically.
1183
+ *
1184
+ * # Arguments
1185
+ * * `img` - A PhotonImage.
1186
+ *
1187
+ * # Example
1188
+ *
1189
+ * ```no_run
1190
+ * // For example, to flip an image vertically:
1191
+ * use photon_rs::native::open_image;
1192
+ * use photon_rs::transform::flipv;
1193
+ *
1194
+ * let mut img = open_image("img.jpg").expect("File should open");
1195
+ * flipv(&mut img);
1196
+ * ```
1197
+ */
1198
+ export function flipv(photon_image: PhotonImage): void;
1199
+
1200
+ /**
1201
+ * Turn an image into an frosted glass see through
1202
+ *
1203
+ * # Arguments
1204
+ * * `img` - A PhotonImage that contains a view into the image.
1205
+ * # Example
1206
+ *
1207
+ * ```no_run
1208
+ * // For example, to turn an image of type `PhotonImage` into frosted glass see through:
1209
+ * use photon_rs::effects::frosted_glass;
1210
+ * use photon_rs::native::open_image;
1211
+ *
1212
+ * let mut img = open_image("img.jpg").expect("File should open");
1213
+ * frosted_glass(&mut img);
1214
+ * ```
1215
+ */
1216
+ export function frosted_glass(photon_image: PhotonImage): void;
1217
+
1218
+ /**
1219
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to the Green channel's value.
1220
+ *
1221
+ * # Arguments
1222
+ * * `photon_image` - A PhotonImage.
1223
+ *
1224
+ * # Example
1225
+ *
1226
+ * ```no_run
1227
+ * use photon_rs::monochrome::g_grayscale;
1228
+ * use photon_rs::native::open_image;
1229
+ *
1230
+ * let mut img = open_image("img.jpg").expect("File should open");
1231
+ * g_grayscale(&mut img);
1232
+ * ```
1233
+ */
1234
+ export function g_grayscale(photon_image: PhotonImage): void;
1235
+
1236
+ /**
1237
+ * Applies gamma correction to an image.
1238
+ * # Arguments
1239
+ * * `photon_image` - A PhotonImage that contains a view into the image.
1240
+ * * `red` - Gamma value for red channel.
1241
+ * * `green` - Gamma value for green channel.
1242
+ * * `blue` - Gamma value for blue channel.
1243
+ * # Example
1244
+ *
1245
+ * ```no_run
1246
+ * // For example, to turn an image of type `PhotonImage` into a gamma corrected image:
1247
+ * use photon_rs::colour_spaces::gamma_correction;
1248
+ * use photon_rs::native::open_image;
1249
+ *
1250
+ * let mut img = open_image("img.jpg").expect("File should open");
1251
+ * gamma_correction(&mut img, 2.2, 2.2, 2.2);
1252
+ * ```
1253
+ */
1254
+ export function gamma_correction(photon_image: PhotonImage, red: number, green: number, blue: number): void;
1255
+
1256
+ /**
1257
+ * Gaussian blur in linear time.
1258
+ *
1259
+ * Reference: http://blog.ivank.net/fastest-gaussian-blur.html
1260
+ *
1261
+ * # Arguments
1262
+ * * `photon_image` - A PhotonImage
1263
+ * * `radius` - blur radius
1264
+ * # Example
1265
+ *
1266
+ * ```no_run
1267
+ * use photon_rs::conv::gaussian_blur;
1268
+ * use photon_rs::native::open_image;
1269
+ *
1270
+ * let mut img = open_image("img.jpg").expect("File should open");
1271
+ * gaussian_blur(&mut img, 3_i32);
1272
+ * ```
1273
+ */
1274
+ export function gaussian_blur(photon_image: PhotonImage, radius: number): void;
1275
+
1276
+ /**
1277
+ * Get the ImageData from a 2D canvas context
1278
+ */
1279
+ export function get_image_data(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D): ImageData;
1280
+
1281
+ /**
1282
+ * Apply a vintage, golden hue to an image.
1283
+ *
1284
+ * # Arguments
1285
+ * * `img` - A PhotonImage.
1286
+ * # Example
1287
+ *
1288
+ * ```no_run
1289
+ * use photon_rs::filters::golden;
1290
+ * use photon_rs::native::open_image;
1291
+ *
1292
+ * let mut img = open_image("img.jpg").expect("File should open");
1293
+ * golden(&mut img);
1294
+ * ```
1295
+ */
1296
+ export function golden(img: PhotonImage): void;
1297
+
1298
+ /**
1299
+ * Convert an image to grayscale using the conventional averaging algorithm.
1300
+ *
1301
+ * # Arguments
1302
+ * * `photon_image` - A PhotonImage.
1303
+ * # Example
1304
+ *
1305
+ * ```no_run
1306
+ * // For example, to convert an image of type `PhotonImage` to grayscale:
1307
+ * use photon_rs::monochrome::grayscale;
1308
+ * use photon_rs::native::open_image;
1309
+ *
1310
+ * let mut img = open_image("img.jpg").expect("File should open");
1311
+ * grayscale(&mut img);
1312
+ * ```
1313
+ */
1314
+ export function grayscale(img: PhotonImage): void;
1315
+
1316
+ /**
1317
+ * Convert an image to grayscale with a human corrected factor, to account for human vision.
1318
+ *
1319
+ * # Arguments
1320
+ * * `photon_image` - A PhotonImage.
1321
+ * # Example
1322
+ *
1323
+ * ```no_run
1324
+ * // For example, to convert an image of type `PhotonImage` to grayscale with a human corrected factor:
1325
+ * use photon_rs::monochrome::grayscale_human_corrected;
1326
+ * use photon_rs::native::open_image;
1327
+ *
1328
+ * let mut img = open_image("img.jpg").expect("File should open");
1329
+ * grayscale_human_corrected(&mut img);
1330
+ * ```
1331
+ */
1332
+ export function grayscale_human_corrected(img: PhotonImage): void;
1333
+
1334
+ /**
1335
+ * Employ only a limited number of gray shades in an image.
1336
+ *
1337
+ * # Arguments
1338
+ * * `photon_image` - A PhotonImage.
1339
+ * * `num_shades` - The number of grayscale shades to be displayed in the image.
1340
+ *
1341
+ * # Example
1342
+ *
1343
+ * ```no_run
1344
+ * // For example, to limit an image to four shades of gray only:
1345
+ * use photon_rs::monochrome::grayscale_shades;
1346
+ * use photon_rs::native::open_image;
1347
+ *
1348
+ * let mut img = open_image("img.jpg").expect("File should open");
1349
+ * grayscale_shades(&mut img, 4_u8);
1350
+ * ```
1351
+ */
1352
+ export function grayscale_shades(photon_image: PhotonImage, num_shades: number): void;
1353
+
1354
+ /**
1355
+ * Halftoning effect.
1356
+ *
1357
+ * # Arguments
1358
+ * * `img` - A PhotonImage that contains a view into the image.
1359
+ * # Example
1360
+ *
1361
+ * ```no_run
1362
+ * // For example:
1363
+ * use photon_rs::effects::halftone;
1364
+ * use photon_rs::native::open_image;
1365
+ *
1366
+ * let mut img = open_image("img.jpg").expect("File should open");
1367
+ * halftone(&mut img);
1368
+ * ```
1369
+ */
1370
+ export function halftone(photon_image: PhotonImage): void;
1371
+
1372
+ /**
1373
+ * Horizontal strips. Divide an image into a series of equal-height strips, for an artistic effect.
1374
+ *
1375
+ * # Arguments
1376
+ * * `img` - A PhotonImage that contains a view into the image.
1377
+ * * `num_strips` - The number of strips
1378
+ * # Example
1379
+ *
1380
+ * ```no_run
1381
+ * // For example, to draw horizontal strips on a `PhotonImage`:
1382
+ * use photon_rs::effects::horizontal_strips;
1383
+ * use photon_rs::native::open_image;
1384
+ *
1385
+ * let mut img = open_image("img.jpg").expect("File should open");
1386
+ * horizontal_strips(&mut img, 8u8);
1387
+ * ```
1388
+ */
1389
+ export function horizontal_strips(photon_image: PhotonImage, num_strips: number): void;
1390
+
1391
+ /**
1392
+ * Image manipulation effects in the HSL colour space.
1393
+ *
1394
+ * Effects include:
1395
+ * * **saturate** - Saturation increase.
1396
+ * * **desaturate** - Desaturate the image.
1397
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
1398
+ * * **darken** - Decrease the brightness.
1399
+ * * **lighten** - Increase the brightness.
1400
+ *
1401
+ * # Arguments
1402
+ * * `photon_image` - A PhotonImage.
1403
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
1404
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
1405
+ * # Example
1406
+ * ```no_run
1407
+ * // For example to increase the saturation by 10%:
1408
+ * use photon_rs::colour_spaces::hsl;
1409
+ * use photon_rs::native::open_image;
1410
+ *
1411
+ * // Open the image. A PhotonImage is returned.
1412
+ * let mut img = open_image("img.jpg").expect("File should open");
1413
+ * hsl(&mut img, "saturate", 0.1_f32);
1414
+ * ```
1415
+ */
1416
+ export function hsl(photon_image: PhotonImage, mode: string, amt: number): void;
1417
+
1418
+ /**
1419
+ * Image manipulation effects in the HSLuv colour space
1420
+ *
1421
+ * Effects include:
1422
+ * * **saturate** - Saturation increase.
1423
+ * * **desaturate** - Desaturate the image.
1424
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
1425
+ * * **darken** - Decrease the brightness.
1426
+ * * **lighten** - Increase the brightness.
1427
+ *
1428
+ * # Arguments
1429
+ * * `photon_image` - A PhotonImage.
1430
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
1431
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
1432
+ * # Example
1433
+ * ```no_run
1434
+ * // For example to increase the saturation by 10%:
1435
+ * use photon_rs::colour_spaces::hsluv;
1436
+ * use photon_rs::native::open_image;
1437
+ *
1438
+ * // Open the image. A PhotonImage is returned.
1439
+ * let mut img = open_image("img.jpg").expect("File should open");
1440
+ * hsluv(&mut img, "saturate", 0.1_f32);
1441
+ * ```
1442
+ */
1443
+ export function hsluv(photon_image: PhotonImage, mode: string, amt: number): void;
1444
+
1445
+ /**
1446
+ * Image manipulation in the HSV colour space.
1447
+ *
1448
+ * Effects include:
1449
+ * * **saturate** - Saturation increase.
1450
+ * * **desaturate** - Desaturate the image.
1451
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
1452
+ * * **darken** - Decrease the brightness.
1453
+ * * **lighten** - Increase the brightness.
1454
+ *
1455
+ * # Arguments
1456
+ * * `photon_image` - A PhotonImage.
1457
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
1458
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
1459
+ *
1460
+ * # Example
1461
+ * ```no_run
1462
+ * // For example to increase the saturation by 10%:
1463
+ * use photon_rs::colour_spaces::hsv;
1464
+ * use photon_rs::native::open_image;
1465
+ *
1466
+ * // Open the image. A PhotonImage is returned.
1467
+ * let mut img = open_image("img.jpg").expect("File should open");
1468
+ * hsv(&mut img, "saturate", 0.1_f32);
1469
+ * ```
1470
+ */
1471
+ export function hsv(photon_image: PhotonImage, mode: string, amt: number): void;
1472
+
1473
+ /**
1474
+ * Shift hue by a specified number of degrees in the HSL colour space.
1475
+ * # Arguments
1476
+ * * `img` - A PhotonImage.
1477
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1478
+ *
1479
+ * # Example
1480
+ * ```no_run
1481
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
1482
+ * use photon_rs::colour_spaces::hue_rotate_hsl;
1483
+ * use photon_rs::native::open_image;
1484
+ *
1485
+ * // Open the image. A PhotonImage is returned.
1486
+ * let mut img = open_image("img.jpg").expect("File should open");
1487
+ * hue_rotate_hsl(&mut img, 120_f32);
1488
+ * ```
1489
+ */
1490
+ export function hue_rotate_hsl(img: PhotonImage, degrees: number): void;
1491
+
1492
+ /**
1493
+ * Shift hue by a specified number of degrees in the HSLuv colour space.
1494
+ * # Arguments
1495
+ * * `img` - A PhotonImage.
1496
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1497
+ *
1498
+ * # Example
1499
+ * ```no_run
1500
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
1501
+ * use photon_rs::colour_spaces::hue_rotate_hsluv;
1502
+ * use photon_rs::native::open_image;
1503
+ *
1504
+ * // Open the image. A PhotonImage is returned.
1505
+ * let mut img = open_image("img.jpg").expect("File should open");
1506
+ * hue_rotate_hsluv(&mut img, 120_f32);
1507
+ * ```
1508
+ */
1509
+ export function hue_rotate_hsluv(img: PhotonImage, degrees: number): void;
1510
+
1511
+ /**
1512
+ * Shift hue by a specified number of degrees in the HSV colour space.
1513
+ * # Arguments
1514
+ * * `img` - A PhotonImage.
1515
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1516
+ *
1517
+ * # Example
1518
+ * ```no_run
1519
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSV colour space:
1520
+ * use photon_rs::colour_spaces::hue_rotate_hsv;
1521
+ * use photon_rs::native::open_image;
1522
+ *
1523
+ * // Open the image. A PhotonImage is returned.
1524
+ * let mut img = open_image("img.jpg").expect("File should open");
1525
+ * hue_rotate_hsv(&mut img, 120_f32);
1526
+ * ```
1527
+ */
1528
+ export function hue_rotate_hsv(img: PhotonImage, degrees: number): void;
1529
+
1530
+ /**
1531
+ * Shift hue by a specified number of degrees in the LCh colour space.
1532
+ * # Arguments
1533
+ * * `img` - A PhotonImage.
1534
+ * * `mode` - A float value from 0 to 1 which is the amount to shift the hue by, or hue rotate by.
1535
+ *
1536
+ * # Example
1537
+ * ```no_run
1538
+ * // For example to hue rotate/shift the hue by 120 degrees in the HSL colour space:
1539
+ * use photon_rs::colour_spaces::hue_rotate_lch;
1540
+ * use photon_rs::native::open_image;
1541
+ *
1542
+ * // Open the image. A PhotonImage is returned.
1543
+ * let mut img = open_image("img.jpg").expect("File should open");
1544
+ * hue_rotate_lch(&mut img, 120_f32);
1545
+ * ```
1546
+ */
1547
+ export function hue_rotate_lch(img: PhotonImage, degrees: number): void;
1548
+
1549
+ /**
1550
+ * Apply an identity kernel convolution to an image.
1551
+ *
1552
+ * # Arguments
1553
+ * * `img` -A PhotonImage.
1554
+ *
1555
+ * # Example
1556
+ *
1557
+ * ```no_run
1558
+ * // For example, to apply an identity kernel convolution:
1559
+ * use photon_rs::conv::identity;
1560
+ * use photon_rs::native::open_image;
1561
+ *
1562
+ * let mut img = open_image("img.jpg").expect("File should open");
1563
+ * identity(&mut img);
1564
+ * ```
1565
+ */
1566
+ export function identity(photon_image: PhotonImage): void;
1567
+
1568
+ /**
1569
+ * Increase the brightness of an image by a constant.
1570
+ *
1571
+ * # Arguments
1572
+ * * `img` - A PhotonImage that contains a view into the image.
1573
+ * * `brightness` - A u8 to add to the brightness.
1574
+ * # Example
1575
+ *
1576
+ * ```no_run
1577
+ * use photon_rs::effects::inc_brightness;
1578
+ * use photon_rs::native::open_image;
1579
+ *
1580
+ * let mut img = open_image("img.jpg").expect("File should open");
1581
+ * inc_brightness(&mut img, 10_u8);
1582
+ * ```
1583
+ */
1584
+ export function inc_brightness(photon_image: PhotonImage, brightness: number): void;
1585
+
1586
+ /**
1587
+ * Invert RGB value of an image.
1588
+ *
1589
+ * # Arguments
1590
+ * * `photon_image` - A DynamicImage that contains a view into the image.
1591
+ * # Example
1592
+ *
1593
+ * ```no_run
1594
+ * use photon_rs::channels::invert;
1595
+ * use photon_rs::native::open_image;
1596
+ *
1597
+ * let mut img = open_image("img.jpg").expect("File should open");
1598
+ * invert(&mut img);
1599
+ * ```
1600
+ */
1601
+ export function invert(photon_image: PhotonImage): void;
1602
+
1603
+ /**
1604
+ * Apply a standard laplace convolution.
1605
+ *
1606
+ * # Arguments
1607
+ * * `img` - A PhotonImage.
1608
+ *
1609
+ * # Example
1610
+ *
1611
+ * ```no_run
1612
+ * // For example, to apply a laplace effect:
1613
+ * use photon_rs::conv::laplace;
1614
+ * use photon_rs::native::open_image;
1615
+ *
1616
+ * let mut img = open_image("img.jpg").expect("File should open");
1617
+ * laplace(&mut img);
1618
+ * ```
1619
+ */
1620
+ export function laplace(photon_image: PhotonImage): void;
1621
+
1622
+ /**
1623
+ * Image manipulation effects in the LCh colour space
1624
+ *
1625
+ * Effects include:
1626
+ * * **saturate** - Saturation increase.
1627
+ * * **desaturate** - Desaturate the image.
1628
+ * * **shift_hue** - Hue rotation by a specified number of degrees.
1629
+ * * **darken** - Decrease the brightness.
1630
+ * * **lighten** - Increase the brightness.
1631
+ *
1632
+ * # Arguments
1633
+ * * `photon_image` - A PhotonImage.
1634
+ * * `mode` - The effect desired to be applied. Choose from: `saturate`, `desaturate`, `shift_hue`, `darken`, `lighten`
1635
+ * * `amt` - A float value from 0 to 1 which represents the amount the effect should be increased by.
1636
+ * # Example
1637
+ * ```no_run
1638
+ * // For example to increase the saturation by 10%:
1639
+ * use photon_rs::colour_spaces::lch;
1640
+ * use photon_rs::native::open_image;
1641
+ *
1642
+ * // Open the image. A PhotonImage is returned.
1643
+ * let mut img = open_image("img.jpg").expect("File should open");
1644
+ * lch(&mut img, "saturate", 0.1_f32);
1645
+ * ```
1646
+ */
1647
+ export function lch(photon_image: PhotonImage, mode: string, amt: number): void;
1648
+
1649
+ /**
1650
+ * Lighten an image by a specified amount in the HSL colour space.
1651
+ * # Arguments
1652
+ * * `img` - A PhotonImage.
1653
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1654
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1655
+ * Lightening by 80% would be represented by a `level` of 0.8
1656
+ *
1657
+ * # Example
1658
+ * ```no_run
1659
+ * // For example to lighten an image by 10% in the HSL colour space:
1660
+ * use photon_rs::colour_spaces::lighten_hsl;
1661
+ * use photon_rs::native::open_image;
1662
+ *
1663
+ * // Open the image. A PhotonImage is returned.
1664
+ * let mut img = open_image("img.jpg").expect("File should open");
1665
+ * lighten_hsl(&mut img, 0.1_f32);
1666
+ * ```
1667
+ */
1668
+ export function lighten_hsl(img: PhotonImage, level: number): void;
1669
+
1670
+ /**
1671
+ * Lighten an image by a specified amount in the HSLuv colour space.
1672
+ *
1673
+ * # Arguments
1674
+ * * `img` - A PhotonImage.
1675
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1676
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1677
+ * Lightening by 80% would be represented by a `level` of 0.8
1678
+ *
1679
+ * # Example
1680
+ * ```no_run
1681
+ * // For example to lighten an image by 10% in the HSLuv colour space:
1682
+ * use photon_rs::colour_spaces::lighten_hsluv;
1683
+ * use photon_rs::native::open_image;
1684
+ *
1685
+ * // Open the image. A PhotonImage is returned.
1686
+ * let mut img = open_image("img.jpg").expect("File should open");
1687
+ * lighten_hsluv(&mut img, 0.1_f32);
1688
+ * ```
1689
+ */
1690
+ export function lighten_hsluv(img: PhotonImage, level: number): void;
1691
+
1692
+ /**
1693
+ * Lighten an image by a specified amount in the HSV colour space.
1694
+ *
1695
+ * # Arguments
1696
+ * * `img` - A PhotonImage.
1697
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1698
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1699
+ * Lightening by 80% would be represented by a `level` of 0.8
1700
+ *
1701
+ * # Example
1702
+ * ```no_run
1703
+ * // For example to lighten an image by 10% in the HSV colour space:
1704
+ * use photon_rs::colour_spaces::lighten_hsv;
1705
+ * use photon_rs::native::open_image;
1706
+ *
1707
+ * // Open the image. A PhotonImage is returned.
1708
+ * let mut img = open_image("img.jpg").expect("File should open");
1709
+ * lighten_hsv(&mut img, 0.1_f32);
1710
+ * ```
1711
+ */
1712
+ export function lighten_hsv(img: PhotonImage, level: number): void;
1713
+
1714
+ /**
1715
+ * Lighten an image by a specified amount in the LCh colour space.
1716
+ *
1717
+ * # Arguments
1718
+ * * `img` - A PhotonImage.
1719
+ * * `level` - Float value from 0 to 1 representing the level to which to lighten the image by.
1720
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
1721
+ * Lightening by 80% would be represented by a `level` of 0.8
1722
+ *
1723
+ * # Example
1724
+ * ```no_run
1725
+ * // For example to lighten an image by 10% in the LCh colour space:
1726
+ * use photon_rs::colour_spaces::lighten_lch;
1727
+ * use photon_rs::native::open_image;
1728
+ *
1729
+ * // Open the image. A PhotonImage is returned.
1730
+ * let mut img = open_image("img.jpg").expect("File should open");
1731
+ * lighten_lch(&mut img, 0.1_f32);
1732
+ * ```
1733
+ */
1734
+ export function lighten_lch(img: PhotonImage, level: number): void;
1735
+
1736
+ /**
1737
+ * Solarization on the Red and Green channels.
1738
+ *
1739
+ * # Arguments
1740
+ * * `img` - A PhotonImage.
1741
+ * # Example
1742
+ *
1743
+ * ```no_run
1744
+ * use photon_rs::filters::lix;
1745
+ * use photon_rs::native::open_image;
1746
+ *
1747
+ * let mut img = open_image("img.jpg").expect("File should open");
1748
+ * lix(&mut img);
1749
+ * ```
1750
+ */
1751
+ export function lix(photon_image: PhotonImage): void;
1752
+
1753
+ /**
1754
+ * Apply a lofi effect to an image.
1755
+ *
1756
+ * # Arguments
1757
+ * * `img` - A PhotonImage.
1758
+ * # Example
1759
+ *
1760
+ * ```no_run
1761
+ * use photon_rs::filters::lofi;
1762
+ * use photon_rs::native::open_image;
1763
+ *
1764
+ * let mut img = open_image("img.jpg").expect("File should open");
1765
+ * lofi(&mut img);
1766
+ * ```
1767
+ */
1768
+ export function lofi(img: PhotonImage): void;
1769
+
1770
+ /**
1771
+ * Mix image with a single color, supporting passing `opacity`.
1772
+ * The algorithm comes from Jimp. See `function mix` and `function colorFn` at following link:
1773
+ * https://github.com/oliver-moran/jimp/blob/29679faa597228ff2f20d34c5758e4d2257065a3/packages/plugin-color/src/index.js
1774
+ * Specifically, result_value = (mix_color_value - origin_value) * opacity + origin_value =
1775
+ * mix_color_value * opacity + (1 - opacity) * origin_value for each
1776
+ * of RGB channel.
1777
+ *
1778
+ * # Arguments
1779
+ * * `photon_image` - A PhotonImage that contains a view into the image.
1780
+ * * `mix_color` - the color to be mixed in, as an RGB value.
1781
+ * * `opacity` - the opacity of color when mixed to image. Float value from 0 to 1.
1782
+ * # Example
1783
+ *
1784
+ * ```no_run
1785
+ * // For example, to mix an image with rgb (50, 255, 254) and opacity 0.4:
1786
+ * use photon_rs::Rgb;
1787
+ * use photon_rs::colour_spaces::mix_with_colour;
1788
+ * use photon_rs::native::open_image;
1789
+ *
1790
+ * let mix_colour = Rgb::new(50_u8, 255_u8, 254_u8);
1791
+ * let mut img = open_image("img.jpg").expect("File should open");
1792
+ * mix_with_colour(&mut img, mix_colour, 0.4_f32);
1793
+ * ```
1794
+ */
1795
+ export function mix_with_colour(photon_image: PhotonImage, mix_colour: Rgb, opacity: number): void;
1796
+
1797
+ /**
1798
+ * Apply a monochrome effect of a certain colour.
1799
+ *
1800
+ * It does so by averaging the R, G, and B values of a pixel, and then adding a
1801
+ * separate value to that averaged value for each channel to produce a tint.
1802
+ * # Arguments
1803
+ * * `photon_image` - A PhotonImage.
1804
+ * * `r_offset` - The value to add to the Red channel per pixel.
1805
+ * * `g_offset` - The value to add to the Green channel per pixel.
1806
+ * * `b_offset` - The value to add to the Blue channel per pixel.
1807
+ *
1808
+ * # Example
1809
+ *
1810
+ * ```no_run
1811
+ * // For example, to apply a monochrome effect to an image:
1812
+ * use photon_rs::monochrome::monochrome;
1813
+ * use photon_rs::native::open_image;
1814
+ *
1815
+ * let mut img = open_image("img.jpg").expect("File should open");
1816
+ * monochrome(&mut img, 40_u32, 50_u32, 100_u32);
1817
+ * ```
1818
+ */
1819
+ export function monochrome(img: PhotonImage, r_offset: number, g_offset: number, b_offset: number): void;
1820
+
1821
+ /**
1822
+ * Monochrome tint effect with increased contrast
1823
+ *
1824
+ * # Arguments
1825
+ * * `img` - A PhotonImage.
1826
+ * * `rgb_color` - RGB color
1827
+ * # Example
1828
+ *
1829
+ * ```no_run
1830
+ * use photon_rs::filters::monochrome_tint;
1831
+ * use photon_rs::native::open_image;
1832
+ * use photon_rs::Rgb;
1833
+ *
1834
+ * let mut img = open_image("img.jpg").expect("File should open");
1835
+ * let rgb_color = Rgb::new(12, 12, 10);
1836
+ * monochrome_tint(&mut img, rgb_color);
1837
+ * ```
1838
+ */
1839
+ export function monochrome_tint(img: PhotonImage, rgb_color: Rgb): void;
1840
+
1841
+ /**
1842
+ * Adds multiple offsets to the image by a certain number of pixels (on two channels).
1843
+ *
1844
+ * # Arguments
1845
+ * * `img` - A PhotonImage that contains a view into the image.
1846
+ * * `offset` - The offset is added to the pixels in the image.
1847
+ * # Example
1848
+ *
1849
+ * ```no_run
1850
+ * // For example, to add a 30-pixel offset to both the red and blue channels:
1851
+ * use photon_rs::effects::multiple_offsets;
1852
+ * use photon_rs::native::open_image;
1853
+ *
1854
+ * let mut img = open_image("img.jpg").expect("File should open");
1855
+ * multiple_offsets(&mut img, 30_u32, 0_usize, 2_usize);
1856
+ * ```
1857
+ */
1858
+ export function multiple_offsets(photon_image: PhotonImage, offset: number, channel_index: number, channel_index2: number): void;
1859
+
1860
+ /**
1861
+ * Solarization on the Blue channel.
1862
+ *
1863
+ * # Arguments
1864
+ * * `img` - A PhotonImage.
1865
+ * # Example
1866
+ *
1867
+ * ```no_run
1868
+ * use photon_rs::filters::neue;
1869
+ * use photon_rs::native::open_image;
1870
+ *
1871
+ * let mut img = open_image("img.jpg").expect("File should open");
1872
+ * neue(&mut img);
1873
+ * ```
1874
+ */
1875
+ export function neue(photon_image: PhotonImage): void;
1876
+
1877
+ /**
1878
+ * Noise reduction.
1879
+ *
1880
+ * # Arguments
1881
+ * * `img` - A PhotonImage.
1882
+ *
1883
+ * # Example
1884
+ *
1885
+ * ```no_run
1886
+ * // For example, to noise reduct an image:
1887
+ * use photon_rs::conv::noise_reduction;
1888
+ * use photon_rs::native::open_image;
1889
+ *
1890
+ * let mut img = open_image("img.jpg").expect("File should open");
1891
+ * noise_reduction(&mut img);
1892
+ * ```
1893
+ * Adds a constant to a select R, G, or B channel's value.
1894
+ */
1895
+ export function noise_reduction(photon_image: PhotonImage): void;
1896
+
1897
+ /**
1898
+ * Normalizes an image by remapping its range of pixels values. Only RGB
1899
+ * channels are processed and each channel is stretched to \[0, 255\] range
1900
+ * independently. This process is also known as contrast stretching.
1901
+ * # Arguments
1902
+ * * `photon_image` - A PhotonImage that contains a view into the image.
1903
+ * # Example
1904
+ *
1905
+ * ```no_run
1906
+ * // For example, to turn an image of type `PhotonImage` into a normalized image:
1907
+ * use photon_rs::effects::normalize;
1908
+ * use photon_rs::native::open_image;
1909
+ *
1910
+ * let mut img = open_image("img.jpg").expect("File should open");
1911
+ * normalize(&mut img);
1912
+ * ```
1913
+ */
1914
+ export function normalize(photon_image: PhotonImage): void;
1915
+
1916
+ /**
1917
+ * Apply a greyscale effect with increased contrast.
1918
+ *
1919
+ * # Arguments
1920
+ * * `img` - A PhotonImage.
1921
+ * # Example
1922
+ *
1923
+ * ```no_run
1924
+ * use photon_rs::filters::obsidian;
1925
+ * use photon_rs::native::open_image;
1926
+ *
1927
+ * let mut img = open_image("img.jpg").expect("File should open");
1928
+ * obsidian(&mut img);
1929
+ * ```
1930
+ */
1931
+ export function obsidian(img: PhotonImage): void;
1932
+
1933
+ /**
1934
+ * Adds an offset to the image by a certain number of pixels.
1935
+ *
1936
+ * This creates an RGB shift effect.
1937
+ *
1938
+ * # Arguments
1939
+ * * `img` - A PhotonImage that contains a view into the image.
1940
+ * * `channel_index`: The index of the channel to increment. 0 for red, 1 for green and 2 for blue.
1941
+ * * `offset` - The offset is added to the pixels in the image.
1942
+ * # Example
1943
+ *
1944
+ * ```no_run
1945
+ * // For example, to offset pixels by 30 pixels on the red channel:
1946
+ * use photon_rs::effects::offset;
1947
+ * use photon_rs::native::open_image;
1948
+ *
1949
+ * let mut img = open_image("img.jpg").expect("File should open");
1950
+ * offset(&mut img, 0_usize, 30_u32);
1951
+ * ```
1952
+ */
1953
+ export function offset(photon_image: PhotonImage, channel_index: number, offset: number): void;
1954
+
1955
+ /**
1956
+ * Adds an offset to the blue channel by a certain number of pixels.
1957
+ *
1958
+ * # Arguments
1959
+ * * `img` - A PhotonImage that contains a view into the image.
1960
+ * * `offset_amt` - The offset you want to move the blue channel by.
1961
+ * # Example
1962
+ * // For example, to add an offset to the green channel by 40 pixels.
1963
+ *
1964
+ * ```no_run
1965
+ * use photon_rs::effects::offset_blue;
1966
+ * use photon_rs::native::open_image;
1967
+ *
1968
+ * let mut img = open_image("img.jpg").expect("File should open");
1969
+ * offset_blue(&mut img, 40_u32);
1970
+ * ```
1971
+ */
1972
+ export function offset_blue(img: PhotonImage, offset_amt: number): void;
1973
+
1974
+ /**
1975
+ * Adds an offset to the green channel by a certain number of pixels.
1976
+ *
1977
+ * # Arguments
1978
+ * * `img` - A PhotonImage that contains a view into the image.
1979
+ * * `offset` - The offset you want to move the green channel by.
1980
+ * # Example
1981
+ *
1982
+ * ```no_run
1983
+ * // For example, to add an offset to the green channel by 30 pixels.
1984
+ * use photon_rs::effects::offset_green;
1985
+ * use photon_rs::native::open_image;
1986
+ *
1987
+ * let mut img = open_image("img.jpg").expect("File should open");
1988
+ * offset_green(&mut img, 30_u32);
1989
+ * ```
1990
+ */
1991
+ export function offset_green(img: PhotonImage, offset_amt: number): void;
1992
+
1993
+ /**
1994
+ * Adds an offset to the red channel by a certain number of pixels.
1995
+ *
1996
+ * # Arguments
1997
+ * * `img` - A PhotonImage that contains a view into the image.
1998
+ * * `offset` - The offset you want to move the red channel by.
1999
+ * # Example
2000
+ *
2001
+ * ```no_run
2002
+ * // For example, to add an offset to the red channel by 30 pixels.
2003
+ * use photon_rs::effects::offset_red;
2004
+ * use photon_rs::native::open_image;
2005
+ *
2006
+ * let mut img = open_image("img.jpg").expect("File should open");
2007
+ * offset_red(&mut img, 30_u32);
2008
+ * ```
2009
+ */
2010
+ export function offset_red(img: PhotonImage, offset_amt: number): void;
2011
+
2012
+ /**
2013
+ * Turn an image into an oil painting
2014
+ *
2015
+ * # Arguments
2016
+ * * `img` - A PhotonImage that contains a view into the image.
2017
+ * * `radius` - Radius of each paint particle
2018
+ * * `intesnity` - How artsy an Image should be
2019
+ * # Example
2020
+ *
2021
+ * ```no_run
2022
+ * // For example, to oil an image of type `PhotonImage`:
2023
+ * use photon_rs::effects::oil;
2024
+ * use photon_rs::native::open_image;
2025
+ *
2026
+ * let mut img = open_image("img.jpg").expect("File should open");
2027
+ * oil(&mut img, 4i32, 55.0);
2028
+ * ```
2029
+ */
2030
+ export function oil(photon_image: PhotonImage, radius: number, intensity: number): void;
2031
+
2032
+ /**
2033
+ * Convert a HTML5 Canvas Element to a PhotonImage.
2034
+ *
2035
+ * This converts the ImageData found in the canvas context to a PhotonImage,
2036
+ * which can then have effects or filters applied to it.
2037
+ */
2038
+ export function open_image(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D): PhotonImage;
2039
+
2040
+ /**
2041
+ * Apply padding on the left side of the PhotonImage
2042
+ * A padded PhotonImage is returned.
2043
+ * # Arguments
2044
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2045
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2046
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2047
+ *
2048
+ * # Example
2049
+ *
2050
+ * ```no_run
2051
+ * // For example, to apply a padding of 10 pixels on the bottom of a PhotonImage:
2052
+ * use photon_rs::transform::padding_bottom;
2053
+ * use photon_rs::native::open_image;
2054
+ * use photon_rs::Rgba;
2055
+ *
2056
+ * let mut img = open_image("img.jpg").expect("File should open");
2057
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2058
+ * padding_bottom(&img, 10_u32, rgba);
2059
+ * ```
2060
+ */
2061
+ export function padding_bottom(img: PhotonImage, padding: number, padding_rgba: Rgba): PhotonImage;
2062
+
2063
+ /**
2064
+ * Apply padding on the left side of the PhotonImage
2065
+ * A padded PhotonImage is returned.
2066
+ * # Arguments
2067
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2068
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2069
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2070
+ *
2071
+ * # Example
2072
+ *
2073
+ * ```no_run
2074
+ * // For example, to apply a padding of 10 pixels on the left side of a PhotonImage:
2075
+ * use photon_rs::transform::padding_left;
2076
+ * use photon_rs::native::open_image;
2077
+ * use photon_rs::Rgba;
2078
+ *
2079
+ * let mut img = open_image("img.jpg").expect("File should open");
2080
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2081
+ * padding_left(&img, 10_u32, rgba);
2082
+ * ```
2083
+ */
2084
+ export function padding_left(img: PhotonImage, padding: number, padding_rgba: Rgba): PhotonImage;
2085
+
2086
+ /**
2087
+ * Apply padding on the left side of the PhotonImage
2088
+ * A padded PhotonImage is returned.
2089
+ * # Arguments
2090
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2091
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2092
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2093
+ *
2094
+ * # Example
2095
+ *
2096
+ * ```no_run
2097
+ * // For example, to apply a padding of 10 pixels on the right side of a PhotonImage:
2098
+ * use photon_rs::transform::padding_right;
2099
+ * use photon_rs::native::open_image;
2100
+ * use photon_rs::Rgba;
2101
+ *
2102
+ * let mut img = open_image("img.jpg").expect("File should open");
2103
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2104
+ * padding_right(&img, 10_u32, rgba);
2105
+ * ```
2106
+ */
2107
+ export function padding_right(img: PhotonImage, padding: number, padding_rgba: Rgba): PhotonImage;
2108
+
2109
+ /**
2110
+ * Apply padding on the left side of the PhotonImage
2111
+ * A padded PhotonImage is returned.
2112
+ * # Arguments
2113
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2114
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2115
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2116
+ *
2117
+ * # Example
2118
+ *
2119
+ * ```no_run
2120
+ * // For example, to apply a padding of 10 pixels on the top of a PhotonImage:
2121
+ * use photon_rs::transform::padding_top;
2122
+ * use photon_rs::native::open_image;
2123
+ * use photon_rs::Rgba;
2124
+ *
2125
+ * let mut img = open_image("img.jpg").expect("File should open");
2126
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2127
+ * padding_top(&img, 10_u32, rgba);
2128
+ * ```
2129
+ */
2130
+ export function padding_top(img: PhotonImage, padding: number, padding_rgba: Rgba): PhotonImage;
2131
+
2132
+ /**
2133
+ * Apply uniform padding around the PhotonImage
2134
+ * A padded PhotonImage is returned.
2135
+ * # Arguments
2136
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2137
+ * * `padding` - The amount of padding to be applied to the PhotonImage.
2138
+ * * `padding_rgba` - Tuple containing the RGBA code for padding color.
2139
+ *
2140
+ * # Example
2141
+ *
2142
+ * ```no_run
2143
+ * // For example, to apply a padding of 10 pixels around a PhotonImage:
2144
+ * use photon_rs::transform::padding_uniform;
2145
+ * use photon_rs::native::open_image;
2146
+ * use photon_rs::Rgba;
2147
+ *
2148
+ * let mut img = open_image("img.jpg").expect("File should open");
2149
+ * let rgba = Rgba::new(200_u8, 100_u8, 150_u8, 255_u8);
2150
+ * padding_uniform(&img, 10_u32, rgba);
2151
+ * ```
2152
+ */
2153
+ export function padding_uniform(img: PhotonImage, padding: number, padding_rgba: Rgba): PhotonImage;
2154
+
2155
+ /**
2156
+ * Apply a rose tint to an image.
2157
+ *
2158
+ * # Arguments
2159
+ * * `img` - A PhotonImage.
2160
+ * # Example
2161
+ *
2162
+ * ```no_run
2163
+ * use photon_rs::filters::pastel_pink;
2164
+ * use photon_rs::native::open_image;
2165
+ *
2166
+ * let mut img = open_image("img.jpg").expect("File should open");
2167
+ * pastel_pink(&mut img);
2168
+ * ```
2169
+ */
2170
+ export function pastel_pink(img: PhotonImage): void;
2171
+
2172
+ /**
2173
+ * Add pink-tinted noise to an image.
2174
+ *
2175
+ * **[WASM SUPPORT IS AVAILABLE]**: Randomized thread pools cannot be created with WASM, but
2176
+ * a workaround using js_sys::Math::random works now.
2177
+ * # Arguments
2178
+ * * `name` - A PhotonImage that contains a view into the image.
2179
+ *
2180
+ * # Example
2181
+ *
2182
+ * ```no_run
2183
+ * // For example, to add pink-tinted noise to an image:
2184
+ * use photon_rs::native::open_image;
2185
+ * use photon_rs::noise::pink_noise;
2186
+ *
2187
+ * let mut img = open_image("img.jpg").expect("File should open");
2188
+ * pink_noise(&mut img);
2189
+ * ```
2190
+ */
2191
+ export function pink_noise(photon_image: PhotonImage): void;
2192
+
2193
+ /**
2194
+ * Pixelize an image.
2195
+ *
2196
+ * # Arguments
2197
+ * * `photon_image` - A PhotonImage that contains a view into the image.
2198
+ * * `pixel_size` - Targeted pixel size of generated image.
2199
+ * # Example
2200
+ *
2201
+ * ```no_run
2202
+ * // For example, to turn an image of type `PhotonImage` into a pixelized image with 50 pixels blocks:
2203
+ * use photon_rs::effects::pixelize;
2204
+ * use photon_rs::native::open_image;
2205
+ *
2206
+ * let mut img = open_image("img.jpg").expect("File should open");
2207
+ * pixelize(&mut img, 50);
2208
+ * ```
2209
+ */
2210
+ export function pixelize(photon_image: PhotonImage, pixel_size: number): void;
2211
+
2212
+ /**
2213
+ * Apply a horizontal Prewitt convolution to an image.
2214
+ *
2215
+ * # Arguments
2216
+ * * `img` - A PhotonImage.
2217
+ *
2218
+ * # Example
2219
+ *
2220
+ * ```no_run
2221
+ * // For example, to apply a horizontal Prewitt convolution effect:
2222
+ * use photon_rs::conv::prewitt_horizontal;
2223
+ * use photon_rs::native::open_image;
2224
+ *
2225
+ * let mut img = open_image("img.jpg").expect("File should open");
2226
+ * prewitt_horizontal(&mut img);
2227
+ * ```
2228
+ */
2229
+ export function prewitt_horizontal(photon_image: PhotonImage): void;
2230
+
2231
+ /**
2232
+ * Reduces an image to the primary colours.
2233
+ *
2234
+ * # Arguments
2235
+ * * `img` - A PhotonImage that contains a view into the image.
2236
+ * # Example
2237
+ *
2238
+ * ```no_run
2239
+ * // For example, to add a primary colour effect to an image of type `DynamicImage`:
2240
+ * use photon_rs::effects::primary;
2241
+ * use photon_rs::native::open_image;
2242
+ *
2243
+ * let mut img = open_image("img.jpg").expect("File should open");
2244
+ * primary(&mut img);
2245
+ * ```
2246
+ */
2247
+ export function primary(img: PhotonImage): void;
2248
+
2249
+ /**
2250
+ * Place a PhotonImage onto a 2D canvas.
2251
+ */
2252
+ export function putImageData(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, new_image: PhotonImage): void;
2253
+
2254
+ /**
2255
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to the Red channel's value.
2256
+ *
2257
+ * # Arguments
2258
+ * * `photon_image` - A PhotonImage.
2259
+ *
2260
+ * # Example
2261
+ *
2262
+ * ```no_run
2263
+ * use photon_rs::monochrome::r_grayscale;
2264
+ * use photon_rs::native::open_image;
2265
+ *
2266
+ * let mut img = open_image("img.jpg").expect("File should open");
2267
+ * r_grayscale(&mut img);
2268
+ * ```
2269
+ */
2270
+ export function r_grayscale(photon_image: PhotonImage): void;
2271
+
2272
+ /**
2273
+ * Remove the Blue channel's influence in an image.
2274
+ *
2275
+ * # Arguments
2276
+ * * `img` - A PhotonImage.
2277
+ * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
2278
+ *
2279
+ * # Example
2280
+ *
2281
+ * ```no_run
2282
+ * // For example, to remove the blue channel for blue channel pixel values less than 50:
2283
+ * use photon_rs::channels::remove_blue_channel;
2284
+ * use photon_rs::native::open_image;
2285
+ *
2286
+ * let mut img = open_image("img.jpg").expect("File should open");
2287
+ * remove_blue_channel(&mut img, 50_u8);
2288
+ * ```
2289
+ */
2290
+ export function remove_blue_channel(img: PhotonImage, min_filter: number): void;
2291
+
2292
+ /**
2293
+ * Set a certain channel to zero, thus removing the channel's influence in the pixels' final rendered colour.
2294
+ *
2295
+ * # Arguments
2296
+ * * `img` - A PhotonImage.
2297
+ * * `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.
2298
+ * * `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
2299
+ * 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,
2300
+ * then channel would be 0 and min_filter would be 50.
2301
+ *
2302
+ * # Example
2303
+ *
2304
+ * ```no_run
2305
+ * // For example, to remove the Red channel with a min_filter of 100:
2306
+ * use photon_rs::channels::remove_channel;
2307
+ * use photon_rs::native::open_image;
2308
+ *
2309
+ * let mut img = open_image("img.jpg").expect("File should open");
2310
+ * remove_channel(&mut img, 0_usize, 100_u8);
2311
+ * ```
2312
+ */
2313
+ export function remove_channel(img: PhotonImage, channel: number, min_filter: number): void;
2314
+
2315
+ /**
2316
+ * Remove the Green channel's influence in an image.
2317
+ *
2318
+ * # Arguments
2319
+ * * `img` - A PhotonImage.
2320
+ * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
2321
+ *
2322
+ * # Example
2323
+ *
2324
+ * ```no_run
2325
+ * // For example, to remove the green channel for green channel pixel values less than 50:
2326
+ * use photon_rs::channels::remove_green_channel;
2327
+ * use photon_rs::native::open_image;
2328
+ *
2329
+ * let mut img = open_image("img.jpg").expect("File should open");
2330
+ * remove_green_channel(&mut img, 50_u8);
2331
+ * ```
2332
+ */
2333
+ export function remove_green_channel(img: PhotonImage, min_filter: number): void;
2334
+
2335
+ /**
2336
+ * Remove the Red channel's influence in an image.
2337
+ *
2338
+ * # Arguments
2339
+ * * `img` - A PhotonImage.
2340
+ * * `min_filter` - Only remove the channel if the current pixel's channel value is less than this minimum filter.
2341
+ *
2342
+ * # Example
2343
+ *
2344
+ * ```no_run
2345
+ * // For example, to remove the red channel for red channel pixel values less than 50:
2346
+ * use photon_rs::channels::remove_red_channel;
2347
+ * use photon_rs::native::open_image;
2348
+ *
2349
+ * let mut img = open_image("img.jpg").expect("File should open");
2350
+ * remove_red_channel(&mut img, 50_u8);
2351
+ * ```
2352
+ */
2353
+ export function remove_red_channel(img: PhotonImage, min_filter: number): void;
2354
+
2355
+ /**
2356
+ * Resample the PhotonImage.
2357
+ *
2358
+ * # Arguments
2359
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2360
+ * * `dst_width` - Target width.
2361
+ * * `dst_height` - Target height.
2362
+ *
2363
+ * # Example
2364
+ *
2365
+ * ```no_run
2366
+ * // For example, to resample a PhotonImage to 1920x1080 size:
2367
+ * use photon_rs::native::open_image;
2368
+ * use photon_rs::transform::resample;
2369
+ *
2370
+ * let img = open_image("img.jpg").expect("File should open");
2371
+ * let rotated_img = resample(&img, 1920, 1080);
2372
+ * ```
2373
+ */
2374
+ export function resample(img: PhotonImage, dst_width: number, dst_height: number): PhotonImage;
2375
+
2376
+ /**
2377
+ * Resize an image.
2378
+ *
2379
+ * # Arguments
2380
+ * * `img` - A PhotonImage.
2381
+ * * `width` - New width.
2382
+ * * `height` - New height.
2383
+ * * `sampling_filter` - Nearest = 1, Triangle = 2, CatmullRom = 3, Gaussian = 4, Lanczos3 = 5
2384
+ */
2385
+ export function resize(photon_img: PhotonImage, width: number, height: number, sampling_filter: SamplingFilter): PhotonImage;
2386
+
2387
+ /**
2388
+ * Resize an image on the web.
2389
+ *
2390
+ * # Arguments
2391
+ * * `img` - A PhotonImage.
2392
+ * * `width` - New width.
2393
+ * * `height` - New height.
2394
+ * * `sampling_filter` - Nearest = 1, Triangle = 2, CatmullRom = 3, Gaussian = 4, Lanczos3 = 5
2395
+ */
2396
+ export function resize_img_browser(photon_img: PhotonImage, width: number, height: number, sampling_filter: SamplingFilter): HTMLCanvasElement;
2397
+
2398
+ /**
2399
+ * Rotate the PhotonImage on an arbitrary angle
2400
+ * A rotated PhotonImage is returned.
2401
+ *
2402
+ * # Arguments
2403
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2404
+ * * `angle` - Rotation angle in degrees.
2405
+ *
2406
+ * # Example
2407
+ *
2408
+ * ```no_run
2409
+ * // For example, to rotate a PhotonImage by 30 degrees:
2410
+ * use photon_rs::native::open_image;
2411
+ * use photon_rs::transform::rotate;
2412
+ *
2413
+ * let img = open_image("img.jpg").expect("File should open");
2414
+ * let rotated_img = rotate(&img, 30.0);
2415
+ * ```
2416
+ */
2417
+ export function rotate(photon_img: PhotonImage, angle: number): PhotonImage;
2418
+
2419
+ /**
2420
+ * ! [temp] Check if WASM is supported.
2421
+ */
2422
+ export function run(): void;
2423
+
2424
+ /**
2425
+ * Solarization on the Red and Blue channels.
2426
+ *
2427
+ * # Arguments
2428
+ * * `img` - A PhotonImage.
2429
+ * # Example
2430
+ *
2431
+ * ```no_run
2432
+ * use photon_rs::filters::ryo;
2433
+ * use photon_rs::native::open_image;
2434
+ *
2435
+ * let mut img = open_image("img.jpg").expect("File should open");
2436
+ * ryo(&mut img);
2437
+ * ```
2438
+ */
2439
+ export function ryo(photon_image: PhotonImage): void;
2440
+
2441
+ /**
2442
+ * Increase the image's saturation by converting each pixel's colour to the HSL colour space
2443
+ * and increasing the colour's saturation.
2444
+ * # Arguments
2445
+ * * `img` - A PhotonImage.
2446
+ * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
2447
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
2448
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
2449
+ *
2450
+ * # Example
2451
+ * ```no_run
2452
+ * // For example to increase saturation by 10% in the HSL colour space:
2453
+ * use photon_rs::colour_spaces::saturate_hsl;
2454
+ * use photon_rs::native::open_image;
2455
+ *
2456
+ * // Open the image. A PhotonImage is returned.
2457
+ * let mut img = open_image("img.jpg").expect("File should open");
2458
+ * saturate_hsl(&mut img, 0.1_f32);
2459
+ * ```
2460
+ */
2461
+ export function saturate_hsl(img: PhotonImage, level: number): void;
2462
+
2463
+ /**
2464
+ * Increase the image's saturation in the HSLuv colour space.
2465
+ * # Arguments
2466
+ * * `img` - A PhotonImage.
2467
+ * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
2468
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
2469
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
2470
+ *
2471
+ * # Example
2472
+ * ```no_run
2473
+ * // For example to increase saturation by 40% in the HSLuv colour space:
2474
+ * use photon_rs::colour_spaces::saturate_hsluv;
2475
+ * use photon_rs::native::open_image;
2476
+ *
2477
+ * // Open the image. A PhotonImage is returned.
2478
+ * let mut img = open_image("img.jpg").expect("File should open");
2479
+ * saturate_hsluv(&mut img, 0.4_f32);
2480
+ * ```
2481
+ */
2482
+ export function saturate_hsluv(img: PhotonImage, level: number): void;
2483
+
2484
+ /**
2485
+ * Increase the image's saturation in the HSV colour space.
2486
+ * # Arguments
2487
+ * * `img` - A PhotonImage.
2488
+ * * `level` - Float value from 0 to 1 representing the level by which to increase the saturation by.
2489
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
2490
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
2491
+ *
2492
+ * # Example
2493
+ * ```no_run
2494
+ * // For example to increase saturation by 30% in the HSV colour space:
2495
+ * use photon_rs::colour_spaces::saturate_hsv;
2496
+ * use photon_rs::native::open_image;
2497
+ *
2498
+ * // Open the image. A PhotonImage is returned.
2499
+ * let mut img = open_image("img.jpg").expect("File should open");
2500
+ * saturate_hsv(&mut img, 0.3_f32);
2501
+ * ```
2502
+ */
2503
+ export function saturate_hsv(img: PhotonImage, level: number): void;
2504
+
2505
+ /**
2506
+ * Increase the image's saturation in the LCh colour space.
2507
+ * # Arguments
2508
+ * * `img` - A PhotonImage.
2509
+ * * `level` - Float value from 0 to 1 representing the level to which to increase the saturation by.
2510
+ * The `level` must be from 0 to 1 in floating-point, `f32` format.
2511
+ * Increasing saturation by 80% would be represented by a `level` of 0.8
2512
+ *
2513
+ * # Example
2514
+ * ```no_run
2515
+ * // For example to increase saturation by 40% in the Lch colour space:
2516
+ * use photon_rs::colour_spaces::saturate_lch;
2517
+ * use photon_rs::native::open_image;
2518
+ *
2519
+ * // Open the image. A PhotonImage is returned.
2520
+ * let mut img = open_image("img.jpg").expect("File should open");
2521
+ * saturate_lch(&mut img, 0.4_f32);
2522
+ * ```
2523
+ */
2524
+ export function saturate_lch(img: PhotonImage, level: number): void;
2525
+
2526
+ /**
2527
+ * Resize image using seam carver.
2528
+ * Resize only if new dimensions are smaller, than original image.
2529
+ * # NOTE: This is still experimental feature, and pretty slow.
2530
+ *
2531
+ * # Arguments
2532
+ * * `img` - A PhotonImage.
2533
+ * * `width` - New width.
2534
+ * * `height` - New height.
2535
+ *
2536
+ * # Example
2537
+ *
2538
+ * ```no_run
2539
+ * // For example, resize image using seam carver:
2540
+ * use photon_rs::native::open_image;
2541
+ * use photon_rs::transform::seam_carve;
2542
+ * use photon_rs::PhotonImage;
2543
+ *
2544
+ * let img = open_image("img.jpg").expect("File should open");
2545
+ * let result: PhotonImage = seam_carve(&img, 100_u32, 100_u32);
2546
+ * ```
2547
+ */
2548
+ export function seam_carve(img: PhotonImage, width: number, height: number): PhotonImage;
2549
+
2550
+ /**
2551
+ * Selectively change pixel colours which are similar to the reference colour provided.
2552
+ *
2553
+ * Similarity between two colours is calculated via the CIE76 formula.
2554
+ * Only changes the color of a pixel if its similarity to the reference colour is within the range in the algorithm.
2555
+ * For example, with this function, a user can change the color of all blue pixels by mixing them with red by 10%.
2556
+ * # Arguments
2557
+ * * `photon_image` - A PhotonImage.
2558
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
2559
+ * * `new_color` - The `RGB` value of the new color (to be mixed with the matched pixels)
2560
+ * * `fraction` - The amount of mixing the new colour with the matched pixels
2561
+ *
2562
+ * # Example
2563
+ *
2564
+ * ```no_run
2565
+ * // 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%:
2566
+ * use photon_rs::Rgb;
2567
+ * use photon_rs::channels::selective_color_convert;
2568
+ * use photon_rs::native::open_image;
2569
+ *
2570
+ * let ref_color = Rgb::new(200, 120, 30);
2571
+ * let new_color = Rgb::new(30, 120, 200);
2572
+ * let mut img = open_image("img.jpg").expect("File should open");
2573
+ * selective_color_convert(&mut img, ref_color, new_color, 0.25);
2574
+ * ```
2575
+ */
2576
+ export function selective_color_convert(photon_image: PhotonImage, ref_color: Rgb, new_color: Rgb, fraction: number): void;
2577
+
2578
+ /**
2579
+ * Selectively desaturate pixel colours which are similar to the reference colour provided.
2580
+ *
2581
+ * Similarity between two colours is calculated via the CIE76 formula.
2582
+ * Only desaturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm.
2583
+ * 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.
2584
+ * # Arguments
2585
+ * * `img` - A PhotonImage.
2586
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
2587
+ * * `amt` - The amount of desaturate the colour by.
2588
+ *
2589
+ * # Example
2590
+ *
2591
+ * ```no_run
2592
+ * // For example, to only desaturate the pixels that are similar to the RGB value RGB{20, 40, 60}:
2593
+ * use photon_rs::Rgb;
2594
+ * use photon_rs::channels::selective_desaturate;
2595
+ * use photon_rs::native::open_image;
2596
+ *
2597
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
2598
+ * let mut img = open_image("img.jpg").expect("File should open");
2599
+ * selective_desaturate(&mut img, ref_color, 0.1_f32);
2600
+ * ```
2601
+ */
2602
+ export function selective_desaturate(img: PhotonImage, ref_color: Rgb, amt: number): void;
2603
+
2604
+ /**
2605
+ * Selectively changes a pixel to greyscale if it is *not* visually similar or close to the colour specified.
2606
+ * Only changes the colour of a pixel if its RGB values are within a specified range.
2607
+ *
2608
+ * (Similarity between two colours is calculated via the CIE76 formula.)
2609
+ * 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
2610
+ * kept in the photo.
2611
+ * # Arguments
2612
+ * * `img` - A PhotonImage.
2613
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
2614
+ *
2615
+ * # Example
2616
+ *
2617
+ * ```no_run
2618
+ * // For example, to greyscale all pixels that are *not* visually similar to the RGB colour RGB{20, 40, 60}:
2619
+ * use photon_rs::Rgb;
2620
+ * use photon_rs::channels::selective_greyscale;
2621
+ * use photon_rs::native::open_image;
2622
+ *
2623
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
2624
+ * let mut img = open_image("img.jpg").expect("File should open");
2625
+ * selective_greyscale(img, ref_color);
2626
+ * ```
2627
+ */
2628
+ export function selective_greyscale(photon_image: PhotonImage, ref_color: Rgb): void;
2629
+
2630
+ /**
2631
+ * Selective hue rotation.
2632
+ *
2633
+ * Only rotate the hue of a pixel if its RGB values are within a specified range.
2634
+ * This function only rotates a pixel's hue to another if it is visually similar to the colour specified.
2635
+ * 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.
2636
+ * # Arguments
2637
+ * * `img` - A PhotonImage.
2638
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
2639
+ * * `degrees` - The amount of degrees to hue rotate by.
2640
+ *
2641
+ * # Example
2642
+ *
2643
+ * ```no_run
2644
+ * // For example, to only rotate the pixels that are of RGB value RGB{20, 40, 60}:
2645
+ * use photon_rs::Rgb;
2646
+ * use photon_rs::channels::selective_hue_rotate;
2647
+ * use photon_rs::native::open_image;
2648
+ *
2649
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
2650
+ * let mut img = open_image("img.jpg").expect("File should open");
2651
+ * selective_hue_rotate(&mut img, ref_color, 180_f32);
2652
+ * ```
2653
+ */
2654
+ export function selective_hue_rotate(photon_image: PhotonImage, ref_color: Rgb, degrees: number): void;
2655
+
2656
+ /**
2657
+ * Selectively lighten an image.
2658
+ *
2659
+ * Only lighten the hue of a pixel if its colour matches or is similar to the RGB colour specified.
2660
+ * 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.
2661
+ * # Arguments
2662
+ * * `img` - A PhotonImage.
2663
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
2664
+ * * `amt` - The level from 0 to 1 to lighten the hue by. Increasing by 10% would have an `amt` of 0.1
2665
+ *
2666
+ * # Example
2667
+ *
2668
+ * ```no_run
2669
+ * // For example, to only lighten the pixels that are of or similar to RGB value RGB{20, 40, 60}:
2670
+ * use photon_rs::Rgb;
2671
+ * use photon_rs::channels::selective_lighten;
2672
+ * use photon_rs::native::open_image;
2673
+ *
2674
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
2675
+ * let mut img = open_image("img.jpg").expect("File should open");
2676
+ * selective_lighten(&mut img, ref_color, 0.2_f32);
2677
+ * ```
2678
+ */
2679
+ export function selective_lighten(img: PhotonImage, ref_color: Rgb, amt: number): void;
2680
+
2681
+ /**
2682
+ * Selectively saturate pixel colours which are similar to the reference colour provided.
2683
+ *
2684
+ * Similarity between two colours is calculated via the CIE76 formula.
2685
+ * Only saturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm.
2686
+ * 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.
2687
+ * # Arguments
2688
+ * * `img` - A PhotonImage.
2689
+ * * `ref_color` - The `RGB` value of the reference color (to be compared to)
2690
+ * * `amt` - The amount of saturate the colour by.
2691
+ *
2692
+ * # Example
2693
+ *
2694
+ * ```no_run
2695
+ * // For example, to only increase the saturation of pixels that are similar to the RGB value RGB{20, 40, 60}:
2696
+ * use photon_rs::Rgb;
2697
+ * use photon_rs::channels::selective_saturate;
2698
+ * use photon_rs::native::open_image;
2699
+ *
2700
+ * let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
2701
+ * let mut img = open_image("img.jpg").expect("File should open");
2702
+ * selective_saturate(&mut img, ref_color, 0.1_f32);
2703
+ * ```
2704
+ */
2705
+ export function selective_saturate(img: PhotonImage, ref_color: Rgb, amt: number): void;
2706
+
2707
+ /**
2708
+ * Convert an image to sepia.
2709
+ *
2710
+ * # Arguments
2711
+ * * `photon_image` - A PhotonImage.
2712
+ * # Example
2713
+ *
2714
+ * ```no_run
2715
+ * // For example, to sepia an image of type `PhotonImage`:
2716
+ * use photon_rs::monochrome::sepia;
2717
+ * use photon_rs::native::open_image;
2718
+ *
2719
+ * let mut img = open_image("img.jpg").expect("File should open");
2720
+ * sepia(&mut img);
2721
+ * ```
2722
+ */
2723
+ export function sepia(img: PhotonImage): void;
2724
+
2725
+ /**
2726
+ * Sharpen an image.
2727
+ *
2728
+ * # Arguments
2729
+ * * `img` - A PhotonImage.
2730
+ *
2731
+ * # Example
2732
+ *
2733
+ * ```no_run
2734
+ * // For example, to sharpen an image:
2735
+ * use photon_rs::conv::sharpen;
2736
+ * use photon_rs::native::open_image;
2737
+ *
2738
+ * let mut img = open_image("img.jpg").expect("File should open");
2739
+ * sharpen(&mut img);
2740
+ * ```
2741
+ * Adds a constant to a select R, G, or B channel's value.
2742
+ */
2743
+ export function sharpen(photon_image: PhotonImage): void;
2744
+
2745
+ /**
2746
+ * Shear the image along the X axis.
2747
+ * A sheared PhotonImage is returned.
2748
+ *
2749
+ * # Arguments
2750
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2751
+ * * `shear` - Amount to shear.
2752
+ *
2753
+ * # Example
2754
+ *
2755
+ * ```no_run
2756
+ * // For example, to shear an image by 0.5:
2757
+ * use photon_rs::native::open_image;
2758
+ * use photon_rs::transform::shearx;
2759
+ *
2760
+ * let img = open_image("img.jpg").expect("File should open");
2761
+ * let sheared_img = shearx(&img, 0.5);
2762
+ * ```
2763
+ */
2764
+ export function shearx(photon_img: PhotonImage, shear: number): PhotonImage;
2765
+
2766
+ /**
2767
+ * Shear the image along the Y axis.
2768
+ * A sheared PhotonImage is returned.
2769
+ *
2770
+ * # Arguments
2771
+ * * `img` - A PhotonImage. See the PhotonImage struct for details.
2772
+ * * `shear` - Amount to shear.
2773
+ *
2774
+ * # Example
2775
+ *
2776
+ * ```no_run
2777
+ * // For example, to shear an image by 0.5:
2778
+ * use photon_rs::native::open_image;
2779
+ * use photon_rs::transform::sheary;
2780
+ *
2781
+ * let img = open_image("img.jpg").expect("File should open");
2782
+ * let sheared_img = sheary(&img, 0.5);
2783
+ * ```
2784
+ */
2785
+ export function sheary(photon_img: PhotonImage, shear: number): PhotonImage;
2786
+
2787
+ /**
2788
+ * Convert an image to grayscale by setting a pixel's 3 RGB values to a chosen channel's value.
2789
+ *
2790
+ * # Arguments
2791
+ * * `photon_image` - A PhotonImage.
2792
+ * * `channel` - A usize representing the channel from 0 to 2. O represents the Red channel, 1 the Green channel, and 2 the Blue channel.
2793
+ *
2794
+ * # Example
2795
+ * To grayscale using only values from the Red channel:
2796
+ * ```no_run
2797
+ * use photon_rs::monochrome::single_channel_grayscale;
2798
+ * use photon_rs::native::open_image;
2799
+ *
2800
+ * let mut img = open_image("img.jpg").expect("File should open");
2801
+ * single_channel_grayscale(&mut img, 0_usize);
2802
+ * ```
2803
+ */
2804
+ export function single_channel_grayscale(photon_image: PhotonImage, channel: number): void;
2805
+
2806
+ /**
2807
+ * Apply a global Sobel filter to an image
2808
+ *
2809
+ * Each pixel is calculated as the magnitude of the horizontal and vertical components of the Sobel filter,
2810
+ * ie if X is the horizontal sobel and Y is the vertical, for each pixel, we calculate sqrt(X^2 + Y^2)
2811
+ *
2812
+ * # Arguments
2813
+ * * `img` - A PhotonImage.
2814
+ *
2815
+ * # Example
2816
+ *
2817
+ * ```no_run
2818
+ * // For example, to apply a global Sobel filter:
2819
+ * use photon_rs::conv::sobel_global;
2820
+ * use photon_rs::native::open_image;
2821
+ *
2822
+ * let mut img = open_image("img.jpg").expect("File should open");
2823
+ * sobel_global(&mut img);
2824
+ * ```
2825
+ */
2826
+ export function sobel_global(photon_image: PhotonImage): void;
2827
+
2828
+ /**
2829
+ * Apply a horizontal Sobel filter to an image.
2830
+ *
2831
+ * # Arguments
2832
+ * * `img` - A PhotonImage.
2833
+ *
2834
+ * # Example
2835
+ *
2836
+ * ```no_run
2837
+ * // For example, to apply a horizontal Sobel filter:
2838
+ * use photon_rs::conv::sobel_horizontal;
2839
+ * use photon_rs::native::open_image;
2840
+ *
2841
+ * let mut img = open_image("img.jpg").expect("File should open");
2842
+ * sobel_horizontal(&mut img);
2843
+ * ```
2844
+ */
2845
+ export function sobel_horizontal(photon_image: PhotonImage): void;
2846
+
2847
+ /**
2848
+ * Apply a vertical Sobel filter to an image.
2849
+ *
2850
+ * # Arguments
2851
+ * * `img` - A PhotonImage.
2852
+ *
2853
+ * # Example
2854
+ *
2855
+ * ```no_run
2856
+ * // For example, to apply a vertical Sobel filter:
2857
+ * use photon_rs::conv::sobel_vertical;
2858
+ * use photon_rs::native::open_image;
2859
+ *
2860
+ * let mut img = open_image("img.jpg").expect("File should open");
2861
+ * sobel_vertical(&mut img);
2862
+ * ```
2863
+ */
2864
+ export function sobel_vertical(photon_image: PhotonImage): void;
2865
+
2866
+ /**
2867
+ * Applies a solarizing effect to an image.
2868
+ *
2869
+ * # Arguments
2870
+ * * `img` - A PhotonImage that contains a view into the image.
2871
+ * # Example
2872
+ *
2873
+ * ```no_run
2874
+ * // For example, to colorize an image of type `PhotonImage`:
2875
+ * use photon_rs::effects::solarize;
2876
+ * use photon_rs::native::open_image;
2877
+ *
2878
+ * let mut img = open_image("img.jpg").expect("File should open");
2879
+ * solarize(&mut img);
2880
+ * ```
2881
+ */
2882
+ export function solarize(photon_image: PhotonImage): void;
2883
+
2884
+ /**
2885
+ * Applies a solarizing effect to an image and returns the resulting PhotonImage.
2886
+ *
2887
+ * # Arguments
2888
+ * * `img` - A PhotonImage that contains a view into the image.
2889
+ * # Example
2890
+ *
2891
+ * ```no_run
2892
+ * // For example, to solarize "retimg" an image of type `PhotonImage`:
2893
+ * use photon_rs::effects::solarize_retimg;
2894
+ * use photon_rs::native::open_image;
2895
+ * use photon_rs::PhotonImage;
2896
+ *
2897
+ * let img = open_image("img.jpg").expect("File should open");
2898
+ * let result: PhotonImage = solarize_retimg(&img);
2899
+ * ```
2900
+ */
2901
+ export function solarize_retimg(photon_image: PhotonImage): PhotonImage;
2902
+
2903
+ /**
2904
+ * Swap two channels.
2905
+ *
2906
+ * # Arguments
2907
+ * * `img` - A PhotonImage.
2908
+ * * `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.
2909
+ * * `channel2` - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Same as above.
2910
+ *
2911
+ * # Example
2912
+ *
2913
+ * ```no_run
2914
+ * // For example, to swap the values of the Red channel with the values of the Blue channel:
2915
+ * use photon_rs::channels::swap_channels;
2916
+ * use photon_rs::native::open_image;
2917
+ *
2918
+ * let mut img = open_image("img.jpg").expect("File should open");
2919
+ * swap_channels(&mut img, 0_usize, 2_usize);
2920
+ * ```
2921
+ */
2922
+ export function swap_channels(img: PhotonImage, channel1: number, channel2: number): void;
2923
+
2924
+ /**
2925
+ * Threshold an image using a standard thresholding algorithm.
2926
+ *
2927
+ * # Arguments
2928
+ * * `photon_image` - A PhotonImage.
2929
+ * * `threshold` - The amount the image should be thresholded by from 0 to 255.
2930
+ * # Example
2931
+ *
2932
+ * ```no_run
2933
+ * // For example, to threshold an image of type `PhotonImage`:
2934
+ * use photon_rs::monochrome::threshold;
2935
+ * use photon_rs::native::open_image;
2936
+ *
2937
+ * let mut img = open_image("img.jpg").expect("File should open");
2938
+ * threshold(&mut img, 30_u32);
2939
+ * ```
2940
+ */
2941
+ export function threshold(img: PhotonImage, threshold: number): void;
2942
+
2943
+ /**
2944
+ * Tint an image by adding an offset to averaged RGB channel values.
2945
+ *
2946
+ * # Arguments
2947
+ * * `img` - A PhotonImage that contains a view into the image.
2948
+ * * `r_offset` - The amount the R channel should be incremented by.
2949
+ * * `g_offset` - The amount the G channel should be incremented by.
2950
+ * * `b_offset` - The amount the B channel should be incremented by.
2951
+ * # Example
2952
+ *
2953
+ * ```no_run
2954
+ * // For example, to tint an image of type `PhotonImage`:
2955
+ * use photon_rs::effects::tint;
2956
+ * use photon_rs::native::open_image;
2957
+ *
2958
+ * let mut img = open_image("img.jpg").expect("File should open");
2959
+ * tint(&mut img, 10_u32, 20_u32, 15_u32);
2960
+ * ```
2961
+ */
2962
+ export function tint(photon_image: PhotonImage, r_offset: number, g_offset: number, b_offset: number): void;
2963
+
2964
+ /**
2965
+ * Convert a PhotonImage to JS-compatible ImageData.
2966
+ */
2967
+ export function to_image_data(photon_image: PhotonImage): ImageData;
2968
+
2969
+ /**
2970
+ * Convert ImageData to a raw pixel vec of u8s.
2971
+ */
2972
+ export function to_raw_pixels(imgdata: ImageData): Uint8Array;
2973
+
2974
+ /**
2975
+ * Vertical strips. Divide an image into a series of equal-width strips, for an artistic effect.
2976
+ *
2977
+ * # Arguments
2978
+ * * `img` - A PhotonImage that contains a view into the image.
2979
+ * * `num_strips` - The numbder of strips
2980
+ * # Example
2981
+ *
2982
+ * ```no_run
2983
+ * // For example, to draw vertical strips on a `PhotonImage`:
2984
+ * use photon_rs::effects::vertical_strips;
2985
+ * use photon_rs::native::open_image;
2986
+ *
2987
+ * let mut img = open_image("img.jpg").expect("File should open");
2988
+ * vertical_strips(&mut img, 8u8);
2989
+ * ```
2990
+ */
2991
+ export function vertical_strips(photon_image: PhotonImage, num_strips: number): void;
2992
+
2993
+ /**
2994
+ * Add a watermark to an image.
2995
+ *
2996
+ * # Arguments
2997
+ * * `img` - A DynamicImage that contains a view into the image.
2998
+ * * `watermark` - The watermark to be placed onto the `img` image.
2999
+ * * `x` - The x coordinate where the watermark's top corner should be positioned.
3000
+ * * `y` - The y coordinate where the watermark's top corner should be positioned.
3001
+ * # Example
3002
+ *
3003
+ * ```no_run
3004
+ * // For example, to add a watermark to an image at x: 30, y: 40:
3005
+ * use photon_rs::multiple::watermark;
3006
+ * use photon_rs::native::open_image;
3007
+ *
3008
+ * let mut img = open_image("img.jpg").expect("File should open");
3009
+ * let water_mark = open_image("watermark.jpg").expect("File should open");
3010
+ * watermark(&mut img, &water_mark, 30_i64, 40_i64);
3011
+ * ```
3012
+ */
3013
+ export function watermark(img: PhotonImage, watermark: PhotonImage, x: bigint, y: bigint): void;