@unity-china/codely-cli 1.0.0-rc.35 → 1.0.0-rc.36

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