-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathsvg.filter.js.d.ts
288 lines (238 loc) · 9.99 KB
/
svg.filter.js.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
import {Element, List} from '@svgdotjs/svg.js'
declare module "@svgdotjs/svg.js" {
type EffectOrString = Effect | string
type componentsOrFn = {
r: number,
g: number,
b: number,
a: number
} | number | ((componentTransfer: ComponentTransferEffect) => void)
export class Filter extends Element {
constructor (node?: SVGFilterElement)
constructor (attr: Object)
targets (): List<Element>
node: SVGFilterElement
$source: 'SourceGraphic'
$sourceAlpha: 'SourceAlpha'
$background: 'BackgroundImage'
$backgroundAlpha: 'BackgroundAlpha'
$fill: 'FillPaint'
$stroke: 'StrokePaint'
$autoSetIn: boolean
blend (in1: EffectOrString, in2: EffectOrString, mode: string): BlendEffect
colorMatrix (type: string, values: Array<number> | string ): ColorMatrixEffect
componentTransfer (components: componentsOrFn): ComponentTransferEffect
composite (in1: EffectOrString, in2: EffectOrString, operator: string): CompositeEffect
convolveMatrix (matrix: Array<number> | string): ConvolveMatrixEffect
diffuseLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, kernelUnitLength: number): DiffuseLightingEffect
displacementMap (in1: EffectOrString, in2: EffectOrString, scale: number, xChannelSelector: string, yChannelSelector: string): DisplacementMapEffect
dropShadow (in1: EffectOrString, dx: number, dy: number, stdDeviation: number): DropShadowEffect
flood (color: string, opacity: number): FloodEffect
gaussianBlur (x: number, y: number): GaussianBlurEffect
image (src: string): ImageEffect
merge (input: Array<Effect> | ((mergeEffect: MergeEffect) => void)): MergeEffect
morphology (operator: string, radius: number): MorphologyEffect
offset (x: number, y: number): OffsetEffect
specularLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, specularExponent: number, kernelUnitLength: number): SpecularLightingEffect
tile (): TileEffect
turbulence (baseFrequency: number, numOctaves: number, seed: number, stitchTiles: string, type: string): TurbulenceEffect
}
interface SVGFEDropShadowElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly dx: SVGAnimatedNumber;
readonly dy: SVGAnimatedNumber;
readonly stdDeviationX: SVGAnimatedNumber;
readonly stdDeviationY: SVGAnimatedNumber;
setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
type SVGEffectElement =
SVGFEBlendElement |
SVGFEBlendElement |
SVGFEColorMatrixElement |
SVGFEComponentTransferElement |
SVGFECompositeElement |
SVGFEConvolveMatrixElement |
SVGFEDiffuseLightingElement |
SVGFEDisplacementMapElement |
SVGFEDropShadowElement |
SVGFEFloodElement |
SVGFEGaussianBlurElement |
SVGFEImageElement |
SVGFEMergeElement |
SVGFEMorphologyElement |
SVGFEOffsetElement |
SVGFESpecularLightingElement |
SVGFETileElement |
SVGFETurbulenceElement
// Base class for all effects
class Effect extends Element {
constructor (node?: SVGEffectElement)
constructor (attr: Object)
in (): Effect | string
in (effect: Effect | string): this
result (): string
result (result: string): this
blend (in2: EffectOrString, mode: string): BlendEffect
colorMatrix (type: string, values: Array<number> | string ): ColorMatrixEffect
componentTransfer (components: componentsOrFn): ComponentTransferEffect
composite (in2: EffectOrString, operator: string): CompositeEffect
convolveMatrix (matrix: Array<number> | string): ConvolveMatrixEffect
diffuseLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, kernelUnitLength: number): DiffuseLightingEffect
displacementMap (in2: EffectOrString, scale: number, xChannelSelector: string, yChannelSelector: string): DisplacementMapEffect
dropShadow (dx: number, dy: number, stdDeviation: number): DropShadowEffect
flood (color: string, opacity: number): FloodEffect
gaussianBlur (x: number, y: number): GaussianBlurEffect
image (src: string): ImageEffect
merge (input: Array<Effect> | ((mergeEffect: MergeEffect) => void)): MergeEffect
morphology (operator: string, radius: number): MorphologyEffect
offset (x: number, y: number): OffsetEffect
specularLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, specularExponent: number, kernelUnitLength: number): SpecularLightingEffect
tile (): TileEffect
turbulence (baseFrequency: number, numOctaves: number, seed: number, stitchTiles: string, type: string): TurbulenceEffect
}
interface LightEffects {
distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight
pointLight (attr?: Object | SVGFEPointLightElement): PointLight
spotLight (attr?: Object | SVGFESpotLightElement): SpotLight
}
// The following classes are all available effects
// which can be used with filter
class BlendEffect extends Effect {
constructor (node: SVGFEBlendElement)
constructor (attr: Object)
in2 (effect: EffectOrString): this
in2 (): EffectOrString
}
class ColorMatrixEffect extends Effect {
constructor (node: SVGFEColorMatrixElement)
constructor (attr: Object)
}
class ComponentTransferEffect extends Effect {
constructor (node: SVGFEComponentTransferElement)
constructor (attr: Object)
funcR (attr?: Object | SVGFEFuncRElement): FuncR
funcG (attr?: Object | SVGFEFuncGElement): FuncG
funcB (attr?: Object | SVGFEFuncBElement): FuncB
funcA (attr?: Object | SVGFEFuncAElement): FuncA
}
class CompositeEffect extends Effect {
constructor (node: SVGFECompositeElement)
constructor (attr: Object)
in2 (effect: EffectOrString): this
in2 (): EffectOrString
}
class ConvolveMatrixEffect extends Effect {
constructor (node: SVGFEConvolveMatrixElement)
constructor (attr: Object)
}
class DiffuseLightingEffect extends Effect implements LightEffects {
constructor (node: SVGFEDiffuseLightingElement)
constructor (attr: Object)
distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight
pointLight (attr?: Object | SVGFEPointLightElement): PointLight
spotLight (attr?: Object | SVGFESpotLightElement): SpotLight
}
class DisplacementMapEffect extends Effect {
constructor (node: SVGFEDisplacementMapElement)
constructor (attr: Object)
in2 (effect: EffectOrString): this
in2 (): EffectOrString
}
class DropShadowEffect extends Effect {
constructor (node: SVGFEDropShadowElement)
constructor (attr: Object)
}
class FloodEffect extends Effect {
constructor (node: SVGFEFloodElement)
constructor (attr: Object)
}
class GaussianBlurEffect extends Effect {
constructor (node: SVGFEGaussianBlurElement)
constructor (attr: Object)
}
class ImageEffect extends Effect {
constructor (node: SVGFEImageElement)
constructor (attr: Object)
}
class MergeEffect extends Effect {
constructor (node: SVGFEMergeElement)
constructor (attr: Object)
mergeNode (attr?: Object | SVGFEMergeNodeElement): MergeNode
}
class MorphologyEffect extends Effect {
constructor (node: SVGFEMorphologyElement)
constructor (attr: Object)
}
class OffsetEffect extends Effect {
constructor (node: SVGFEOffsetElement)
constructor (attr: Object)
}
class SpecularLightingEffect extends Effect {
constructor (node: SVGFESpecularLightingElement)
constructor (attr: Object)
distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight
pointLight (attr?: Object | SVGFEPointLightElement): PointLight
spotLight (attr?: Object | SVGFESpotLightElement): SpotLight
}
class TileEffect extends Effect {
constructor (node: SVGFETileElement)
constructor (attr: Object)
}
class TurbulenceEffect extends Effect {
constructor (node: SVGFETurbulenceElement)
constructor (attr: Object)
}
// These are the lightsources for the following effects:
// - DiffuseLightingEffect
// - SpecularLightingEffect
class DistantLight extends Effect {
constructor (node: SVGFEDistantLightElement)
constructor (attr: Object)
}
class PointLight extends Effect {
constructor (node: SVGFEPointLightElement)
constructor (attr: Object)
}
class SpotLight extends Effect {
constructor (node: SVGFESpotLightElement)
constructor (attr: Object)
}
// Mergenode is the element required for the MergeEffect
class MergeNode extends Effect {
constructor (node: SVGFEMergeNodeElement)
constructor (attr: Object)
}
// Component elements for the ComponentTransferEffect
class FuncR extends Effect {
constructor (node: SVGFEFuncRElement)
constructor (attr: Object)
}
class FuncG extends Effect {
constructor (node: SVGFEFuncGElement)
constructor (attr: Object)
}
class FuncB extends Effect {
constructor (node: SVGFEFuncBElement)
constructor (attr: Object)
}
class FuncA extends Effect {
constructor (node: SVGFEFuncAElement)
constructor (attr: Object)
}
// Extensions of the core lib
interface Element {
filterWith(filterOrFn?: Filter | ((filter: Filter) => void)): this
filterer(): Filter | null
unfilter(): this
}
interface Defs {
filter(fn?: (filter: Filter) => void): Filter
}
interface Container {
filter(fn?: (filter: Filter) => void): Filter
}
}