react-design-editor 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-design-editor.js +7739 -7114
- package/dist/react-design-editor.min.js +1 -1
- package/dist/react-design-editor.min.js.LICENSE.txt +2 -0
- package/lib/Canvas.d.ts +18 -18
- package/lib/Canvas.js +172 -172
- package/lib/CanvasObject.d.ts +10 -10
- package/lib/CanvasObject.js +96 -96
- package/lib/constants/code.d.ts +19 -19
- package/lib/constants/code.js +22 -22
- package/lib/constants/defaults.d.ts +38 -38
- package/lib/constants/defaults.js +69 -69
- package/lib/constants/index.d.ts +3 -3
- package/lib/constants/index.js +26 -26
- package/lib/handlers/AlignmentHandler.d.ts +18 -18
- package/lib/handlers/AlignmentHandler.js +58 -58
- package/lib/handlers/AnimationHandler.d.ts +50 -50
- package/lib/handlers/AnimationHandler.js +346 -346
- package/lib/handlers/ChartHandler.d.ts +8 -8
- package/lib/handlers/ChartHandler.js +8 -8
- package/lib/handlers/ContextmenuHandler.d.ts +28 -28
- package/lib/handlers/ContextmenuHandler.js +65 -65
- package/lib/handlers/CropHandler.d.ts +43 -43
- package/lib/handlers/CropHandler.js +261 -261
- package/lib/handlers/CustomHandler.d.ts +7 -7
- package/lib/handlers/CustomHandler.js +10 -10
- package/lib/handlers/DrawingHandler.d.ts +28 -28
- package/lib/handlers/DrawingHandler.js +318 -318
- package/lib/handlers/ElementHandler.d.ts +80 -80
- package/lib/handlers/ElementHandler.js +154 -154
- package/lib/handlers/EventHandler.d.ts +170 -170
- package/lib/handlers/EventHandler.js +880 -880
- package/lib/handlers/FiberHandler.d.ts +6 -6
- package/lib/handlers/FiberHandler.js +23 -23
- package/lib/handlers/GridHandler.d.ts +19 -19
- package/lib/handlers/GridHandler.js +77 -77
- package/lib/handlers/GuidelineHandler.d.ts +61 -61
- package/lib/handlers/GuidelineHandler.js +315 -315
- package/lib/handlers/Handler.d.ts +618 -618
- package/lib/handlers/Handler.js +1645 -1645
- package/lib/handlers/ImageHandler.d.ts +307 -307
- package/lib/handlers/ImageHandler.js +528 -528
- package/lib/handlers/InteractionHandler.d.ts +45 -45
- package/lib/handlers/InteractionHandler.js +168 -164
- package/lib/handlers/LinkHandler.d.ts +115 -115
- package/lib/handlers/LinkHandler.js +247 -247
- package/lib/handlers/NodeHandler.d.ts +50 -50
- package/lib/handlers/NodeHandler.js +274 -274
- package/lib/handlers/PortHandler.d.ts +22 -22
- package/lib/handlers/PortHandler.js +179 -179
- package/lib/handlers/ShortcutHandler.d.ts +119 -119
- package/lib/handlers/ShortcutHandler.js +151 -151
- package/lib/handlers/TooltipHandler.d.ts +33 -33
- package/lib/handlers/TooltipHandler.js +91 -91
- package/lib/handlers/TransactionHandler.d.ts +59 -59
- package/lib/handlers/TransactionHandler.js +137 -137
- package/lib/handlers/WorkareaHandler.d.ts +43 -43
- package/lib/handlers/WorkareaHandler.js +354 -354
- package/lib/handlers/ZoomHandler.d.ts +48 -48
- package/lib/handlers/ZoomHandler.js +143 -143
- package/lib/handlers/index.d.ts +23 -23
- package/lib/handlers/index.js +48 -48
- package/lib/index.d.ts +6 -6
- package/lib/index.js +20 -20
- package/lib/objects/Arrow.d.ts +2 -2
- package/lib/objects/Arrow.js +40 -40
- package/lib/objects/Chart.d.ts +10 -10
- package/lib/objects/Chart.js +117 -117
- package/lib/objects/CirclePort.d.ts +2 -2
- package/lib/objects/CirclePort.js +28 -28
- package/lib/objects/Cube.d.ts +5 -5
- package/lib/objects/Cube.js +71 -71
- package/lib/objects/CurvedLink.d.ts +2 -2
- package/lib/objects/CurvedLink.js +51 -51
- package/lib/objects/Element.d.ts +13 -13
- package/lib/objects/Element.js +77 -77
- package/lib/objects/Gif.d.ts +3 -3
- package/lib/objects/Gif.js +41 -41
- package/lib/objects/Iframe.d.ts +9 -9
- package/lib/objects/Iframe.js +63 -63
- package/lib/objects/Line.d.ts +2 -2
- package/lib/objects/Line.js +24 -24
- package/lib/objects/Link.d.ts +15 -15
- package/lib/objects/Link.js +107 -107
- package/lib/objects/Node.d.ts +59 -59
- package/lib/objects/Node.js +271 -271
- package/lib/objects/OrthogonalLink.d.ts +2 -2
- package/lib/objects/OrthogonalLink.js +54 -54
- package/lib/objects/Port.d.ts +12 -12
- package/lib/objects/Port.js +28 -28
- package/lib/objects/Svg.d.ts +12 -12
- package/lib/objects/Svg.js +93 -93
- package/lib/objects/Video.d.ts +14 -14
- package/lib/objects/Video.js +113 -113
- package/lib/objects/index.d.ts +15 -15
- package/lib/objects/index.js +32 -32
- package/lib/utils/ObjectUtil.d.ts +408 -408
- package/lib/utils/ObjectUtil.js +13 -13
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +13 -13
- package/package.json +1 -1
|
@@ -1,307 +1,307 @@
|
|
|
1
|
-
import { fabric } from 'fabric';
|
|
2
|
-
import Handler from './Handler';
|
|
3
|
-
export declare type GrayscaleModeType = 'average' | 'luminosity' | 'lightness';
|
|
4
|
-
export interface RemoveColorFilter {
|
|
5
|
-
color?: string;
|
|
6
|
-
distance?: number;
|
|
7
|
-
fragmentSource?: any;
|
|
8
|
-
useAlpahe?: any;
|
|
9
|
-
}
|
|
10
|
-
export interface BlendColorFilter {
|
|
11
|
-
color?: string;
|
|
12
|
-
mode?: string;
|
|
13
|
-
alpha?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface GammaFilter {
|
|
16
|
-
gamma?: number[];
|
|
17
|
-
}
|
|
18
|
-
export interface BlendImageFilter {
|
|
19
|
-
image?: fabric.Image;
|
|
20
|
-
mode?: string;
|
|
21
|
-
alpha?: number;
|
|
22
|
-
}
|
|
23
|
-
export interface HueRotationFilter {
|
|
24
|
-
rotation?: number;
|
|
25
|
-
}
|
|
26
|
-
export declare type ResizeType = 'bilinear' | 'hermite' | 'sliceHack' | 'lanczos';
|
|
27
|
-
export interface ResizeFilter {
|
|
28
|
-
resizeType?: ResizeType;
|
|
29
|
-
scaleX?: number;
|
|
30
|
-
scaleY?: number;
|
|
31
|
-
lanczosLobes?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface TintFilter {
|
|
34
|
-
color?: string;
|
|
35
|
-
opacity?: number;
|
|
36
|
-
}
|
|
37
|
-
export interface MaskFilter {
|
|
38
|
-
mask?: fabric.Image;
|
|
39
|
-
/**
|
|
40
|
-
* Rgb channel (0, 1, 2 or 3)
|
|
41
|
-
* @default 0
|
|
42
|
-
*/
|
|
43
|
-
channel: number;
|
|
44
|
-
}
|
|
45
|
-
export interface MultiplyFilter {
|
|
46
|
-
/**
|
|
47
|
-
* Color to multiply the image pixels with
|
|
48
|
-
* @default #000000
|
|
49
|
-
*/
|
|
50
|
-
color: string;
|
|
51
|
-
}
|
|
52
|
-
export interface GradientTransparencyFilter {
|
|
53
|
-
/** @default 100 */
|
|
54
|
-
threshold?: number;
|
|
55
|
-
}
|
|
56
|
-
export interface ColorMatrixFilter {
|
|
57
|
-
/** Filter matrix */
|
|
58
|
-
matrix?: number[];
|
|
59
|
-
}
|
|
60
|
-
export interface RemoveWhiteFilter {
|
|
61
|
-
/** @default 30 */
|
|
62
|
-
threshold?: number;
|
|
63
|
-
/** @default 20 */
|
|
64
|
-
distance?: number;
|
|
65
|
-
}
|
|
66
|
-
export declare type ValuesOf<T extends any[]> = T[number];
|
|
67
|
-
export interface IFilter {
|
|
68
|
-
type: typeof FILTER_TYPES[number];
|
|
69
|
-
[key: string]: any;
|
|
70
|
-
}
|
|
71
|
-
export declare const FILTER_TYPES: string[];
|
|
72
|
-
export declare const capitalize: (str: string) => string | false;
|
|
73
|
-
/**
|
|
74
|
-
* Image Handler
|
|
75
|
-
* @author salgum1114
|
|
76
|
-
* @date 2019-09-01
|
|
77
|
-
* @class ImageHandler
|
|
78
|
-
* @implements {IBaseHandler}
|
|
79
|
-
*/
|
|
80
|
-
declare class ImageHandler {
|
|
81
|
-
handler: Handler;
|
|
82
|
-
constructor(handler: Handler);
|
|
83
|
-
/**
|
|
84
|
-
* Create filter by type
|
|
85
|
-
* @param {IFilter} filter
|
|
86
|
-
*/
|
|
87
|
-
createFilter: (filter: IFilter) => false | fabric.IGrayscaleFilter;
|
|
88
|
-
/**
|
|
89
|
-
* Create filter by types
|
|
90
|
-
* @param {IFilter[]} filters
|
|
91
|
-
*/
|
|
92
|
-
createFilters: (filters: IFilter[]) => any[];
|
|
93
|
-
/**
|
|
94
|
-
* Apply filter by type
|
|
95
|
-
* @param {string} type
|
|
96
|
-
* @param {*} [value]
|
|
97
|
-
* @param {fabric.Image} [imageObj]
|
|
98
|
-
*/
|
|
99
|
-
applyFilterByType: (type: string, apply?: boolean, value?: any, imageObj?: fabric.Image) => void;
|
|
100
|
-
/**
|
|
101
|
-
* Apply filter in image
|
|
102
|
-
* @param {fabric.Image} [imageObj]
|
|
103
|
-
* @param {number} index
|
|
104
|
-
* @param {fabric.IBaseFilter} filter
|
|
105
|
-
*/
|
|
106
|
-
applyFilter: (index: number, filter: fabric.IBaseFilter | boolean, imageObj?: fabric.Image) => void;
|
|
107
|
-
/**
|
|
108
|
-
* Apply filter value in image
|
|
109
|
-
* @param {fabric.Image} [imageObj]
|
|
110
|
-
* @param {number} index
|
|
111
|
-
* @param {string} prop
|
|
112
|
-
* @param {any} value
|
|
113
|
-
*/
|
|
114
|
-
applyFilterValue: (index: number, prop: string, value: any, imageObj?: fabric.Image) => void;
|
|
115
|
-
/**
|
|
116
|
-
* Apply grayscale in image
|
|
117
|
-
* @param {fabric.Image} [imageObj]
|
|
118
|
-
* @param {boolean} [grayscale=false]
|
|
119
|
-
* @param {GrayscaleModeType} [value]
|
|
120
|
-
*/
|
|
121
|
-
applyGrayscale: (grayscale?: boolean, value?: GrayscaleModeType, imageObj?: fabric.Image) => void;
|
|
122
|
-
/**
|
|
123
|
-
* Apply invert in image
|
|
124
|
-
* @param {fabric.Image} [imageObj]
|
|
125
|
-
* @param {boolean} [invert=false]
|
|
126
|
-
*/
|
|
127
|
-
applyInvert: (invert?: boolean, imageObj?: fabric.Image) => void;
|
|
128
|
-
/**
|
|
129
|
-
* Apply remove color in image
|
|
130
|
-
* @param {fabric.Image} [imageObj]
|
|
131
|
-
* @param {boolean} [removeColor=false]
|
|
132
|
-
* @param {RemoveColorFilter} [value]
|
|
133
|
-
*/
|
|
134
|
-
/**
|
|
135
|
-
* Apply sepia in image
|
|
136
|
-
* @param {fabric.Image} [imageObj]
|
|
137
|
-
* @param {boolean} [sepia=false]
|
|
138
|
-
*/
|
|
139
|
-
applySepia: (sepia?: boolean, imageObj?: fabric.Image) => void;
|
|
140
|
-
/**
|
|
141
|
-
* Apply brownie in image
|
|
142
|
-
* @param {boolean} [brownie=false]
|
|
143
|
-
* @param {fabric.Image} [imageObj]
|
|
144
|
-
*/
|
|
145
|
-
/**
|
|
146
|
-
* Apply brightness in image
|
|
147
|
-
* @param {boolean} [brightness=false]
|
|
148
|
-
* @param {number} [value]
|
|
149
|
-
* @param {fabric.Image} [imageObj]
|
|
150
|
-
*/
|
|
151
|
-
applyBrightness: (brightness?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
152
|
-
/**
|
|
153
|
-
* Apply contrast in image
|
|
154
|
-
* @param {boolean} [contrast=false]
|
|
155
|
-
* @param {number} [value]
|
|
156
|
-
* @param {fabric.Image} [imageObj]
|
|
157
|
-
*/
|
|
158
|
-
applyContrast: (contrast?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
159
|
-
/**
|
|
160
|
-
* Apply saturation in image
|
|
161
|
-
* @param {boolean} [saturation=false]
|
|
162
|
-
* @param {number} [value]
|
|
163
|
-
* @param {fabric.Image} [imageObj]
|
|
164
|
-
*/
|
|
165
|
-
applySaturation: (saturation?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
166
|
-
/**
|
|
167
|
-
* Apply noise in image
|
|
168
|
-
* @param {boolean} [noise=false]
|
|
169
|
-
* @param {number} [value]
|
|
170
|
-
* @param {fabric.Image} [imageObj]
|
|
171
|
-
*/
|
|
172
|
-
applyNoise: (noise?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
173
|
-
/**
|
|
174
|
-
* Apply vintage in image
|
|
175
|
-
* @param {boolean} [vintage=false]
|
|
176
|
-
* @param {fabric.Image} [imageObj]
|
|
177
|
-
*/
|
|
178
|
-
/**
|
|
179
|
-
* Apply pixelate in image
|
|
180
|
-
* @param {boolean} [pixelate=false]
|
|
181
|
-
* @param {number} [value]
|
|
182
|
-
* @param {fabric.Image} [imageObj]
|
|
183
|
-
*/
|
|
184
|
-
applyPixelate: (pixelate?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
185
|
-
/**
|
|
186
|
-
* Apply blur in image
|
|
187
|
-
* @param {boolean} [blur=false]
|
|
188
|
-
* @param {number} [value]
|
|
189
|
-
* @param {fabric.Image} imageObj
|
|
190
|
-
*/
|
|
191
|
-
/**
|
|
192
|
-
* Apply sharpen in image
|
|
193
|
-
* @param {boolean} [sharpen=false]
|
|
194
|
-
* @param {number[]} [value=[0, -1, 0, -1, 5, -1, 0, -1, 0]]
|
|
195
|
-
* @param {fabric.Image} [imageObj]
|
|
196
|
-
*/
|
|
197
|
-
applySharpen: (sharpen?: boolean, value?: number[], imageObj?: fabric.Image) => void;
|
|
198
|
-
/**
|
|
199
|
-
* Apply emboss in image
|
|
200
|
-
* @param {boolean} [emboss=false]
|
|
201
|
-
* @param {number[]} [value=[1, 1, 1, 1, 0.7, -1, -1, -1, -1]]
|
|
202
|
-
* @param {fabric.Image} [imageObj]
|
|
203
|
-
*/
|
|
204
|
-
applyEmboss: (emboss?: boolean, value?: number[], imageObj?: fabric.Image) => void;
|
|
205
|
-
/**
|
|
206
|
-
* Apply technicolor in image
|
|
207
|
-
* @param {boolean} [technicolor=false]
|
|
208
|
-
* @param {fabric.Image} [imageObj]
|
|
209
|
-
*/
|
|
210
|
-
/**
|
|
211
|
-
* Apply polaroid in image
|
|
212
|
-
* @param {boolean} [polaroid=false]
|
|
213
|
-
* @param {fabric.Image} [imageObj]
|
|
214
|
-
*/
|
|
215
|
-
/**
|
|
216
|
-
* Apply blend color in image
|
|
217
|
-
* @param {boolean} [blend=false]
|
|
218
|
-
* @param {BlendColorFilter} [value]
|
|
219
|
-
* @param {fabric.Image} [imageObj]
|
|
220
|
-
*/
|
|
221
|
-
applyBlendColor: (blend?: boolean, value?: BlendColorFilter, imageObj?: fabric.Image) => void;
|
|
222
|
-
/**
|
|
223
|
-
* Apply gamma in image
|
|
224
|
-
* @param {boolean} [gamma=false]
|
|
225
|
-
* @param {GammaFilter} [value]
|
|
226
|
-
* @param {fabric.Image} [imageObj]
|
|
227
|
-
*/
|
|
228
|
-
/**
|
|
229
|
-
* Apply kodachrome in image
|
|
230
|
-
* @param {boolean} [kodachrome=false]
|
|
231
|
-
* @param {fabric.Image} [imageObj]
|
|
232
|
-
*/
|
|
233
|
-
/**
|
|
234
|
-
* Apply black white in image
|
|
235
|
-
* @param {boolean} [blackWhite=false]
|
|
236
|
-
* @param {fabric.Image} [imageObj]
|
|
237
|
-
*/
|
|
238
|
-
/**
|
|
239
|
-
* Apply blend image in image
|
|
240
|
-
* @param {boolean} [blendImage=false]
|
|
241
|
-
* @param {BlendImageFilter} value
|
|
242
|
-
* @param {fabric.Image} [imageObj]
|
|
243
|
-
*/
|
|
244
|
-
applyBlendImage: (blendImage?: boolean, value?: BlendImageFilter, imageObj?: fabric.Image) => void;
|
|
245
|
-
/**
|
|
246
|
-
* Apply hue rotation in image
|
|
247
|
-
* @param {boolean} [hue=false]
|
|
248
|
-
* @param {HueRotationFilter} [value]
|
|
249
|
-
* @param {fabric.Image} [imageObj]
|
|
250
|
-
*/
|
|
251
|
-
/**
|
|
252
|
-
* Apply resize in image
|
|
253
|
-
* @param {boolean} [resize=false]
|
|
254
|
-
* @param {ResizeFilter} [value]
|
|
255
|
-
* @param {fabric.Image} [imageObj]
|
|
256
|
-
*/
|
|
257
|
-
applyResize: (resize?: boolean, value?: ResizeFilter, imageObj?: fabric.Image) => void;
|
|
258
|
-
/**
|
|
259
|
-
* Apply tint in image
|
|
260
|
-
* @param {boolean} [tint=false]
|
|
261
|
-
* @param {TintFilter} [value]
|
|
262
|
-
* @param {fabric.Image} [imageObj]
|
|
263
|
-
*/
|
|
264
|
-
applyTint: (tint?: boolean, value?: TintFilter, imageObj?: fabric.Image) => void;
|
|
265
|
-
/**
|
|
266
|
-
* Apply mask in image
|
|
267
|
-
* @param {boolean} [mask=false]
|
|
268
|
-
* @param {MaskFilter} [value]
|
|
269
|
-
* @param {fabric.Image} [imageObj]
|
|
270
|
-
*/
|
|
271
|
-
applyMask: (mask?: boolean, value?: MaskFilter, imageObj?: fabric.Image) => void;
|
|
272
|
-
/**
|
|
273
|
-
* Apply multiply in image
|
|
274
|
-
* @param {boolean} [multiply=false]
|
|
275
|
-
* @param {MultiplyFilter} [value]
|
|
276
|
-
* @param {fabric.Image} [imageObj]
|
|
277
|
-
*/
|
|
278
|
-
applyMultiply: (multiply?: boolean, value?: MultiplyFilter, imageObj?: fabric.Image) => void;
|
|
279
|
-
/**
|
|
280
|
-
* Apply sepia2 in image
|
|
281
|
-
* @param {boolean} [sepia2=false]
|
|
282
|
-
* @param {fabric.Image} [imageObj]
|
|
283
|
-
*/
|
|
284
|
-
applySepia2: (sepia2?: boolean, imageObj?: fabric.Image) => void;
|
|
285
|
-
/**
|
|
286
|
-
* Apply gradient transparency in image
|
|
287
|
-
* @param {boolean} [gradientTransparency=false]
|
|
288
|
-
* @param {GradientTransparencyFilter} [value]
|
|
289
|
-
* @param {fabric.Image} [imageObj]
|
|
290
|
-
*/
|
|
291
|
-
applyGradientTransparency: (gradientTransparency?: boolean, value?: GradientTransparencyFilter, imageObj?: fabric.Image) => void;
|
|
292
|
-
/**
|
|
293
|
-
* Apply color matrix in image
|
|
294
|
-
* @param {boolean} [colorMatrix=false]
|
|
295
|
-
* @param {ColorMatrixFilter} [value]
|
|
296
|
-
* @param {fabric.Image} [imageObj]
|
|
297
|
-
*/
|
|
298
|
-
applyColorMatrix: (colorMatrix?: boolean, value?: ColorMatrixFilter, imageObj?: fabric.Image) => void;
|
|
299
|
-
/**
|
|
300
|
-
* Apply remove white in image
|
|
301
|
-
* @param {boolean} [removeWhite=false]
|
|
302
|
-
* @param {RemoveWhiteFilter} [value]
|
|
303
|
-
* @param {fabric.Image} [imageObj]
|
|
304
|
-
*/
|
|
305
|
-
applyRemoveWhite: (removeWhite?: boolean, value?: RemoveWhiteFilter, imageObj?: fabric.Image) => void;
|
|
306
|
-
}
|
|
307
|
-
export default ImageHandler;
|
|
1
|
+
import { fabric } from 'fabric';
|
|
2
|
+
import Handler from './Handler';
|
|
3
|
+
export declare type GrayscaleModeType = 'average' | 'luminosity' | 'lightness';
|
|
4
|
+
export interface RemoveColorFilter {
|
|
5
|
+
color?: string;
|
|
6
|
+
distance?: number;
|
|
7
|
+
fragmentSource?: any;
|
|
8
|
+
useAlpahe?: any;
|
|
9
|
+
}
|
|
10
|
+
export interface BlendColorFilter {
|
|
11
|
+
color?: string;
|
|
12
|
+
mode?: string;
|
|
13
|
+
alpha?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface GammaFilter {
|
|
16
|
+
gamma?: number[];
|
|
17
|
+
}
|
|
18
|
+
export interface BlendImageFilter {
|
|
19
|
+
image?: fabric.Image;
|
|
20
|
+
mode?: string;
|
|
21
|
+
alpha?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface HueRotationFilter {
|
|
24
|
+
rotation?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare type ResizeType = 'bilinear' | 'hermite' | 'sliceHack' | 'lanczos';
|
|
27
|
+
export interface ResizeFilter {
|
|
28
|
+
resizeType?: ResizeType;
|
|
29
|
+
scaleX?: number;
|
|
30
|
+
scaleY?: number;
|
|
31
|
+
lanczosLobes?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface TintFilter {
|
|
34
|
+
color?: string;
|
|
35
|
+
opacity?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface MaskFilter {
|
|
38
|
+
mask?: fabric.Image;
|
|
39
|
+
/**
|
|
40
|
+
* Rgb channel (0, 1, 2 or 3)
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
channel: number;
|
|
44
|
+
}
|
|
45
|
+
export interface MultiplyFilter {
|
|
46
|
+
/**
|
|
47
|
+
* Color to multiply the image pixels with
|
|
48
|
+
* @default #000000
|
|
49
|
+
*/
|
|
50
|
+
color: string;
|
|
51
|
+
}
|
|
52
|
+
export interface GradientTransparencyFilter {
|
|
53
|
+
/** @default 100 */
|
|
54
|
+
threshold?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ColorMatrixFilter {
|
|
57
|
+
/** Filter matrix */
|
|
58
|
+
matrix?: number[];
|
|
59
|
+
}
|
|
60
|
+
export interface RemoveWhiteFilter {
|
|
61
|
+
/** @default 30 */
|
|
62
|
+
threshold?: number;
|
|
63
|
+
/** @default 20 */
|
|
64
|
+
distance?: number;
|
|
65
|
+
}
|
|
66
|
+
export declare type ValuesOf<T extends any[]> = T[number];
|
|
67
|
+
export interface IFilter {
|
|
68
|
+
type: typeof FILTER_TYPES[number];
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
export declare const FILTER_TYPES: string[];
|
|
72
|
+
export declare const capitalize: (str: string) => string | false;
|
|
73
|
+
/**
|
|
74
|
+
* Image Handler
|
|
75
|
+
* @author salgum1114
|
|
76
|
+
* @date 2019-09-01
|
|
77
|
+
* @class ImageHandler
|
|
78
|
+
* @implements {IBaseHandler}
|
|
79
|
+
*/
|
|
80
|
+
declare class ImageHandler {
|
|
81
|
+
handler: Handler;
|
|
82
|
+
constructor(handler: Handler);
|
|
83
|
+
/**
|
|
84
|
+
* Create filter by type
|
|
85
|
+
* @param {IFilter} filter
|
|
86
|
+
*/
|
|
87
|
+
createFilter: (filter: IFilter) => false | fabric.IGrayscaleFilter;
|
|
88
|
+
/**
|
|
89
|
+
* Create filter by types
|
|
90
|
+
* @param {IFilter[]} filters
|
|
91
|
+
*/
|
|
92
|
+
createFilters: (filters: IFilter[]) => any[];
|
|
93
|
+
/**
|
|
94
|
+
* Apply filter by type
|
|
95
|
+
* @param {string} type
|
|
96
|
+
* @param {*} [value]
|
|
97
|
+
* @param {fabric.Image} [imageObj]
|
|
98
|
+
*/
|
|
99
|
+
applyFilterByType: (type: string, apply?: boolean, value?: any, imageObj?: fabric.Image) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Apply filter in image
|
|
102
|
+
* @param {fabric.Image} [imageObj]
|
|
103
|
+
* @param {number} index
|
|
104
|
+
* @param {fabric.IBaseFilter} filter
|
|
105
|
+
*/
|
|
106
|
+
applyFilter: (index: number, filter: fabric.IBaseFilter | boolean, imageObj?: fabric.Image) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Apply filter value in image
|
|
109
|
+
* @param {fabric.Image} [imageObj]
|
|
110
|
+
* @param {number} index
|
|
111
|
+
* @param {string} prop
|
|
112
|
+
* @param {any} value
|
|
113
|
+
*/
|
|
114
|
+
applyFilterValue: (index: number, prop: string, value: any, imageObj?: fabric.Image) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Apply grayscale in image
|
|
117
|
+
* @param {fabric.Image} [imageObj]
|
|
118
|
+
* @param {boolean} [grayscale=false]
|
|
119
|
+
* @param {GrayscaleModeType} [value]
|
|
120
|
+
*/
|
|
121
|
+
applyGrayscale: (grayscale?: boolean, value?: GrayscaleModeType, imageObj?: fabric.Image) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Apply invert in image
|
|
124
|
+
* @param {fabric.Image} [imageObj]
|
|
125
|
+
* @param {boolean} [invert=false]
|
|
126
|
+
*/
|
|
127
|
+
applyInvert: (invert?: boolean, imageObj?: fabric.Image) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Apply remove color in image
|
|
130
|
+
* @param {fabric.Image} [imageObj]
|
|
131
|
+
* @param {boolean} [removeColor=false]
|
|
132
|
+
* @param {RemoveColorFilter} [value]
|
|
133
|
+
*/
|
|
134
|
+
/**
|
|
135
|
+
* Apply sepia in image
|
|
136
|
+
* @param {fabric.Image} [imageObj]
|
|
137
|
+
* @param {boolean} [sepia=false]
|
|
138
|
+
*/
|
|
139
|
+
applySepia: (sepia?: boolean, imageObj?: fabric.Image) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Apply brownie in image
|
|
142
|
+
* @param {boolean} [brownie=false]
|
|
143
|
+
* @param {fabric.Image} [imageObj]
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* Apply brightness in image
|
|
147
|
+
* @param {boolean} [brightness=false]
|
|
148
|
+
* @param {number} [value]
|
|
149
|
+
* @param {fabric.Image} [imageObj]
|
|
150
|
+
*/
|
|
151
|
+
applyBrightness: (brightness?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Apply contrast in image
|
|
154
|
+
* @param {boolean} [contrast=false]
|
|
155
|
+
* @param {number} [value]
|
|
156
|
+
* @param {fabric.Image} [imageObj]
|
|
157
|
+
*/
|
|
158
|
+
applyContrast: (contrast?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
159
|
+
/**
|
|
160
|
+
* Apply saturation in image
|
|
161
|
+
* @param {boolean} [saturation=false]
|
|
162
|
+
* @param {number} [value]
|
|
163
|
+
* @param {fabric.Image} [imageObj]
|
|
164
|
+
*/
|
|
165
|
+
applySaturation: (saturation?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
166
|
+
/**
|
|
167
|
+
* Apply noise in image
|
|
168
|
+
* @param {boolean} [noise=false]
|
|
169
|
+
* @param {number} [value]
|
|
170
|
+
* @param {fabric.Image} [imageObj]
|
|
171
|
+
*/
|
|
172
|
+
applyNoise: (noise?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
173
|
+
/**
|
|
174
|
+
* Apply vintage in image
|
|
175
|
+
* @param {boolean} [vintage=false]
|
|
176
|
+
* @param {fabric.Image} [imageObj]
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* Apply pixelate in image
|
|
180
|
+
* @param {boolean} [pixelate=false]
|
|
181
|
+
* @param {number} [value]
|
|
182
|
+
* @param {fabric.Image} [imageObj]
|
|
183
|
+
*/
|
|
184
|
+
applyPixelate: (pixelate?: boolean, value?: number, imageObj?: fabric.Image) => void;
|
|
185
|
+
/**
|
|
186
|
+
* Apply blur in image
|
|
187
|
+
* @param {boolean} [blur=false]
|
|
188
|
+
* @param {number} [value]
|
|
189
|
+
* @param {fabric.Image} imageObj
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Apply sharpen in image
|
|
193
|
+
* @param {boolean} [sharpen=false]
|
|
194
|
+
* @param {number[]} [value=[0, -1, 0, -1, 5, -1, 0, -1, 0]]
|
|
195
|
+
* @param {fabric.Image} [imageObj]
|
|
196
|
+
*/
|
|
197
|
+
applySharpen: (sharpen?: boolean, value?: number[], imageObj?: fabric.Image) => void;
|
|
198
|
+
/**
|
|
199
|
+
* Apply emboss in image
|
|
200
|
+
* @param {boolean} [emboss=false]
|
|
201
|
+
* @param {number[]} [value=[1, 1, 1, 1, 0.7, -1, -1, -1, -1]]
|
|
202
|
+
* @param {fabric.Image} [imageObj]
|
|
203
|
+
*/
|
|
204
|
+
applyEmboss: (emboss?: boolean, value?: number[], imageObj?: fabric.Image) => void;
|
|
205
|
+
/**
|
|
206
|
+
* Apply technicolor in image
|
|
207
|
+
* @param {boolean} [technicolor=false]
|
|
208
|
+
* @param {fabric.Image} [imageObj]
|
|
209
|
+
*/
|
|
210
|
+
/**
|
|
211
|
+
* Apply polaroid in image
|
|
212
|
+
* @param {boolean} [polaroid=false]
|
|
213
|
+
* @param {fabric.Image} [imageObj]
|
|
214
|
+
*/
|
|
215
|
+
/**
|
|
216
|
+
* Apply blend color in image
|
|
217
|
+
* @param {boolean} [blend=false]
|
|
218
|
+
* @param {BlendColorFilter} [value]
|
|
219
|
+
* @param {fabric.Image} [imageObj]
|
|
220
|
+
*/
|
|
221
|
+
applyBlendColor: (blend?: boolean, value?: BlendColorFilter, imageObj?: fabric.Image) => void;
|
|
222
|
+
/**
|
|
223
|
+
* Apply gamma in image
|
|
224
|
+
* @param {boolean} [gamma=false]
|
|
225
|
+
* @param {GammaFilter} [value]
|
|
226
|
+
* @param {fabric.Image} [imageObj]
|
|
227
|
+
*/
|
|
228
|
+
/**
|
|
229
|
+
* Apply kodachrome in image
|
|
230
|
+
* @param {boolean} [kodachrome=false]
|
|
231
|
+
* @param {fabric.Image} [imageObj]
|
|
232
|
+
*/
|
|
233
|
+
/**
|
|
234
|
+
* Apply black white in image
|
|
235
|
+
* @param {boolean} [blackWhite=false]
|
|
236
|
+
* @param {fabric.Image} [imageObj]
|
|
237
|
+
*/
|
|
238
|
+
/**
|
|
239
|
+
* Apply blend image in image
|
|
240
|
+
* @param {boolean} [blendImage=false]
|
|
241
|
+
* @param {BlendImageFilter} value
|
|
242
|
+
* @param {fabric.Image} [imageObj]
|
|
243
|
+
*/
|
|
244
|
+
applyBlendImage: (blendImage?: boolean, value?: BlendImageFilter, imageObj?: fabric.Image) => void;
|
|
245
|
+
/**
|
|
246
|
+
* Apply hue rotation in image
|
|
247
|
+
* @param {boolean} [hue=false]
|
|
248
|
+
* @param {HueRotationFilter} [value]
|
|
249
|
+
* @param {fabric.Image} [imageObj]
|
|
250
|
+
*/
|
|
251
|
+
/**
|
|
252
|
+
* Apply resize in image
|
|
253
|
+
* @param {boolean} [resize=false]
|
|
254
|
+
* @param {ResizeFilter} [value]
|
|
255
|
+
* @param {fabric.Image} [imageObj]
|
|
256
|
+
*/
|
|
257
|
+
applyResize: (resize?: boolean, value?: ResizeFilter, imageObj?: fabric.Image) => void;
|
|
258
|
+
/**
|
|
259
|
+
* Apply tint in image
|
|
260
|
+
* @param {boolean} [tint=false]
|
|
261
|
+
* @param {TintFilter} [value]
|
|
262
|
+
* @param {fabric.Image} [imageObj]
|
|
263
|
+
*/
|
|
264
|
+
applyTint: (tint?: boolean, value?: TintFilter, imageObj?: fabric.Image) => void;
|
|
265
|
+
/**
|
|
266
|
+
* Apply mask in image
|
|
267
|
+
* @param {boolean} [mask=false]
|
|
268
|
+
* @param {MaskFilter} [value]
|
|
269
|
+
* @param {fabric.Image} [imageObj]
|
|
270
|
+
*/
|
|
271
|
+
applyMask: (mask?: boolean, value?: MaskFilter, imageObj?: fabric.Image) => void;
|
|
272
|
+
/**
|
|
273
|
+
* Apply multiply in image
|
|
274
|
+
* @param {boolean} [multiply=false]
|
|
275
|
+
* @param {MultiplyFilter} [value]
|
|
276
|
+
* @param {fabric.Image} [imageObj]
|
|
277
|
+
*/
|
|
278
|
+
applyMultiply: (multiply?: boolean, value?: MultiplyFilter, imageObj?: fabric.Image) => void;
|
|
279
|
+
/**
|
|
280
|
+
* Apply sepia2 in image
|
|
281
|
+
* @param {boolean} [sepia2=false]
|
|
282
|
+
* @param {fabric.Image} [imageObj]
|
|
283
|
+
*/
|
|
284
|
+
applySepia2: (sepia2?: boolean, imageObj?: fabric.Image) => void;
|
|
285
|
+
/**
|
|
286
|
+
* Apply gradient transparency in image
|
|
287
|
+
* @param {boolean} [gradientTransparency=false]
|
|
288
|
+
* @param {GradientTransparencyFilter} [value]
|
|
289
|
+
* @param {fabric.Image} [imageObj]
|
|
290
|
+
*/
|
|
291
|
+
applyGradientTransparency: (gradientTransparency?: boolean, value?: GradientTransparencyFilter, imageObj?: fabric.Image) => void;
|
|
292
|
+
/**
|
|
293
|
+
* Apply color matrix in image
|
|
294
|
+
* @param {boolean} [colorMatrix=false]
|
|
295
|
+
* @param {ColorMatrixFilter} [value]
|
|
296
|
+
* @param {fabric.Image} [imageObj]
|
|
297
|
+
*/
|
|
298
|
+
applyColorMatrix: (colorMatrix?: boolean, value?: ColorMatrixFilter, imageObj?: fabric.Image) => void;
|
|
299
|
+
/**
|
|
300
|
+
* Apply remove white in image
|
|
301
|
+
* @param {boolean} [removeWhite=false]
|
|
302
|
+
* @param {RemoveWhiteFilter} [value]
|
|
303
|
+
* @param {fabric.Image} [imageObj]
|
|
304
|
+
*/
|
|
305
|
+
applyRemoveWhite: (removeWhite?: boolean, value?: RemoveWhiteFilter, imageObj?: fabric.Image) => void;
|
|
306
|
+
}
|
|
307
|
+
export default ImageHandler;
|