konva 10.0.10 → 10.0.12
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/konva.js +20 -11
- package/konva.min.js +3 -3
- package/lib/Animation.d.ts +24 -0
- package/lib/Animation.js +142 -0
- package/lib/BezierFunctions.d.ts +6 -0
- package/lib/BezierFunctions.js +784 -0
- package/lib/Canvas.d.ts +33 -0
- package/lib/Canvas.js +107 -0
- package/lib/Container.d.ts +54 -0
- package/lib/Container.js +316 -0
- package/lib/Context.d.ts +95 -0
- package/lib/Context.js +561 -0
- package/lib/Core.d.ts +3 -0
- package/lib/Core.js +3 -0
- package/lib/DragAndDrop.d.ts +17 -0
- package/lib/DragAndDrop.js +110 -0
- package/lib/Factory.d.ts +22 -0
- package/lib/Factory.js +123 -0
- package/lib/FastLayer.d.ts +4 -0
- package/lib/FastLayer.js +12 -0
- package/lib/Global.d.ts +37 -0
- package/lib/Global.js +66 -0
- package/lib/Group.d.ts +9 -0
- package/lib/Group.js +13 -0
- package/lib/Layer.d.ts +62 -0
- package/lib/Layer.js +305 -0
- package/lib/Node.d.ts +323 -0
- package/lib/Node.js +1532 -0
- package/lib/PointerEvents.d.ts +11 -0
- package/lib/PointerEvents.js +37 -0
- package/lib/Shape.d.ts +196 -0
- package/lib/Shape.js +555 -0
- package/lib/Stage.d.ts +86 -0
- package/lib/Stage.js +715 -0
- package/lib/Tween.d.ts +90 -0
- package/lib/Tween.js +531 -0
- package/lib/Util.d.ts +137 -0
- package/lib/Util.js +918 -0
- package/lib/Validators.d.ts +11 -0
- package/lib/Validators.js +178 -0
- package/lib/_CoreInternals.d.ts +224 -0
- package/lib/_CoreInternals.js +34 -0
- package/lib/_FullInternals.d.ts +306 -0
- package/lib/_FullInternals.js +80 -0
- package/lib/canvas-backend.d.ts +2 -0
- package/lib/canvas-backend.js +27 -0
- package/lib/filters/Blur.d.ts +2 -0
- package/lib/filters/Blur.js +235 -0
- package/lib/filters/Brighten.d.ts +2 -0
- package/lib/filters/Brighten.js +12 -0
- package/lib/filters/Brightness.d.ts +2 -0
- package/lib/filters/Brightness.js +8 -0
- package/lib/filters/Contrast.d.ts +2 -0
- package/lib/filters/Contrast.js +35 -0
- package/lib/filters/Emboss.d.ts +2 -0
- package/lib/filters/Emboss.js +101 -0
- package/lib/filters/Enhance.d.ts +2 -0
- package/lib/filters/Enhance.js +84 -0
- package/lib/filters/Grayscale.d.ts +2 -0
- package/lib/filters/Grayscale.js +9 -0
- package/lib/filters/HSL.d.ts +2 -0
- package/lib/filters/HSL.js +24 -0
- package/lib/filters/HSV.d.ts +2 -0
- package/lib/filters/HSV.js +23 -0
- package/lib/filters/Invert.d.ts +2 -0
- package/lib/filters/Invert.js +8 -0
- package/lib/filters/Kaleidoscope.d.ts +2 -0
- package/lib/filters/Kaleidoscope.js +133 -0
- package/lib/filters/Mask.d.ts +2 -0
- package/lib/filters/Mask.js +151 -0
- package/lib/filters/Noise.d.ts +2 -0
- package/lib/filters/Noise.js +12 -0
- package/lib/filters/Pixelate.d.ts +2 -0
- package/lib/filters/Pixelate.js +60 -0
- package/lib/filters/Posterize.d.ts +2 -0
- package/lib/filters/Posterize.js +10 -0
- package/lib/filters/RGB.d.ts +2 -0
- package/lib/filters/RGB.js +38 -0
- package/lib/filters/RGBA.d.ts +2 -0
- package/lib/filters/RGBA.js +49 -0
- package/lib/filters/Sepia.d.ts +2 -0
- package/lib/filters/Sepia.js +11 -0
- package/lib/filters/Solarize.d.ts +2 -0
- package/lib/filters/Solarize.js +14 -0
- package/lib/filters/Threshold.d.ts +2 -0
- package/lib/filters/Threshold.js +10 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/shapes/Arc.d.ts +27 -0
- package/lib/shapes/Arc.js +60 -0
- package/lib/shapes/Arrow.d.ts +27 -0
- package/lib/shapes/Arrow.js +99 -0
- package/lib/shapes/Circle.d.ts +15 -0
- package/lib/shapes/Circle.js +33 -0
- package/lib/shapes/Ellipse.d.ts +18 -0
- package/lib/shapes/Ellipse.js +37 -0
- package/lib/shapes/Image.d.ts +29 -0
- package/lib/shapes/Image.js +131 -0
- package/lib/shapes/Label.d.ts +39 -0
- package/lib/shapes/Label.js +173 -0
- package/lib/shapes/Line.d.ts +29 -0
- package/lib/shapes/Line.js +156 -0
- package/lib/shapes/Path.d.ts +50 -0
- package/lib/shapes/Path.js +670 -0
- package/lib/shapes/Rect.d.ts +11 -0
- package/lib/shapes/Rect.js +22 -0
- package/lib/shapes/RegularPolygon.d.ts +26 -0
- package/lib/shapes/RegularPolygon.js +72 -0
- package/lib/shapes/Ring.d.ts +17 -0
- package/lib/shapes/Ring.js +33 -0
- package/lib/shapes/Sprite.d.ts +32 -0
- package/lib/shapes/Sprite.js +108 -0
- package/lib/shapes/Star.d.ts +19 -0
- package/lib/shapes/Star.js +38 -0
- package/lib/shapes/Text.d.ts +90 -0
- package/lib/shapes/Text.js +461 -0
- package/lib/shapes/TextPath.d.ts +72 -0
- package/lib/shapes/TextPath.js +268 -0
- package/lib/shapes/Transformer.d.ts +130 -0
- package/lib/shapes/Transformer.js +1009 -0
- package/lib/shapes/Wedge.d.ts +19 -0
- package/lib/shapes/Wedge.js +38 -0
- package/lib/skia-backend.d.ts +2 -0
- package/lib/skia-backend.js +24 -0
- package/lib/types.d.ts +56 -0
- package/lib/types.js +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { Konva as Core } from './_CoreInternals.ts';
|
|
2
|
+
import { Arc } from './shapes/Arc.ts';
|
|
3
|
+
import { Arrow } from './shapes/Arrow.ts';
|
|
4
|
+
import { Circle } from './shapes/Circle.ts';
|
|
5
|
+
import { Ellipse } from './shapes/Ellipse.ts';
|
|
6
|
+
import { Image } from './shapes/Image.ts';
|
|
7
|
+
import { Label, Tag } from './shapes/Label.ts';
|
|
8
|
+
import { Line } from './shapes/Line.ts';
|
|
9
|
+
import { Path } from './shapes/Path.ts';
|
|
10
|
+
import { Rect } from './shapes/Rect.ts';
|
|
11
|
+
import { RegularPolygon } from './shapes/RegularPolygon.ts';
|
|
12
|
+
import { Ring } from './shapes/Ring.ts';
|
|
13
|
+
import { Sprite } from './shapes/Sprite.ts';
|
|
14
|
+
import { Star } from './shapes/Star.ts';
|
|
15
|
+
import { Text } from './shapes/Text.ts';
|
|
16
|
+
import { TextPath } from './shapes/TextPath.ts';
|
|
17
|
+
import { Transformer } from './shapes/Transformer.ts';
|
|
18
|
+
import { Wedge } from './shapes/Wedge.ts';
|
|
19
|
+
export declare const Konva: {
|
|
20
|
+
_global: any;
|
|
21
|
+
version: string;
|
|
22
|
+
isBrowser: boolean;
|
|
23
|
+
isUnminified: boolean;
|
|
24
|
+
dblClickWindow: number;
|
|
25
|
+
getAngle(angle: number): number;
|
|
26
|
+
enableTrace: boolean;
|
|
27
|
+
pointerEventsEnabled: boolean;
|
|
28
|
+
autoDrawEnabled: boolean;
|
|
29
|
+
hitOnDragEnabled: boolean;
|
|
30
|
+
capturePointerEventsEnabled: boolean;
|
|
31
|
+
_mouseListenClick: boolean;
|
|
32
|
+
_touchListenClick: boolean;
|
|
33
|
+
_pointerListenClick: boolean;
|
|
34
|
+
_mouseInDblClickWindow: boolean;
|
|
35
|
+
_touchInDblClickWindow: boolean;
|
|
36
|
+
_pointerInDblClickWindow: boolean;
|
|
37
|
+
_mouseDblClickPointerId: null;
|
|
38
|
+
_touchDblClickPointerId: null;
|
|
39
|
+
_pointerDblClickPointerId: null;
|
|
40
|
+
_renderBackend: string;
|
|
41
|
+
legacyTextRendering: boolean;
|
|
42
|
+
pixelRatio: number;
|
|
43
|
+
dragDistance: number;
|
|
44
|
+
angleDeg: boolean;
|
|
45
|
+
showWarnings: boolean;
|
|
46
|
+
dragButtons: number[];
|
|
47
|
+
isDragging(): boolean;
|
|
48
|
+
isTransforming(): boolean;
|
|
49
|
+
isDragReady(): boolean;
|
|
50
|
+
releaseCanvasOnDestroy: boolean;
|
|
51
|
+
document: any;
|
|
52
|
+
_injectGlobal(Konva: any): void;
|
|
53
|
+
} & {
|
|
54
|
+
Util: {
|
|
55
|
+
_isElement(obj: any): obj is Element;
|
|
56
|
+
_isFunction(obj: any): boolean;
|
|
57
|
+
_isPlainObject(obj: any): boolean;
|
|
58
|
+
_isArray(obj: any): obj is Array<any>;
|
|
59
|
+
_isNumber(obj: any): obj is number;
|
|
60
|
+
_isString(obj: any): obj is string;
|
|
61
|
+
_isBoolean(obj: any): obj is boolean;
|
|
62
|
+
isObject(val: any): val is object;
|
|
63
|
+
isValidSelector(selector: any): boolean;
|
|
64
|
+
_sign(number: number): 1 | -1;
|
|
65
|
+
requestAnimFrame(callback: Function): void;
|
|
66
|
+
createCanvasElement(): HTMLCanvasElement;
|
|
67
|
+
createImageElement(): HTMLImageElement;
|
|
68
|
+
_isInDocument(el: any): boolean;
|
|
69
|
+
_urlToImage(url: string, callback: Function): void;
|
|
70
|
+
_rgbToHex(r: number, g: number, b: number): string;
|
|
71
|
+
_hexToRgb(hex: string): import("./types.ts").RGB;
|
|
72
|
+
getRandomColor(): string;
|
|
73
|
+
isCanvasFarblingActive(): boolean;
|
|
74
|
+
getHitColor(): string;
|
|
75
|
+
getHitColorKey(r: number, g: number, b: number): string;
|
|
76
|
+
getSnappedHexColor(hex: string): string;
|
|
77
|
+
getRGB(color: string): import("./types.ts").RGB;
|
|
78
|
+
colorToRGBA(str: string): {
|
|
79
|
+
r: number;
|
|
80
|
+
g: number;
|
|
81
|
+
b: number;
|
|
82
|
+
a: number;
|
|
83
|
+
} | undefined;
|
|
84
|
+
_namedColorToRBA(str: string): {
|
|
85
|
+
r: number;
|
|
86
|
+
g: number;
|
|
87
|
+
b: number;
|
|
88
|
+
a: number;
|
|
89
|
+
} | null;
|
|
90
|
+
_rgbColorToRGBA(str: string): {
|
|
91
|
+
r: number;
|
|
92
|
+
g: number;
|
|
93
|
+
b: number;
|
|
94
|
+
a: number;
|
|
95
|
+
} | undefined;
|
|
96
|
+
_rgbaColorToRGBA(str: string): {
|
|
97
|
+
r: number;
|
|
98
|
+
g: number;
|
|
99
|
+
b: number;
|
|
100
|
+
a: number;
|
|
101
|
+
} | undefined;
|
|
102
|
+
_hex8ColorToRGBA(str: string): {
|
|
103
|
+
r: number;
|
|
104
|
+
g: number;
|
|
105
|
+
b: number;
|
|
106
|
+
a: number;
|
|
107
|
+
} | undefined;
|
|
108
|
+
_hex6ColorToRGBA(str: string): {
|
|
109
|
+
r: number;
|
|
110
|
+
g: number;
|
|
111
|
+
b: number;
|
|
112
|
+
a: number;
|
|
113
|
+
} | undefined;
|
|
114
|
+
_hex4ColorToRGBA(str: string): {
|
|
115
|
+
r: number;
|
|
116
|
+
g: number;
|
|
117
|
+
b: number;
|
|
118
|
+
a: number;
|
|
119
|
+
} | undefined;
|
|
120
|
+
_hex3ColorToRGBA(str: string): {
|
|
121
|
+
r: number;
|
|
122
|
+
g: number;
|
|
123
|
+
b: number;
|
|
124
|
+
a: number;
|
|
125
|
+
} | undefined;
|
|
126
|
+
_hslColorToRGBA(str: string): {
|
|
127
|
+
r: number;
|
|
128
|
+
g: number;
|
|
129
|
+
b: number;
|
|
130
|
+
a: number;
|
|
131
|
+
} | undefined;
|
|
132
|
+
haveIntersection(r1: import("./types.ts").IRect, r2: import("./types.ts").IRect): boolean;
|
|
133
|
+
cloneObject<Any>(obj: Any): Any;
|
|
134
|
+
cloneArray(arr: Array<any>): any[];
|
|
135
|
+
degToRad(deg: number): number;
|
|
136
|
+
radToDeg(rad: number): number;
|
|
137
|
+
_degToRad(deg: number): number;
|
|
138
|
+
_radToDeg(rad: number): number;
|
|
139
|
+
_getRotation(radians: number): number;
|
|
140
|
+
_capitalize(str: string): string;
|
|
141
|
+
throw(str: string): never;
|
|
142
|
+
error(str: string): void;
|
|
143
|
+
warn(str: string): void;
|
|
144
|
+
each(obj: object, func: Function): void;
|
|
145
|
+
_inRange(val: number, left: number, right: number): boolean;
|
|
146
|
+
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
147
|
+
_getProjectionToLine(pt: import("./types.ts").Vector2d, line: Array<import("./types.ts").Vector2d>, isClosed: boolean): import("./types.ts").Vector2d;
|
|
148
|
+
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
|
|
149
|
+
_prepareToStringify<T>(obj: any): T | null;
|
|
150
|
+
_assign<T, U>(target: T, source: U): T & U;
|
|
151
|
+
_getFirstPointerId(evt: any): any;
|
|
152
|
+
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
153
|
+
drawRoundedRectPath(context: import("./Context.ts").Context, width: number, height: number, cornerRadius: number | number[]): void;
|
|
154
|
+
drawRoundedPolygonPath(context: import("./Context.ts").Context, points: import("./types.ts").Vector2d[], sides: number, radius: number, cornerRadius: number | number[]): void;
|
|
155
|
+
};
|
|
156
|
+
Transform: typeof import("./Util.ts").Transform;
|
|
157
|
+
Node: typeof import("./Node.ts").Node;
|
|
158
|
+
Container: typeof import("./Container.ts").Container;
|
|
159
|
+
Stage: typeof import("./Stage.ts").Stage;
|
|
160
|
+
stages: import("./Stage.ts").Stage[];
|
|
161
|
+
Layer: typeof import("./Layer.ts").Layer;
|
|
162
|
+
FastLayer: typeof import("./FastLayer.ts").FastLayer;
|
|
163
|
+
Group: typeof import("./Group.ts").Group;
|
|
164
|
+
DD: {
|
|
165
|
+
readonly isDragging: boolean;
|
|
166
|
+
justDragged: boolean;
|
|
167
|
+
readonly node: import("./Node.ts").Node<import("./Node.ts").NodeConfig> | undefined;
|
|
168
|
+
_dragElements: Map<number, {
|
|
169
|
+
node: import("./Node.ts").Node;
|
|
170
|
+
startPointerPos: import("./types.ts").Vector2d;
|
|
171
|
+
offset: import("./types.ts").Vector2d;
|
|
172
|
+
pointerId?: number;
|
|
173
|
+
dragStatus: "ready" | "dragging" | "stopped";
|
|
174
|
+
}>;
|
|
175
|
+
_drag(evt: any): void;
|
|
176
|
+
_endDragBefore(evt?: any): void;
|
|
177
|
+
_endDragAfter(evt: any): void;
|
|
178
|
+
};
|
|
179
|
+
Shape: typeof import("./Shape.ts").Shape;
|
|
180
|
+
shapes: {
|
|
181
|
+
[key: string]: import("./Shape.ts").Shape<import("./Shape.ts").ShapeConfig>;
|
|
182
|
+
};
|
|
183
|
+
Animation: typeof import("./Animation.ts").Animation;
|
|
184
|
+
Tween: typeof import("./Tween.ts").Tween;
|
|
185
|
+
Easings: {
|
|
186
|
+
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
187
|
+
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
188
|
+
BackEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
189
|
+
ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
190
|
+
ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
191
|
+
ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
192
|
+
BounceEaseOut(t: any, b: any, c: any, d: any): any;
|
|
193
|
+
BounceEaseIn(t: any, b: any, c: any, d: any): any;
|
|
194
|
+
BounceEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
195
|
+
EaseIn(t: any, b: any, c: any, d: any): any;
|
|
196
|
+
EaseOut(t: any, b: any, c: any, d: any): any;
|
|
197
|
+
EaseInOut(t: any, b: any, c: any, d: any): any;
|
|
198
|
+
StrongEaseIn(t: any, b: any, c: any, d: any): any;
|
|
199
|
+
StrongEaseOut(t: any, b: any, c: any, d: any): any;
|
|
200
|
+
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
201
|
+
Linear(t: any, b: any, c: any, d: any): any;
|
|
202
|
+
};
|
|
203
|
+
Context: typeof import("./Context.ts").Context;
|
|
204
|
+
Canvas: typeof import("./Canvas.ts").Canvas;
|
|
205
|
+
} & {
|
|
206
|
+
Arc: typeof Arc;
|
|
207
|
+
Arrow: typeof Arrow;
|
|
208
|
+
Circle: typeof Circle;
|
|
209
|
+
Ellipse: typeof Ellipse;
|
|
210
|
+
Image: typeof Image;
|
|
211
|
+
Label: typeof Label;
|
|
212
|
+
Tag: typeof Tag;
|
|
213
|
+
Line: typeof Line;
|
|
214
|
+
Path: typeof Path;
|
|
215
|
+
Rect: typeof Rect;
|
|
216
|
+
RegularPolygon: typeof RegularPolygon;
|
|
217
|
+
Ring: typeof Ring;
|
|
218
|
+
Sprite: typeof Sprite;
|
|
219
|
+
Star: typeof Star;
|
|
220
|
+
Text: typeof Text;
|
|
221
|
+
TextPath: typeof TextPath;
|
|
222
|
+
Transformer: typeof Transformer;
|
|
223
|
+
Wedge: typeof Wedge;
|
|
224
|
+
Filters: {
|
|
225
|
+
Blur: import("./Node.ts").Filter;
|
|
226
|
+
Brightness: import("./Node.ts").Filter;
|
|
227
|
+
Brighten: import("./Node.ts").Filter;
|
|
228
|
+
Contrast: import("./Node.ts").Filter;
|
|
229
|
+
Emboss: import("./Node.ts").Filter;
|
|
230
|
+
Enhance: import("./Node.ts").Filter;
|
|
231
|
+
Grayscale: import("./Node.ts").Filter;
|
|
232
|
+
HSL: import("./Node.ts").Filter;
|
|
233
|
+
HSV: import("./Node.ts").Filter;
|
|
234
|
+
Invert: import("./Node.ts").Filter;
|
|
235
|
+
Kaleidoscope: import("./Node.ts").Filter;
|
|
236
|
+
Mask: import("./Node.ts").Filter;
|
|
237
|
+
Noise: import("./Node.ts").Filter;
|
|
238
|
+
Pixelate: import("./Node.ts").Filter;
|
|
239
|
+
Posterize: import("./Node.ts").Filter;
|
|
240
|
+
RGB: import("./Node.ts").Filter;
|
|
241
|
+
RGBA: import("./Node.ts").Filter;
|
|
242
|
+
Sepia: import("./Node.ts").Filter;
|
|
243
|
+
Solarize: import("./Node.ts").Filter;
|
|
244
|
+
Threshold: import("./Node.ts").Filter;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
export declare namespace Konva {
|
|
248
|
+
type Vector2d = Core.Vector2d;
|
|
249
|
+
type Node = Core.Node;
|
|
250
|
+
type NodeConfig = Core.NodeConfig;
|
|
251
|
+
type KonvaEventObject<EventType> = Core.KonvaEventObject<EventType>;
|
|
252
|
+
type KonvaPointerEvent = Core.KonvaPointerEvent;
|
|
253
|
+
type KonvaEventListener<This, EventType> = Core.KonvaEventListener<This, EventType>;
|
|
254
|
+
type Container = Core.Container;
|
|
255
|
+
type ContainerConfig = Core.ContainerConfig;
|
|
256
|
+
type Transform = Core.Transform;
|
|
257
|
+
type Context = Core.Context;
|
|
258
|
+
type Stage = Core.Stage;
|
|
259
|
+
type StageConfig = Core.StageConfig;
|
|
260
|
+
type Layer = Core.Layer;
|
|
261
|
+
type LayerConfig = Core.LayerConfig;
|
|
262
|
+
type FastLayer = Core.FastLayer;
|
|
263
|
+
type Group = Core.Group;
|
|
264
|
+
type GroupConfig = Core.GroupConfig;
|
|
265
|
+
type Shape = Core.Shape;
|
|
266
|
+
type ShapeConfig = Core.ShapeConfig;
|
|
267
|
+
type Animation = Core.Animation;
|
|
268
|
+
type Tween = Core.Tween;
|
|
269
|
+
type TweenConfig = Core.TweenConfig;
|
|
270
|
+
type Arc = import('./shapes/Arc.ts').Arc;
|
|
271
|
+
type ArcConfig = import('./shapes/Arc.ts').ArcConfig;
|
|
272
|
+
type Arrow = import('./shapes/Arrow.ts').Arrow;
|
|
273
|
+
type ArrowConfig = import('./shapes/Arrow.ts').ArrowConfig;
|
|
274
|
+
type Circle = import('./shapes/Circle.ts').Circle;
|
|
275
|
+
type CircleConfig = import('./shapes/Circle.ts').CircleConfig;
|
|
276
|
+
type Ellipse = import('./shapes/Ellipse.ts').Ellipse;
|
|
277
|
+
type EllipseConfig = import('./shapes/Ellipse.ts').EllipseConfig;
|
|
278
|
+
type Image = import('./shapes/Image.ts').Image;
|
|
279
|
+
type ImageConfig = import('./shapes/Image.ts').ImageConfig;
|
|
280
|
+
type Label = import('./shapes/Label.ts').Label;
|
|
281
|
+
type LabelConfig = import('./shapes/Label.ts').LabelConfig;
|
|
282
|
+
type Tag = import('./shapes/Label.ts').Tag;
|
|
283
|
+
type TagConfig = import('./shapes/Label.ts').TagConfig;
|
|
284
|
+
type Line = import('./shapes/Line.ts').Line;
|
|
285
|
+
type LineConfig = import('./shapes/Line.ts').LineConfig;
|
|
286
|
+
type Path = import('./shapes/Path.ts').Path;
|
|
287
|
+
type PathConfig = import('./shapes/Path.ts').PathConfig;
|
|
288
|
+
type Rect = import('./shapes/Rect.ts').Rect;
|
|
289
|
+
type RectConfig = import('./shapes/Rect.ts').RectConfig;
|
|
290
|
+
type RegularPolygon = import('./shapes/RegularPolygon.ts').RegularPolygon;
|
|
291
|
+
type RegularPolygonConfig = import('./shapes/RegularPolygon.ts').RegularPolygonConfig;
|
|
292
|
+
type Ring = import('./shapes/Ring.ts').Ring;
|
|
293
|
+
type RingConfig = import('./shapes/Ring.ts').RingConfig;
|
|
294
|
+
type Sprite = import('./shapes/Sprite.ts').Sprite;
|
|
295
|
+
type SpriteConfig = import('./shapes/Sprite.ts').SpriteConfig;
|
|
296
|
+
type Star = import('./shapes/Star.ts').Star;
|
|
297
|
+
type StarConfig = import('./shapes/Star.ts').StarConfig;
|
|
298
|
+
type Text = import('./shapes/Text.ts').Text;
|
|
299
|
+
type TextConfig = import('./shapes/Text.ts').TextConfig;
|
|
300
|
+
type TextPath = import('./shapes/TextPath.ts').TextPath;
|
|
301
|
+
type TextPathConfig = import('./shapes/TextPath.ts').TextPathConfig;
|
|
302
|
+
type Transformer = import('./shapes/Transformer.ts').Transformer;
|
|
303
|
+
type TransformerConfig = import('./shapes/Transformer.ts').TransformerConfig;
|
|
304
|
+
type Wedge = import('./shapes/Wedge.ts').Wedge;
|
|
305
|
+
type WedgeConfig = import('./shapes/Wedge.ts').WedgeConfig;
|
|
306
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Konva as Core } from "./_CoreInternals.js";
|
|
2
|
+
import { Arc } from "./shapes/Arc.js";
|
|
3
|
+
import { Arrow } from "./shapes/Arrow.js";
|
|
4
|
+
import { Circle } from "./shapes/Circle.js";
|
|
5
|
+
import { Ellipse } from "./shapes/Ellipse.js";
|
|
6
|
+
import { Image } from "./shapes/Image.js";
|
|
7
|
+
import { Label, Tag } from "./shapes/Label.js";
|
|
8
|
+
import { Line } from "./shapes/Line.js";
|
|
9
|
+
import { Path } from "./shapes/Path.js";
|
|
10
|
+
import { Rect } from "./shapes/Rect.js";
|
|
11
|
+
import { RegularPolygon } from "./shapes/RegularPolygon.js";
|
|
12
|
+
import { Ring } from "./shapes/Ring.js";
|
|
13
|
+
import { Sprite } from "./shapes/Sprite.js";
|
|
14
|
+
import { Star } from "./shapes/Star.js";
|
|
15
|
+
import { Text } from "./shapes/Text.js";
|
|
16
|
+
import { TextPath } from "./shapes/TextPath.js";
|
|
17
|
+
import { Transformer } from "./shapes/Transformer.js";
|
|
18
|
+
import { Wedge } from "./shapes/Wedge.js";
|
|
19
|
+
import { Blur } from "./filters/Blur.js";
|
|
20
|
+
import { Brighten } from "./filters/Brighten.js";
|
|
21
|
+
import { Brightness } from "./filters/Brightness.js";
|
|
22
|
+
import { Contrast } from "./filters/Contrast.js";
|
|
23
|
+
import { Emboss } from "./filters/Emboss.js";
|
|
24
|
+
import { Enhance } from "./filters/Enhance.js";
|
|
25
|
+
import { Grayscale } from "./filters/Grayscale.js";
|
|
26
|
+
import { HSL } from "./filters/HSL.js";
|
|
27
|
+
import { HSV } from "./filters/HSV.js";
|
|
28
|
+
import { Invert } from "./filters/Invert.js";
|
|
29
|
+
import { Kaleidoscope } from "./filters/Kaleidoscope.js";
|
|
30
|
+
import { Mask } from "./filters/Mask.js";
|
|
31
|
+
import { Noise } from "./filters/Noise.js";
|
|
32
|
+
import { Pixelate } from "./filters/Pixelate.js";
|
|
33
|
+
import { Posterize } from "./filters/Posterize.js";
|
|
34
|
+
import { RGB } from "./filters/RGB.js";
|
|
35
|
+
import { RGBA } from "./filters/RGBA.js";
|
|
36
|
+
import { Sepia } from "./filters/Sepia.js";
|
|
37
|
+
import { Solarize } from "./filters/Solarize.js";
|
|
38
|
+
import { Threshold } from "./filters/Threshold.js";
|
|
39
|
+
export const Konva = Core.Util._assign(Core, {
|
|
40
|
+
Arc,
|
|
41
|
+
Arrow,
|
|
42
|
+
Circle,
|
|
43
|
+
Ellipse,
|
|
44
|
+
Image,
|
|
45
|
+
Label,
|
|
46
|
+
Tag,
|
|
47
|
+
Line,
|
|
48
|
+
Path,
|
|
49
|
+
Rect,
|
|
50
|
+
RegularPolygon,
|
|
51
|
+
Ring,
|
|
52
|
+
Sprite,
|
|
53
|
+
Star,
|
|
54
|
+
Text,
|
|
55
|
+
TextPath,
|
|
56
|
+
Transformer,
|
|
57
|
+
Wedge,
|
|
58
|
+
Filters: {
|
|
59
|
+
Blur,
|
|
60
|
+
Brightness,
|
|
61
|
+
Brighten,
|
|
62
|
+
Contrast,
|
|
63
|
+
Emboss,
|
|
64
|
+
Enhance,
|
|
65
|
+
Grayscale,
|
|
66
|
+
HSL,
|
|
67
|
+
HSV,
|
|
68
|
+
Invert,
|
|
69
|
+
Kaleidoscope,
|
|
70
|
+
Mask,
|
|
71
|
+
Noise,
|
|
72
|
+
Pixelate,
|
|
73
|
+
Posterize,
|
|
74
|
+
RGB,
|
|
75
|
+
RGBA,
|
|
76
|
+
Sepia,
|
|
77
|
+
Solarize,
|
|
78
|
+
Threshold,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
var _b;
|
|
3
|
+
import { Konva } from "./_CoreInternals.js";
|
|
4
|
+
import * as Canvas from 'canvas';
|
|
5
|
+
const canvas = Canvas['default'] || Canvas;
|
|
6
|
+
global.DOMMatrix = canvas.DOMMatrix;
|
|
7
|
+
(_a = (_b = global).Path2D) !== null && _a !== void 0 ? _a : (_b.Path2D = class Path2D {
|
|
8
|
+
constructor(path) {
|
|
9
|
+
this.path = path;
|
|
10
|
+
}
|
|
11
|
+
get [Symbol.toStringTag]() {
|
|
12
|
+
return `Path2D`;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Konva.Util['createCanvasElement'] = () => {
|
|
16
|
+
const node = canvas.createCanvas(300, 300);
|
|
17
|
+
if (!node['style']) {
|
|
18
|
+
node['style'] = {};
|
|
19
|
+
}
|
|
20
|
+
return node;
|
|
21
|
+
};
|
|
22
|
+
Konva.Util.createImageElement = () => {
|
|
23
|
+
const node = new canvas.Image();
|
|
24
|
+
return node;
|
|
25
|
+
};
|
|
26
|
+
Konva._renderBackend = 'node-canvas';
|
|
27
|
+
export default Konva;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Factory } from "../Factory.js";
|
|
2
|
+
import { Node } from "../Node.js";
|
|
3
|
+
import { getNumberValidator } from "../Validators.js";
|
|
4
|
+
function BlurStack() {
|
|
5
|
+
this.r = 0;
|
|
6
|
+
this.g = 0;
|
|
7
|
+
this.b = 0;
|
|
8
|
+
this.a = 0;
|
|
9
|
+
this.next = null;
|
|
10
|
+
}
|
|
11
|
+
const mul_table = [
|
|
12
|
+
512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292,
|
|
13
|
+
512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292,
|
|
14
|
+
273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259,
|
|
15
|
+
496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292,
|
|
16
|
+
282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373,
|
|
17
|
+
364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259,
|
|
18
|
+
507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381,
|
|
19
|
+
374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292,
|
|
20
|
+
287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461,
|
|
21
|
+
454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373,
|
|
22
|
+
368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309,
|
|
23
|
+
305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259,
|
|
24
|
+
257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442,
|
|
25
|
+
437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381,
|
|
26
|
+
377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332,
|
|
27
|
+
329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292,
|
|
28
|
+
289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259,
|
|
29
|
+
];
|
|
30
|
+
const shg_table = [
|
|
31
|
+
9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17,
|
|
32
|
+
17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
|
|
33
|
+
19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
|
34
|
+
20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
|
|
35
|
+
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
|
|
36
|
+
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
|
|
37
|
+
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23,
|
|
38
|
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
|
39
|
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
|
40
|
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
41
|
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
42
|
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
43
|
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
44
|
+
24, 24, 24, 24, 24, 24, 24,
|
|
45
|
+
];
|
|
46
|
+
function filterGaussBlurRGBA(imageData, radius) {
|
|
47
|
+
const pixels = imageData.data, width = imageData.width, height = imageData.height;
|
|
48
|
+
let p, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
|
|
49
|
+
const div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), mul_sum = mul_table[radius], shg_sum = shg_table[radius];
|
|
50
|
+
let stackEnd = null, stack = stackStart, stackIn = null, stackOut = null;
|
|
51
|
+
for (let i = 1; i < div; i++) {
|
|
52
|
+
stack = stack.next = new BlurStack();
|
|
53
|
+
if (i === radiusPlus1) {
|
|
54
|
+
stackEnd = stack;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
stack.next = stackStart;
|
|
58
|
+
yw = yi = 0;
|
|
59
|
+
for (let y = 0; y < height; y++) {
|
|
60
|
+
r_in_sum =
|
|
61
|
+
g_in_sum =
|
|
62
|
+
b_in_sum =
|
|
63
|
+
a_in_sum =
|
|
64
|
+
r_sum =
|
|
65
|
+
g_sum =
|
|
66
|
+
b_sum =
|
|
67
|
+
a_sum =
|
|
68
|
+
0;
|
|
69
|
+
r_out_sum = radiusPlus1 * (pr = pixels[yi]);
|
|
70
|
+
g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);
|
|
71
|
+
b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);
|
|
72
|
+
a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]);
|
|
73
|
+
r_sum += sumFactor * pr;
|
|
74
|
+
g_sum += sumFactor * pg;
|
|
75
|
+
b_sum += sumFactor * pb;
|
|
76
|
+
a_sum += sumFactor * pa;
|
|
77
|
+
stack = stackStart;
|
|
78
|
+
for (let i = 0; i < radiusPlus1; i++) {
|
|
79
|
+
stack.r = pr;
|
|
80
|
+
stack.g = pg;
|
|
81
|
+
stack.b = pb;
|
|
82
|
+
stack.a = pa;
|
|
83
|
+
stack = stack.next;
|
|
84
|
+
}
|
|
85
|
+
for (let i = 1; i < radiusPlus1; i++) {
|
|
86
|
+
p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2);
|
|
87
|
+
r_sum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i);
|
|
88
|
+
g_sum += (stack.g = pg = pixels[p + 1]) * rbs;
|
|
89
|
+
b_sum += (stack.b = pb = pixels[p + 2]) * rbs;
|
|
90
|
+
a_sum += (stack.a = pa = pixels[p + 3]) * rbs;
|
|
91
|
+
r_in_sum += pr;
|
|
92
|
+
g_in_sum += pg;
|
|
93
|
+
b_in_sum += pb;
|
|
94
|
+
a_in_sum += pa;
|
|
95
|
+
stack = stack.next;
|
|
96
|
+
}
|
|
97
|
+
stackIn = stackStart;
|
|
98
|
+
stackOut = stackEnd;
|
|
99
|
+
for (let x = 0; x < width; x++) {
|
|
100
|
+
pixels[yi + 3] = pa = (a_sum * mul_sum) >> shg_sum;
|
|
101
|
+
if (pa !== 0) {
|
|
102
|
+
pa = 255 / pa;
|
|
103
|
+
pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa;
|
|
104
|
+
pixels[yi + 1] = ((g_sum * mul_sum) >> shg_sum) * pa;
|
|
105
|
+
pixels[yi + 2] = ((b_sum * mul_sum) >> shg_sum) * pa;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0;
|
|
109
|
+
}
|
|
110
|
+
r_sum -= r_out_sum;
|
|
111
|
+
g_sum -= g_out_sum;
|
|
112
|
+
b_sum -= b_out_sum;
|
|
113
|
+
a_sum -= a_out_sum;
|
|
114
|
+
r_out_sum -= stackIn.r;
|
|
115
|
+
g_out_sum -= stackIn.g;
|
|
116
|
+
b_out_sum -= stackIn.b;
|
|
117
|
+
a_out_sum -= stackIn.a;
|
|
118
|
+
p = (yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1)) << 2;
|
|
119
|
+
r_in_sum += stackIn.r = pixels[p];
|
|
120
|
+
g_in_sum += stackIn.g = pixels[p + 1];
|
|
121
|
+
b_in_sum += stackIn.b = pixels[p + 2];
|
|
122
|
+
a_in_sum += stackIn.a = pixels[p + 3];
|
|
123
|
+
r_sum += r_in_sum;
|
|
124
|
+
g_sum += g_in_sum;
|
|
125
|
+
b_sum += b_in_sum;
|
|
126
|
+
a_sum += a_in_sum;
|
|
127
|
+
stackIn = stackIn.next;
|
|
128
|
+
r_out_sum += pr = stackOut.r;
|
|
129
|
+
g_out_sum += pg = stackOut.g;
|
|
130
|
+
b_out_sum += pb = stackOut.b;
|
|
131
|
+
a_out_sum += pa = stackOut.a;
|
|
132
|
+
r_in_sum -= pr;
|
|
133
|
+
g_in_sum -= pg;
|
|
134
|
+
b_in_sum -= pb;
|
|
135
|
+
a_in_sum -= pa;
|
|
136
|
+
stackOut = stackOut.next;
|
|
137
|
+
yi += 4;
|
|
138
|
+
}
|
|
139
|
+
yw += width;
|
|
140
|
+
}
|
|
141
|
+
for (let x = 0; x < width; x++) {
|
|
142
|
+
g_in_sum =
|
|
143
|
+
b_in_sum =
|
|
144
|
+
a_in_sum =
|
|
145
|
+
r_in_sum =
|
|
146
|
+
g_sum =
|
|
147
|
+
b_sum =
|
|
148
|
+
a_sum =
|
|
149
|
+
r_sum =
|
|
150
|
+
0;
|
|
151
|
+
yi = x << 2;
|
|
152
|
+
r_out_sum = radiusPlus1 * (pr = pixels[yi]);
|
|
153
|
+
g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);
|
|
154
|
+
b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);
|
|
155
|
+
a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]);
|
|
156
|
+
r_sum += sumFactor * pr;
|
|
157
|
+
g_sum += sumFactor * pg;
|
|
158
|
+
b_sum += sumFactor * pb;
|
|
159
|
+
a_sum += sumFactor * pa;
|
|
160
|
+
stack = stackStart;
|
|
161
|
+
for (let i = 0; i < radiusPlus1; i++) {
|
|
162
|
+
stack.r = pr;
|
|
163
|
+
stack.g = pg;
|
|
164
|
+
stack.b = pb;
|
|
165
|
+
stack.a = pa;
|
|
166
|
+
stack = stack.next;
|
|
167
|
+
}
|
|
168
|
+
let yp = width;
|
|
169
|
+
for (let i = 1; i <= radius; i++) {
|
|
170
|
+
yi = (yp + x) << 2;
|
|
171
|
+
r_sum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i);
|
|
172
|
+
g_sum += (stack.g = pg = pixels[yi + 1]) * rbs;
|
|
173
|
+
b_sum += (stack.b = pb = pixels[yi + 2]) * rbs;
|
|
174
|
+
a_sum += (stack.a = pa = pixels[yi + 3]) * rbs;
|
|
175
|
+
r_in_sum += pr;
|
|
176
|
+
g_in_sum += pg;
|
|
177
|
+
b_in_sum += pb;
|
|
178
|
+
a_in_sum += pa;
|
|
179
|
+
stack = stack.next;
|
|
180
|
+
if (i < heightMinus1) {
|
|
181
|
+
yp += width;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
yi = x;
|
|
185
|
+
stackIn = stackStart;
|
|
186
|
+
stackOut = stackEnd;
|
|
187
|
+
for (let y = 0; y < height; y++) {
|
|
188
|
+
p = yi << 2;
|
|
189
|
+
pixels[p + 3] = pa = (a_sum * mul_sum) >> shg_sum;
|
|
190
|
+
if (pa > 0) {
|
|
191
|
+
pa = 255 / pa;
|
|
192
|
+
pixels[p] = ((r_sum * mul_sum) >> shg_sum) * pa;
|
|
193
|
+
pixels[p + 1] = ((g_sum * mul_sum) >> shg_sum) * pa;
|
|
194
|
+
pixels[p + 2] = ((b_sum * mul_sum) >> shg_sum) * pa;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
pixels[p] = pixels[p + 1] = pixels[p + 2] = 0;
|
|
198
|
+
}
|
|
199
|
+
r_sum -= r_out_sum;
|
|
200
|
+
g_sum -= g_out_sum;
|
|
201
|
+
b_sum -= b_out_sum;
|
|
202
|
+
a_sum -= a_out_sum;
|
|
203
|
+
r_out_sum -= stackIn.r;
|
|
204
|
+
g_out_sum -= stackIn.g;
|
|
205
|
+
b_out_sum -= stackIn.b;
|
|
206
|
+
a_out_sum -= stackIn.a;
|
|
207
|
+
p =
|
|
208
|
+
(x +
|
|
209
|
+
((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width) <<
|
|
210
|
+
2;
|
|
211
|
+
r_sum += r_in_sum += stackIn.r = pixels[p];
|
|
212
|
+
g_sum += g_in_sum += stackIn.g = pixels[p + 1];
|
|
213
|
+
b_sum += b_in_sum += stackIn.b = pixels[p + 2];
|
|
214
|
+
a_sum += a_in_sum += stackIn.a = pixels[p + 3];
|
|
215
|
+
stackIn = stackIn.next;
|
|
216
|
+
r_out_sum += pr = stackOut.r;
|
|
217
|
+
g_out_sum += pg = stackOut.g;
|
|
218
|
+
b_out_sum += pb = stackOut.b;
|
|
219
|
+
a_out_sum += pa = stackOut.a;
|
|
220
|
+
r_in_sum -= pr;
|
|
221
|
+
g_in_sum -= pg;
|
|
222
|
+
b_in_sum -= pb;
|
|
223
|
+
a_in_sum -= pa;
|
|
224
|
+
stackOut = stackOut.next;
|
|
225
|
+
yi += width;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
export const Blur = function Blur(imageData) {
|
|
230
|
+
const radius = Math.round(this.blurRadius());
|
|
231
|
+
if (radius > 0) {
|
|
232
|
+
filterGaussBlurRGBA(imageData, radius);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
Factory.addGetterSetter(Node, 'blurRadius', 0, getNumberValidator(), Factory.afterSetFilter);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Factory } from "../Factory.js";
|
|
2
|
+
import { Node } from "../Node.js";
|
|
3
|
+
import { getNumberValidator } from "../Validators.js";
|
|
4
|
+
export const Brighten = function (imageData) {
|
|
5
|
+
const brightness = this.brightness() * 255, data = imageData.data, len = data.length;
|
|
6
|
+
for (let i = 0; i < len; i += 4) {
|
|
7
|
+
data[i] += brightness;
|
|
8
|
+
data[i + 1] += brightness;
|
|
9
|
+
data[i + 2] += brightness;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
Factory.addGetterSetter(Node, 'brightness', 0, getNumberValidator(), Factory.afterSetFilter);
|