File tree 2 files changed +51
-0
lines changed
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -589,6 +589,17 @@ export interface IMagickImage extends IDisposable {
589
589
*/
590
590
blackThreshold ( threshold : Percentage , channels : Channels ) : void ;
591
591
592
+ /**
593
+ * Simulate a scene at nighttime in the moonlight.
594
+ */
595
+ blueShift ( ) : void ;
596
+
597
+ /**
598
+ * Simulate a scene at nighttime in the moonlight.
599
+ * @param factor The factor to use.
600
+ */
601
+ blueShift ( factor : number ) : void ;
602
+
592
603
/**
593
604
* Blur image with the default blur factor (0x1).
594
605
*/
@@ -2574,6 +2585,16 @@ export class MagickImage extends NativeInstance implements IMagickImage {
2574
2585
} ) ;
2575
2586
}
2576
2587
2588
+ blueShift ( ) : void
2589
+ blueShift ( factor : number ) : void
2590
+ blueShift ( factorOrUndefined ?: number ) : void {
2591
+ const factor = this . valueOrDefault ( factorOrUndefined , 1.5 ) ;
2592
+ this . useException ( exception => {
2593
+ const instance = ImageMagick . _api . _MagickImage_BlueShift ( this . _instance , factor , exception . ptr ) ;
2594
+ this . _setInstance ( instance , exception ) ;
2595
+ } ) ;
2596
+ }
2597
+
2577
2598
blur ( ) : void ;
2578
2599
blur ( channels : Channels ) : void ;
2579
2600
blur ( radius : number , sigma : number ) : void ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright Dirk Lemstra https://github.com/dlemstra/magick-wasm.
3
+ Licensed under the Apache License, Version 2.0.
4
+ */
5
+
6
+ import { ErrorMetric } from '@src/enums/error-metric' ;
7
+ import { TestFiles } from '@test/test-files' ;
8
+
9
+ describe ( 'MagickImage#blueShift' , ( ) => {
10
+ it ( 'should change pixels of the image' , ( ) => {
11
+ TestFiles . Images . Builtin . logo . use ( image => {
12
+ image . blueShift ( 1.5 ) ;
13
+
14
+ expect ( image ) . toHavePixelWithColor ( 235 , 65 , '#ffbfbf' ) ;
15
+ expect ( image ) . toHavePixelWithColor ( 340 , 260 , '#838a9f' ) ;
16
+ } ) ;
17
+ } ) ;
18
+
19
+ it ( 'should use the correct default factor value' , ( ) => {
20
+ TestFiles . Images . Builtin . logo . use ( image => {
21
+ image . clone ( other => {
22
+ image . blueShift ( ) ;
23
+ other . blueShift ( 1.5 ) ;
24
+
25
+ const difference = other . compare ( image , ErrorMetric . RootMeanSquared ) ;
26
+ expect ( difference ) . toBe ( 0 ) ;
27
+ } )
28
+ } ) ;
29
+ } ) ;
30
+ } ) ;
You can’t perform that action at this time.
0 commit comments