@syncfusion/ej2-image-editor 20.3.56 → 20.4.38

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.
Files changed (62) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +2 -10
  3. package/README.md +65 -2
  4. package/dist/ej2-image-editor.umd.min.js +2 -2
  5. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es2015.js +6129 -4137
  7. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  8. package/dist/es6/ej2-image-editor.es5.js +2468 -468
  9. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  10. package/dist/global/ej2-image-editor.min.js +2 -2
  11. package/dist/global/ej2-image-editor.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/package.json +21 -23
  14. package/src/image-editor/image-editor-model.d.ts +102 -19
  15. package/src/image-editor/image-editor.d.ts +221 -31
  16. package/src/image-editor/image-editor.js +2468 -467
  17. package/styles/bootstrap-dark.css +36 -0
  18. package/styles/bootstrap.css +36 -0
  19. package/styles/bootstrap4.css +36 -0
  20. package/styles/bootstrap5-dark.css +36 -0
  21. package/styles/bootstrap5.css +36 -0
  22. package/styles/fabric-dark.css +36 -0
  23. package/styles/fabric.css +36 -0
  24. package/styles/fluent-dark.css +36 -0
  25. package/styles/fluent.css +36 -0
  26. package/styles/highcontrast-light.css +36 -0
  27. package/styles/highcontrast.css +36 -0
  28. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  29. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  30. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  31. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  32. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  33. package/styles/image-editor/_fabric-definition.scss +1 -0
  34. package/styles/image-editor/_fluent-definition.scss +1 -0
  35. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  36. package/styles/image-editor/_highcontrast-definition.scss +1 -0
  37. package/styles/image-editor/_highcontrast-light-definition.scss +1 -0
  38. package/styles/image-editor/_layout.scss +38 -0
  39. package/styles/image-editor/_material-dark-definition.scss +1 -0
  40. package/styles/image-editor/_material-definition.scss +1 -0
  41. package/styles/image-editor/_material3-definition.scss +1 -0
  42. package/styles/image-editor/_tailwind-definition.scss +1 -0
  43. package/styles/image-editor/_theme.scss +11 -0
  44. package/styles/image-editor/bootstrap-dark.css +36 -0
  45. package/styles/image-editor/bootstrap.css +36 -0
  46. package/styles/image-editor/bootstrap4.css +36 -0
  47. package/styles/image-editor/bootstrap5-dark.css +36 -0
  48. package/styles/image-editor/bootstrap5.css +36 -0
  49. package/styles/image-editor/fabric-dark.css +36 -0
  50. package/styles/image-editor/fabric.css +36 -0
  51. package/styles/image-editor/fluent-dark.css +36 -0
  52. package/styles/image-editor/fluent.css +36 -0
  53. package/styles/image-editor/highcontrast-light.css +36 -0
  54. package/styles/image-editor/highcontrast.css +36 -0
  55. package/styles/image-editor/material-dark.css +36 -0
  56. package/styles/image-editor/material.css +36 -0
  57. package/styles/image-editor/tailwind-dark.css +36 -0
  58. package/styles/image-editor/tailwind.css +36 -0
  59. package/styles/material-dark.css +36 -0
  60. package/styles/material.css +36 -0
  61. package/styles/tailwind-dark.css +36 -0
  62. package/styles/tailwind.css +36 -0
@@ -3,7 +3,68 @@ import { EmitType } from '@syncfusion/ej2-base';
3
3
  import { SignatureBase } from '@syncfusion/ej2-inputs';
4
4
  import { ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';
5
5
  import { OpenEventArgs } from '@syncfusion/ej2-popups';
6
- import { ImageEditorModel } from './image-editor-model';
6
+ import { ChildProperty } from '@syncfusion/ej2-base';
7
+ import { ImageEditorModel, FinetuneSettingsModel } from './image-editor-model';
8
+ /**
9
+ * Interface for image finetune values.
10
+ */
11
+ export interface ImageFinetuneValue {
12
+ /**
13
+ * Specifies the minimum value of finetune option.
14
+ * @default null
15
+ */
16
+ min: number;
17
+ /**
18
+ * Specifies the maximum value of finetune option.
19
+ * @default null
20
+ */
21
+ max: number;
22
+ /**
23
+ * Specifies the default value of finetune option.
24
+ * @default null
25
+ */
26
+ defaultValue: number;
27
+ }
28
+ /**
29
+ * Interface for image finetune values.
30
+ */
31
+ export declare class FinetuneSettings extends ChildProperty<FinetuneSettings> {
32
+ /**
33
+ * Specifies the brightness level of image.
34
+ * @default null
35
+ */
36
+ brightness: ImageFinetuneValue;
37
+ /**
38
+ * Specifies the contrast level image.
39
+ * @default null
40
+ */
41
+ contrast: ImageFinetuneValue;
42
+ /**
43
+ * Specifies the hue level image.
44
+ * @default null
45
+ */
46
+ hue: ImageFinetuneValue;
47
+ /**
48
+ * Specifies the saturation level image.
49
+ * @default null
50
+ */
51
+ saturation: ImageFinetuneValue;
52
+ /**
53
+ * Specifies the exposure level image.
54
+ * @default null
55
+ */
56
+ exposure: ImageFinetuneValue;
57
+ /**
58
+ * Specifies the opacity level image.
59
+ * @default null
60
+ */
61
+ opacity: ImageFinetuneValue;
62
+ /**
63
+ * Specifies the blur level image.
64
+ * @default null
65
+ */
66
+ blur: ImageFinetuneValue;
67
+ }
7
68
  /**
8
69
  * Image Editor is a graphical user interface that helps to edit an image by performing actions like selection,
9
70
  * cropping, rotating, inserting text and shapes (rectangles, ellipses, lines), and drawing free hand on top of an image.
@@ -32,7 +93,6 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
32
93
  private baseImg;
33
94
  private textBox;
34
95
  private degree;
35
- private isUndoRedo;
36
96
  private dragCanvas;
37
97
  private dragElement;
38
98
  private keyHistory;
@@ -55,24 +115,18 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
55
115
  private pannStart;
56
116
  private pannEnd;
57
117
  private togglePan;
118
+ private disablePan;
58
119
  private lastX;
59
120
  private lastY;
60
121
  private dragStart;
61
- private dragged;
62
122
  private factor;
63
123
  private currFlipState;
64
124
  private touchEndPoint;
65
- private flipMethod;
66
- private flipDirection;
67
125
  private prevX;
68
126
  private currX;
69
127
  private prevY;
70
128
  private currY;
71
129
  private togglePen;
72
- private rotateMethod;
73
- private isBoldbtn;
74
- private isItalicbtn;
75
- private lastAction;
76
130
  private currentToolbar;
77
131
  private textStartPoints;
78
132
  private fontSizeColl;
@@ -91,9 +145,27 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
91
145
  private isTimer;
92
146
  private timer;
93
147
  private isScreenOriented;
148
+ private tempObjColl;
149
+ private isFirstMove;
150
+ private startTouches;
151
+ private tempTouches;
152
+ private adjustmentLevel;
153
+ private tempAdjustmentLevel;
154
+ private adjustmentValue;
155
+ private initialAdjustmentValue;
156
+ private tempAdjustmentValue;
157
+ private currentFilter;
158
+ private tempFilter;
159
+ private canvasFilter;
160
+ private tempImageData;
161
+ private sharpenedImgData;
162
+ private tempSharpenFilter;
163
+ private tempBWFilter;
164
+ private isBrightnessAdjusted;
165
+ private isInitialLoading;
94
166
  /**
95
167
  * Defines class/multiple classes separated by a space for customizing Image Editor UI.
96
- * default ''
168
+ * @default ''
97
169
  ```html
98
170
  * <div id='imageeditor'></div>
99
171
  * ```
@@ -107,18 +179,18 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
107
179
  cssClass: string;
108
180
  /**
109
181
  * Specifies whether the Image Editor is disabled.
110
- * default false
182
+ * @default false
111
183
  */
112
184
  disabled: boolean;
113
185
  /**
114
186
  * Specifies the height of the Image Editor.
115
- * default '100%'
187
+ * @default '100%'
116
188
  */
117
189
  height: string;
118
190
  /**
119
191
  * Specifies the theme of the Image Editor. The shape selection appearance will be decided based on this property.
120
192
  * The property supports all the built-in themes of Syncfusion.
121
- * default 'Bootstrap5'
193
+ *
122
194
  * @isenumeration true
123
195
  * @default Theme.Bootstrap5
124
196
  * @asptype Theme
@@ -130,17 +202,16 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
130
202
  * If the property is defined as empty collection, the toolbar will not be rendered.
131
203
  * Suppose the property is not defined in control, an image editor’s toolbar will be rendered with preconfigured toolbar commands.
132
204
  * The preconfigured toolbar commands are
133
- * Crop: helps to crop an image as ellipse, square, various ratio aspects, custom selection with resize, drag and drop.
134
- * Annotate: help to insert a shape on image that supports rectangle, ellipse, line, text and freehand drawing with resize, drag and drop, and customize its appearance.
135
- * Transform: helps to rotate and flip an image.
136
- * ZoomIn: performs zoom-in an image.
137
- * ZoomOut: performs zoom-out an image.
138
- * Pan: performs panning once zoomed an image.
139
- * Move: disable the pan action and move to perform other actions such as insert a shape, transform, and more.
140
- * Save: save the modified image.
141
- * Open: open an image to perform editing.
142
- * Reset: reset the modification and restore the original image.
143
- * default null
205
+ * Crop: helps to crop an image as ellipse, square, various ratio aspects, custom selection with resize, drag and drop.
206
+ * Annotate: help to insert a shape on image that supports rectangle, ellipse, line, text and freehand drawing with resize, drag and drop, and customize its appearance.
207
+ * Transform: helps to rotate and flip an image.
208
+ * ZoomIn: performs zoom-in an image.
209
+ * ZoomOut: performs zoom-out an image.
210
+ * Pan: performs panning once zoomed an image.
211
+ * Move: disable the pan action and move to perform other actions such as insert a shape, transform, and more.
212
+ * Save: save the modified image.
213
+ * Open: open an image to perform editing.
214
+ * Reset: reset the modification and restore the original image.
144
215
  ```html
145
216
  * <div id='imageeditor'></div>
146
217
  * ```
@@ -180,7 +251,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
180
251
  toolbarTemplate: string;
181
252
  /**
182
253
  * Specifies the width of the Image Editor.
183
- * default 100%
254
+ * @default '100%'
184
255
  */
185
256
  width: string;
186
257
  /**
@@ -266,6 +337,18 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
266
337
  * @private
267
338
  */
268
339
  enablePersistence: boolean;
340
+ /**
341
+ * It can be done using the filter property of the canvas. The following fine tunes can be supported.
342
+ * Brightness: The intensity of the primary colors grows with increased brightness, but the color itself does not change. It can be done by changing brightness and opacity property.
343
+ * Contrast: The contrast of an image refers to the difference between the light pixels and dark pixels. Low contrast images contain either a narrow range of colors while high contrast images have bright highlights and dark shadows. It can be done by changing contrast property.
344
+ * Hue: Hue distinguishes one color from another and is described using common color names such as green, blue, red, yellow, etc. Value refers to the lightness or darkness of a color. It can be controlled by hue-rotate property.
345
+ * Saturation: If saturation increases, colors appear sharper or purer. As saturation decreases, colors appear more washed-out or faded. It can be controlled by saturation and brightness property.
346
+ * Exposure: If exposure increases, intensity of light appears brighter. As exposure decreases, intensity of light decreases. Exposure can be controlled by brightness property.
347
+ * Opacity: The state or quality of being opaque or transparent, not allowing light to pass through the image. Opacity can be controlled by opacity property.
348
+ * Blur : Adjusting the blur can make an image unfocused or unclear. Blur can be controlled by blur property.
349
+ *
350
+ */
351
+ finetuneSettings: FinetuneSettingsModel;
269
352
  /**
270
353
  * Gets or sets the last signature url to maintain the persist state.
271
354
  *
@@ -356,6 +439,18 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
356
439
  * @event toolbarItemClicked
357
440
  */
358
441
  toolbarItemClicked: EmitType<ClickEventArgs>;
442
+ /**
443
+ * Triggers when applying filter to an image.
444
+ *
445
+ * @event imageFiltering
446
+ */
447
+ imageFiltering: EmitType<ImageFilterEventArgs>;
448
+ /**
449
+ * Triggers when applying fine tune to an image.
450
+ *
451
+ * @event fineTuneValueChanging
452
+ */
453
+ fineTuneValueChanging: EmitType<FinetuneEventArgs>;
359
454
  /**
360
455
  *
361
456
  * Constructor for creating the widget
@@ -400,6 +495,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
400
495
  onPropertyChanged(newProperties: ImageEditorModel, oldProperties?: ImageEditorModel): void;
401
496
  destroy(): void;
402
497
  initialize(): void;
498
+ private updateFinetunes;
403
499
  /**
404
500
  *
405
501
  * This Method will add events to component (element, event, method, current reference)
@@ -414,11 +510,14 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
414
510
  * @returns {void}.
415
511
  */
416
512
  private unwireEvent;
513
+ private initializeFilter;
417
514
  private destroySubComponents;
418
515
  private updateTheme;
419
516
  private toPascalCase;
420
517
  private createCanvas;
421
518
  private createToolbar;
519
+ private createContextualToolbar;
520
+ private updateContextualToolbar;
422
521
  private createBottomToolbar;
423
522
  private initBottomToolbar;
424
523
  private toolbarTemplateFn;
@@ -447,34 +546,58 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
447
546
  private getFontSizeItems;
448
547
  private initTextToolbarItem;
449
548
  private createTextColor;
549
+ private pushActItemIntoObj;
450
550
  private createTextBtn;
451
551
  private getFontSizes;
452
552
  private getTextAreaWidth;
553
+ private updateObjColl;
453
554
  private applyFontStyle;
454
555
  private initZoomToolbarItem;
556
+ private contextualToolbarClicked;
455
557
  private defToolbarClicked;
558
+ private okBtn;
559
+ private unselectBtn;
560
+ private refreshSlider;
561
+ private updateAdjustment;
562
+ private updateBrightnessFilter;
563
+ private autoEnablePan;
564
+ private setTempFilterValue;
565
+ private getDefaultFilter;
566
+ private setAdjustment;
567
+ private renderSlider;
568
+ private getCurrAdjustmentValue;
569
+ private setCurrAdjustmentValue;
456
570
  private cancelPan;
457
571
  private callMainToolbar;
458
572
  private cancelItems;
459
573
  private gradient;
460
574
  private applyPenDraw;
575
+ private redrawImgWithObj;
461
576
  private refreshToolbar;
577
+ private getAdjustmentToolbarItem;
578
+ private getFilterToolbarItem;
462
579
  private getPenToolbarItem;
463
580
  private initPenToolbarItem;
464
581
  private createPenColor;
465
582
  private createPenBtn;
466
583
  private setPenStroke;
584
+ private getPenStroke;
585
+ private initAdjustmentToolbarItem;
586
+ private initFilterToolbarItem;
587
+ private createCanvasFilter;
467
588
  private updateCanvas;
468
589
  private imageOnLoad;
469
590
  private refreshActiveObj;
470
591
  private redrawText;
471
592
  private setTextSelection;
472
- private updateUndoRedoColl;
473
593
  private fileSelect;
474
594
  private findTextPoint;
475
595
  private getStrokeWidth;
476
596
  private updateToolbarItems;
477
597
  private setTimer;
598
+ private targetTouches;
599
+ private calculateScale;
600
+ private getDistance;
478
601
  private touchStartHandler;
479
602
  private mouseDownEventHandler;
480
603
  private mouseMoveEventHandler;
@@ -484,10 +607,12 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
484
607
  private canvasMouseDownHandler;
485
608
  private canvasMouseMoveHandler;
486
609
  private canvasMouseUpHandler;
610
+ private setPanPoints;
487
611
  private textKeyDown;
488
612
  private adjustToScreen;
489
613
  private screenOrientation;
490
614
  private windowResizeHandler;
615
+ private drawPanImg;
491
616
  private redrawImg;
492
617
  private updateContext;
493
618
  private scaleNonUniform;
@@ -496,6 +621,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
496
621
  private redraw;
497
622
  private applyCurrActObj;
498
623
  private updateTextFromTextArea;
624
+ private setTextBoxStylesToActObj;
499
625
  private redrawActObj;
500
626
  private setTextBoxPos;
501
627
  private setTextBoxPoints;
@@ -547,7 +673,6 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
547
673
  private addLetter;
548
674
  private updateFontStyles;
549
675
  private updateInMemoryCanvas;
550
- private drawBaseImg;
551
676
  private calcPrevRatio;
552
677
  private textFlipDegree;
553
678
  private rotateText;
@@ -564,7 +689,27 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
564
689
  private drawPen;
565
690
  private getObjDetails;
566
691
  private isPointsInRange;
692
+ private updateInMemoryContext;
693
+ private clearActObj;
567
694
  private rotateMultiple;
695
+ private setBrightness;
696
+ private setContrast;
697
+ private setHue;
698
+ private setSaturation;
699
+ private setOpacity;
700
+ private setBlur;
701
+ private setExposure;
702
+ private setFilter;
703
+ private setBlackAndWhiteFilter;
704
+ private setSharpness;
705
+ private replaceBWSharpenData;
706
+ private updateBWSharpness;
707
+ private getSharpenData;
708
+ private getFilterValue;
709
+ private setFilterValue;
710
+ private getSaturationFilterValue;
711
+ private setSaturationFilterValue;
712
+ private getBlackAndWhiteData;
568
713
  /**
569
714
  * Clear a current selection.
570
715
  *
@@ -578,7 +723,6 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
578
723
  * @returns {boolean}.
579
724
  */
580
725
  crop(): boolean;
581
- private updateInMemoryContext;
582
726
  /**
583
727
  * Flips an image by horizontally or vertically.
584
728
  *
@@ -662,7 +806,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
662
806
  *
663
807
  * @param {boolean} value - Specifies a value whether enable or disable freehand drawing.
664
808
  *
665
- * @returns {void}.
809
+ * @returns {void}.
666
810
  */
667
811
  freehandDraw(value: boolean): void;
668
812
  /**
@@ -833,6 +977,22 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
833
977
  * @returns {void}.
834
978
  */
835
979
  update(): void;
980
+ /**
981
+ * To apply the filters to an image
982
+ *
983
+ * @param {ImageFilterOptions } filterOption - Specifies the filter options to the image.
984
+ * @returns {void}.
985
+ */
986
+ applyImageFilter(filterOption: ImageFilterOptions): void;
987
+ /**
988
+ * To apply the filters to an image
989
+ *
990
+ * @param {ImageFinetuneOptions } finetuneOption - Specifies the finetune options to the image.
991
+ * @param {number } value - Specifies the value for finetuning the image.
992
+ * @returns {void}.
993
+ *
994
+ */
995
+ finetuneImage(finetuneOption: ImageFinetuneOptions, value: number): void;
836
996
  /**
837
997
  * To check whether the undo collection is empty or not.
838
998
  *
@@ -907,7 +1067,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
907
1067
  /**
908
1068
  * To save the signature with the given file type and file name.
909
1069
  *
910
- * @param {SignatureFileType} type - specify type of the file to be saved a signature.
1070
+ * @param {FileType} type - specify type of the file to be saved a signature.
911
1071
  * @param {string} fileName - specify name of the file to be saved a signature.
912
1072
  *
913
1073
  * @returns {void}.
@@ -924,7 +1084,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
924
1084
  /**
925
1085
  * Returns the persistence data for component.
926
1086
  *
927
- * @returns any.
1087
+ * @returns {any}.
928
1088
  * @private
929
1089
  */
930
1090
  getLocalData(): any;
@@ -949,6 +1109,14 @@ export declare type Theme = 'Bootstrap5' | 'Bootstrap5Dark' | 'Tailwind' | 'Tail
949
1109
  * Defines the toolbar items for Image Editor.
950
1110
  */
951
1111
  export declare type ImageEditorCommands = 'Crop' | 'Transform' | 'Annotate' | 'ZoomIn' | 'ZoomOut' | 'Open' | 'Reset' | 'Save' | 'Pan' | 'Move' | 'Pen' | 'Line' | 'Rectangle' | 'Ellipse' | 'Text' | 'CustomSelection' | 'CircleSelection' | 'SquareSelection' | 'RatioSelection' | 'RotateLeft' | 'RotateRight' | 'FlipHorizontal' | 'FlipVertical';
1112
+ /**
1113
+ * Defines the image filter options
1114
+ */
1115
+ export declare type ImageFilterOptions = 'Default' | 'Chrome' | 'Cold' | 'Warm' | 'Gray Scale' | 'Sepia' | 'Invert';
1116
+ /**
1117
+ * Defines the image filter options
1118
+ */
1119
+ export declare type ImageFinetuneOptions = 'Brightness' | 'Contrast' | 'Hue' | 'Saturation' | 'Exposure' | 'Opacity' | 'Blur';
952
1120
  /**
953
1121
  * Interface for zoom transition occur in the imageEditor.
954
1122
  */
@@ -1153,3 +1321,25 @@ export interface ShapeSettings {
1153
1321
  */
1154
1322
  color?: string;
1155
1323
  }
1324
+ /**
1325
+ * Interface for filter option for the image.
1326
+ */
1327
+ export interface ImageFilterEventArgs {
1328
+ /**
1329
+ * Specifies the when applying filter to an image.
1330
+ */
1331
+ filter: ImageFilterOptions;
1332
+ }
1333
+ /**
1334
+ * Interface for filter option for the image.
1335
+ */
1336
+ export interface FinetuneEventArgs {
1337
+ /**
1338
+ * Specifies the type of fine tunes.
1339
+ */
1340
+ finetune: ImageFinetuneOptions;
1341
+ /**
1342
+ * Specifies the value of the fine tunes.
1343
+ */
1344
+ value: number;
1345
+ }