@next2d/filters 1.18.12 → 2.0.0
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/package.json +8 -20
- package/src/BevelFilter/service/BevelFilterCanApplyFilterService.d.ts +11 -0
- package/src/BevelFilter/service/BevelFilterCanApplyFilterService.js +16 -0
- package/src/BevelFilter/service/BevelFilterToArrayService.d.ts +11 -0
- package/src/BevelFilter/service/BevelFilterToArrayService.js +26 -0
- package/src/BevelFilter/service/BevelFilterToNumberArrayService.d.ts +11 -0
- package/src/BevelFilter/service/BevelFilterToNumberArrayService.js +27 -0
- package/src/BevelFilter/usecase/BevelFilterGetBoundsUseCase.d.ts +10 -0
- package/src/BevelFilter/usecase/BevelFilterGetBoundsUseCase.js +29 -0
- package/{dist → src}/BevelFilter.d.ts +117 -84
- package/src/BevelFilter.js +513 -0
- package/src/BitmapFilter.d.ts +50 -0
- package/src/BitmapFilter.js +61 -0
- package/src/BlurFilter/service/BlurFilterCanApplyFilterService.d.ts +16 -0
- package/src/BlurFilter/service/BlurFilterCanApplyFilterService.js +12 -0
- package/src/BlurFilter/service/BlurFilterToArrayService.d.ts +11 -0
- package/src/BlurFilter/service/BlurFilterToArrayService.js +17 -0
- package/src/BlurFilter/service/BlurFilterToNumberArrayService.d.ts +11 -0
- package/src/BlurFilter/service/BlurFilterToNumberArrayService.js +17 -0
- package/src/BlurFilter/usecase/BlurFilterGetBoundsUseCase.d.ts +17 -0
- package/src/BlurFilter/usecase/BlurFilterGetBoundsUseCase.js +29 -0
- package/src/BlurFilter.d.ts +142 -0
- package/src/BlurFilter.js +213 -0
- package/src/ColorMatrixFilter/service/ColorMatrixFilterToArrayService.d.ts +11 -0
- package/src/ColorMatrixFilter/service/ColorMatrixFilterToArrayService.js +15 -0
- package/src/ColorMatrixFilter/service/ColorMatrixFilterToNumberArrayService.d.ts +11 -0
- package/src/ColorMatrixFilter/service/ColorMatrixFilterToNumberArrayService.js +15 -0
- package/src/ColorMatrixFilter.d.ts +78 -0
- package/src/ColorMatrixFilter.js +129 -0
- package/src/ConvolutionFilter/service/ConvolutionFilterCanApplyFilterService.d.ts +11 -0
- package/src/ConvolutionFilter/service/ConvolutionFilterCanApplyFilterService.js +13 -0
- package/src/ConvolutionFilter/service/ConvolutionFilterToArrayService.d.ts +11 -0
- package/src/ConvolutionFilter/service/ConvolutionFilterToArrayService.js +23 -0
- package/src/ConvolutionFilter/service/ConvolutionFilterToNumberArrayService.d.ts +11 -0
- package/src/ConvolutionFilter/service/ConvolutionFilterToNumberArrayService.js +24 -0
- package/{dist → src}/ConvolutionFilter.d.ts +75 -63
- package/{dist → src}/ConvolutionFilter.js +148 -126
- package/src/DisplacementMapFilter/service/DisplacementMapFilterCanApplyFilterService.d.ts +11 -0
- package/src/DisplacementMapFilter/service/DisplacementMapFilterCanApplyFilterService.js +16 -0
- package/src/DisplacementMapFilter/service/DisplacementMapFilterToArrayService.d.ts +11 -0
- package/src/DisplacementMapFilter/service/DisplacementMapFilterToArrayService.js +28 -0
- package/src/DisplacementMapFilter/service/DisplacementMapFilterToNumberArrayService.d.ts +11 -0
- package/src/DisplacementMapFilter/service/DisplacementMapFilterToNumberArrayService.js +36 -0
- package/src/DisplacementMapFilter.d.ts +274 -0
- package/src/DisplacementMapFilter.js +481 -0
- package/src/DropShadowFilter/service/DropShadowFilterCanApplyFilterService.d.ts +11 -0
- package/src/DropShadowFilter/service/DropShadowFilterCanApplyFilterService.js +16 -0
- package/src/DropShadowFilter/service/DropShadowFilterToArrayService.d.ts +11 -0
- package/src/DropShadowFilter/service/DropShadowFilterToArrayService.js +25 -0
- package/src/DropShadowFilter/service/DropShadowFilterToNumberArrayService.d.ts +11 -0
- package/src/DropShadowFilter/service/DropShadowFilterToNumberArrayService.js +25 -0
- package/src/DropShadowFilter/usecase/DropShadowFilterGetBoundsUseCase.d.ts +10 -0
- package/src/DropShadowFilter/usecase/DropShadowFilterGetBoundsUseCase.js +33 -0
- package/{dist → src}/DropShadowFilter.d.ts +98 -73
- package/src/DropShadowFilter.js +466 -0
- package/src/FilterUtil.d.ts +36 -0
- package/src/FilterUtil.js +60 -0
- package/src/GlowFilter/service/GlowFilterCanApplyFilterService.d.ts +11 -0
- package/src/GlowFilter/service/GlowFilterCanApplyFilterService.js +16 -0
- package/src/GlowFilter/service/GlowFilterToArrayService.d.ts +11 -0
- package/src/GlowFilter/service/GlowFilterToArrayService.js +22 -0
- package/src/GlowFilter/service/GlowFilterToNumberArrayService.d.ts +11 -0
- package/src/GlowFilter/service/GlowFilterToNumberArrayService.js +22 -0
- package/src/GlowFilter/usecase/GlowFilterGetBoundsUseCase.d.ts +10 -0
- package/src/GlowFilter/usecase/GlowFilterGetBoundsUseCase.js +19 -0
- package/{dist → src}/GlowFilter.d.ts +84 -74
- package/src/GlowFilter.js +367 -0
- package/src/GradientBevelFilter/service/GradientBevelFilterCanApplyFilterService.d.ts +11 -0
- package/src/GradientBevelFilter/service/GradientBevelFilterCanApplyFilterService.js +19 -0
- package/src/GradientBevelFilter/service/GradientBevelFilterToArrayService.d.ts +11 -0
- package/src/GradientBevelFilter/service/GradientBevelFilterToArrayService.js +25 -0
- package/src/GradientBevelFilter/service/GradientBevelFilterToNumberArrayService.d.ts +11 -0
- package/src/GradientBevelFilter/service/GradientBevelFilterToNumberArrayService.js +29 -0
- package/src/GradientBevelFilter/usecase/GradientBevelFilterGetBoundsUseCase.d.ts +10 -0
- package/src/GradientBevelFilter/usecase/GradientBevelFilterGetBoundsUseCase.js +29 -0
- package/{dist → src}/GradientBevelFilter.d.ts +102 -77
- package/src/GradientBevelFilter.js +482 -0
- package/src/GradientGlowFilter/service/GradientGlowFilterCanApplyFilterService.d.ts +11 -0
- package/src/GradientGlowFilter/service/GradientGlowFilterCanApplyFilterService.js +19 -0
- package/src/GradientGlowFilter/service/GradientGlowFilterToArrayService.d.ts +11 -0
- package/src/GradientGlowFilter/service/GradientGlowFilterToArrayService.js +25 -0
- package/src/GradientGlowFilter/service/GradientGlowFilterToNumberArrayService.d.ts +11 -0
- package/src/GradientGlowFilter/service/GradientGlowFilterToNumberArrayService.js +29 -0
- package/src/GradientGlowFilter/usecase/GradientGlowFilterGetBoundsUseCase.d.ts +10 -0
- package/src/GradientGlowFilter/usecase/GradientGlowFilterGetBoundsUseCase.js +19 -0
- package/{dist → src}/GradientGlowFilter.d.ts +102 -78
- package/src/GradientGlowFilter.js +480 -0
- package/src/interface/IBitmapDataChannel.d.ts +1 -0
- package/src/interface/IBitmapFilterType.d.ts +1 -0
- package/{dist/interface/BoundsImpl.d.ts → src/interface/IBounds.d.ts} +1 -1
- package/src/interface/IDisplacementMapFilterMode.d.ts +1 -0
- package/src/interface/IFilterQuality.d.ts +1 -0
- package/dist/BevelFilter.js +0 -504
- package/dist/BitmapFilter.d.ts +0 -75
- package/dist/BitmapFilter.js +0 -95
- package/dist/BlurFilter.d.ts +0 -150
- package/dist/BlurFilter.js +0 -375
- package/dist/ColorMatrixFilter.d.ts +0 -116
- package/dist/ColorMatrixFilter.js +0 -179
- package/dist/DisplacementMapFilter.d.ts +0 -211
- package/dist/DisplacementMapFilter.js +0 -368
- package/dist/DropShadowFilter.js +0 -475
- package/dist/GlowFilter.js +0 -356
- package/dist/GradientBevelFilter.js +0 -490
- package/dist/GradientGlowFilter.js +0 -480
- package/dist/interface/AttachmentImpl.d.ts +0 -11
- package/dist/interface/BitmapDataChannelImpl.d.ts +0 -1
- package/dist/interface/BitmapFilterTypeImpl.d.ts +0 -1
- package/dist/interface/DisplacementMapFilterModeImpl.d.ts +0 -1
- package/dist/interface/FilterQualityImpl.d.ts +0 -1
- package/dist/interface/FilterQualityImpl.js +0 -1
- /package/{dist → src}/index.d.ts +0 -0
- /package/{dist → src}/index.js +0 -0
- /package/{dist/interface/AttachmentImpl.js → src/interface/IBitmapDataChannel.js} +0 -0
- /package/{dist/interface/BitmapDataChannelImpl.js → src/interface/IBitmapFilterType.js} +0 -0
- /package/{dist/interface/BitmapFilterTypeImpl.js → src/interface/IBounds.js} +0 -0
- /package/{dist/interface/BoundsImpl.js → src/interface/IDisplacementMapFilterMode.js} +0 -0
- /package/{dist/interface/DisplacementMapFilterModeImpl.js → src/interface/IFilterQuality.js} +0 -0
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
import { BitmapFilter } from "./BitmapFilter";
|
|
2
|
-
import { $clamp, $getArray, $intToB, $intToG, $intToR, $Math, $toColorInt } from "@next2d/share";
|
|
3
|
-
/**
|
|
4
|
-
* DisplacementMapFilter クラスは、指定された BitmapData オブジェクト(置き換えマップイメージと言います)
|
|
5
|
-
* のピクセル値を使用して、オブジェクトの置き換え(変位)を実行します。
|
|
6
|
-
*
|
|
7
|
-
* The DisplacementMapFilter class uses the pixel values from the specified
|
|
8
|
-
* BitmapData object (called the displacement map image) to perform a displacement of an object.
|
|
9
|
-
*
|
|
10
|
-
* @class
|
|
11
|
-
* @memberOf next2d.filters
|
|
12
|
-
* @extends BitmapFilter
|
|
13
|
-
*/
|
|
14
|
-
export class DisplacementMapFilter extends BitmapFilter {
|
|
15
|
-
/**
|
|
16
|
-
* @param {HTMLImageElement} [map_bitmap = null]
|
|
17
|
-
* @param {object} [map_point = null]
|
|
18
|
-
* @param {number} [component_x = 0]
|
|
19
|
-
* @param {number} [component_y = 0]
|
|
20
|
-
* @param {number} [scale_x = 0.0]
|
|
21
|
-
* @param {number} [scale_y = 0.0]
|
|
22
|
-
* @param {string} [mode = DisplacementMapFilterMode.WRAP]
|
|
23
|
-
* @param {number} [color = 0]
|
|
24
|
-
* @param {number} [alpha = 0.0]
|
|
25
|
-
*
|
|
26
|
-
* @constructor
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
constructor(map_bitmap = null, map_point = null, component_x = 0, component_y = 0, scale_x = 0, scale_y = 0, mode = "wrap", color = 0, alpha = 0) {
|
|
30
|
-
super();
|
|
31
|
-
/**
|
|
32
|
-
* @type {BitmapData}
|
|
33
|
-
* @default null
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
this._$mapBitmap = null;
|
|
37
|
-
/**
|
|
38
|
-
* @type {object}
|
|
39
|
-
* @default null
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
this._$mapPoint = null;
|
|
43
|
-
/**
|
|
44
|
-
* @type {number}
|
|
45
|
-
* @default 0
|
|
46
|
-
* @private
|
|
47
|
-
*/
|
|
48
|
-
this._$componentX = 0;
|
|
49
|
-
/**
|
|
50
|
-
* @type {number}
|
|
51
|
-
* @default 0
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
this._$componentY = 0;
|
|
55
|
-
/**
|
|
56
|
-
* @type {number}
|
|
57
|
-
* @default 0
|
|
58
|
-
* @private
|
|
59
|
-
*/
|
|
60
|
-
this._$scaleX = 0;
|
|
61
|
-
/**
|
|
62
|
-
* @type {number}
|
|
63
|
-
* @default 0
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
this._$scaleY = 0;
|
|
67
|
-
/**
|
|
68
|
-
* @type {string}
|
|
69
|
-
* @default DisplacementMapFilterMode.WRAP
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
this._$mode = "wrap";
|
|
73
|
-
/**
|
|
74
|
-
* @type {number}
|
|
75
|
-
* @default 0
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
this._$color = 0;
|
|
79
|
-
/**
|
|
80
|
-
* @type {number}
|
|
81
|
-
* @default 0
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
this._$alpha = 0;
|
|
85
|
-
// setup
|
|
86
|
-
this.mapBitmap = map_bitmap;
|
|
87
|
-
this.mapPoint = map_point;
|
|
88
|
-
this.componentX = component_x;
|
|
89
|
-
this.componentY = component_y;
|
|
90
|
-
this.scaleX = scale_x;
|
|
91
|
-
this.scaleY = scale_y;
|
|
92
|
-
this.mode = mode;
|
|
93
|
-
this.color = color;
|
|
94
|
-
this.alpha = alpha;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @description 指定されたクラスのストリングを返します。
|
|
98
|
-
* Returns the string representation of the specified class.
|
|
99
|
-
*
|
|
100
|
-
* @return {string}
|
|
101
|
-
* @default [class DisplacementMapFilter]
|
|
102
|
-
* @method
|
|
103
|
-
* @static
|
|
104
|
-
*/
|
|
105
|
-
static toString() {
|
|
106
|
-
return "[class DisplacementMapFilter]";
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @description 指定されたクラスの空間名を返します。
|
|
110
|
-
* Returns the space name of the specified class.
|
|
111
|
-
*
|
|
112
|
-
* @return {string}
|
|
113
|
-
* @default next2d.filters.DisplacementMapFilter
|
|
114
|
-
* @const
|
|
115
|
-
* @static
|
|
116
|
-
*/
|
|
117
|
-
static get namespace() {
|
|
118
|
-
return "next2d.filters.DisplacementMapFilter";
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @description 指定されたオブジェクトのストリングを返します。
|
|
122
|
-
* Returns the string representation of the specified object.
|
|
123
|
-
*
|
|
124
|
-
* @return {string}
|
|
125
|
-
* @default [object DisplacementMapFilter]
|
|
126
|
-
* @method
|
|
127
|
-
* @public
|
|
128
|
-
*/
|
|
129
|
-
toString() {
|
|
130
|
-
return "[object DisplacementMapFilter]";
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @description 指定されたオブジェクトの空間名を返します。
|
|
134
|
-
* Returns the space name of the specified object.
|
|
135
|
-
*
|
|
136
|
-
* @return {string}
|
|
137
|
-
* @default next2d.filters.DisplacementMapFilter
|
|
138
|
-
* @const
|
|
139
|
-
* @public
|
|
140
|
-
*/
|
|
141
|
-
get namespace() {
|
|
142
|
-
return "next2d.filters.DisplacementMapFilter";
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @description アルファ透明度の値です。
|
|
146
|
-
* The alpha transparency value for the color.
|
|
147
|
-
*
|
|
148
|
-
* @member {number}
|
|
149
|
-
* @default 0
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
|
-
get alpha() {
|
|
153
|
-
return this._$alpha;
|
|
154
|
-
}
|
|
155
|
-
set alpha(alpha) {
|
|
156
|
-
alpha = $clamp(+alpha, 0, 1, 0);
|
|
157
|
-
if (alpha !== this._$alpha) {
|
|
158
|
-
this._$alpha = alpha;
|
|
159
|
-
this._$doChanged();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* @description 範囲外置き換えの場合に使用する色を指定します。
|
|
164
|
-
* Specifies what color to use for out-of-bounds displacements.
|
|
165
|
-
*
|
|
166
|
-
* @member {number}
|
|
167
|
-
* @default 0
|
|
168
|
-
* @public
|
|
169
|
-
*/
|
|
170
|
-
get color() {
|
|
171
|
-
return this._$color;
|
|
172
|
-
}
|
|
173
|
-
set color(color) {
|
|
174
|
-
color = $clamp($toColorInt(color), 0, 0xffffff, 0);
|
|
175
|
-
if (color !== this._$color) {
|
|
176
|
-
this._$color = color;
|
|
177
|
-
this._$doChanged();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* @description x の結果を変位させる場合にどのカラーチャンネルをマップイメージで使用するかを指定します。
|
|
182
|
-
* Describes which color channel to use in the map image to displace the x result.
|
|
183
|
-
*
|
|
184
|
-
* @member {number}
|
|
185
|
-
* @default 0
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
get componentX() {
|
|
189
|
-
return this._$componentX;
|
|
190
|
-
}
|
|
191
|
-
set componentX(component_x) {
|
|
192
|
-
if (component_x !== this._$componentX) {
|
|
193
|
-
this._$componentX = component_x;
|
|
194
|
-
this._$doChanged();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @description y の結果を変位させる場合にどのカラーチャンネルをマップイメージで使用するかを指定します。
|
|
199
|
-
* Describes which color channel to use in the map image to displace the y result.
|
|
200
|
-
*
|
|
201
|
-
* @member {number}
|
|
202
|
-
* @default 0
|
|
203
|
-
* @public
|
|
204
|
-
*/
|
|
205
|
-
get componentY() {
|
|
206
|
-
return this._$componentY;
|
|
207
|
-
}
|
|
208
|
-
set componentY(component_y) {
|
|
209
|
-
if (component_y !== this._$componentY) {
|
|
210
|
-
this._$componentY = component_y;
|
|
211
|
-
this._$doChanged();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* @description 置き換えマップデータが含まれる BitmapData オブジェクトです。
|
|
216
|
-
* A BitmapData object containing the displacement map data.
|
|
217
|
-
*
|
|
218
|
-
* @member {HTMLImageElement}
|
|
219
|
-
* @default null
|
|
220
|
-
* @public
|
|
221
|
-
*/
|
|
222
|
-
get mapBitmap() {
|
|
223
|
-
return this._$mapBitmap;
|
|
224
|
-
}
|
|
225
|
-
set mapBitmap(map_bitmap) {
|
|
226
|
-
if (map_bitmap !== this._$mapBitmap) {
|
|
227
|
-
this._$mapBitmap = map_bitmap;
|
|
228
|
-
this._$doChanged();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* @description マップイメージの左上隅を基準としたターゲット表示オブジェクトの
|
|
233
|
-
* 左上隅のオフセットが含まれる値です。
|
|
234
|
-
* A value that contains the offset of the upper-left corner
|
|
235
|
-
* of the target display object from the upper-left corner of the map image.
|
|
236
|
-
*
|
|
237
|
-
* @member {object}
|
|
238
|
-
* @default null
|
|
239
|
-
* @public
|
|
240
|
-
*/
|
|
241
|
-
get mapPoint() {
|
|
242
|
-
return this._$mapPoint;
|
|
243
|
-
}
|
|
244
|
-
set mapPoint(map_point) {
|
|
245
|
-
if (map_point !== this._$mapPoint) {
|
|
246
|
-
this._$mapPoint = map_point;
|
|
247
|
-
this._$doChanged();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* @description フィルターのモードです。
|
|
252
|
-
* The mode for the filter.
|
|
253
|
-
*
|
|
254
|
-
* @member {string}
|
|
255
|
-
* @default DisplacementMapFilterMode.WRAP
|
|
256
|
-
* @public
|
|
257
|
-
*/
|
|
258
|
-
get mode() {
|
|
259
|
-
return this._$mode;
|
|
260
|
-
}
|
|
261
|
-
set mode(mode) {
|
|
262
|
-
if (mode !== this._$mode) {
|
|
263
|
-
this._$mode = mode;
|
|
264
|
-
this._$doChanged();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* @description マップ計算の x 置き換え結果を拡大 / 縮小する場合に使用する乗数です。
|
|
269
|
-
* The multiplier to use to scale the x displacement result from the map calculation.
|
|
270
|
-
*
|
|
271
|
-
* @member {number}
|
|
272
|
-
* @default 0
|
|
273
|
-
* @public
|
|
274
|
-
*/
|
|
275
|
-
get scaleX() {
|
|
276
|
-
return this._$scaleX;
|
|
277
|
-
}
|
|
278
|
-
set scaleX(scale_x) {
|
|
279
|
-
scale_x = $clamp(+scale_x, -0xffff, 0xffff, 0);
|
|
280
|
-
if (scale_x !== this._$scaleX) {
|
|
281
|
-
this._$scaleX = scale_x;
|
|
282
|
-
this._$doChanged();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* @description マップ計算の y 置き換え結果を拡大 / 縮小する場合に使用する乗数です。
|
|
287
|
-
* The multiplier to use to scale the y displacement result from the map calculation.
|
|
288
|
-
*
|
|
289
|
-
* @member {number}
|
|
290
|
-
* @default 0
|
|
291
|
-
* @public
|
|
292
|
-
*/
|
|
293
|
-
get scaleY() {
|
|
294
|
-
return this._$scaleY;
|
|
295
|
-
}
|
|
296
|
-
set scaleY(scale_y) {
|
|
297
|
-
scale_y = $clamp(+scale_y, -0xffff, 0xffff, 0);
|
|
298
|
-
if (scale_y !== this._$scaleY) {
|
|
299
|
-
this._$scaleY = scale_y;
|
|
300
|
-
this._$doChanged();
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* @description オブジェクトのコピーを返します。
|
|
305
|
-
* Returns a copy of this filter object.
|
|
306
|
-
*
|
|
307
|
-
* @return {DisplacementMapFilter}
|
|
308
|
-
* @method
|
|
309
|
-
* @public
|
|
310
|
-
*/
|
|
311
|
-
clone() {
|
|
312
|
-
return new DisplacementMapFilter(this._$mapBitmap, this._$mapPoint, this._$componentX, this._$componentY, this._$scaleX, this._$scaleY, this._$mode, this._$color, this._$alpha);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* @return {array}
|
|
316
|
-
* @method
|
|
317
|
-
* @public
|
|
318
|
-
*/
|
|
319
|
-
_$toArray() {
|
|
320
|
-
return $getArray(4, this._$mapBitmap, this._$mapPoint, this._$componentX, this._$componentY, this._$scaleX, this._$scaleY, this._$mode, this._$color, this._$alpha);
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* @param {object} bounds
|
|
324
|
-
* @return {object}
|
|
325
|
-
* @method
|
|
326
|
-
* @private
|
|
327
|
-
*/
|
|
328
|
-
_$generateFilterRect(bounds) {
|
|
329
|
-
return bounds;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* @return {boolean}
|
|
333
|
-
* @method
|
|
334
|
-
* @private
|
|
335
|
-
*/
|
|
336
|
-
_$canApply() {
|
|
337
|
-
return this._$mapBitmap !== null
|
|
338
|
-
&& this._$componentX > 0 && this._$componentY > 0
|
|
339
|
-
&& this._$scaleX !== 0 && this._$scaleY !== 0;
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* @param {CanvasToWebGLContext} context
|
|
343
|
-
* @param {Float32Array} matrix
|
|
344
|
-
* @return {WebGLTexture}
|
|
345
|
-
* @method
|
|
346
|
-
* @private
|
|
347
|
-
*/
|
|
348
|
-
_$applyFilter(context, matrix) {
|
|
349
|
-
this._$updated = false;
|
|
350
|
-
const manager = context.frameBuffer;
|
|
351
|
-
const currentAttachment = manager.currentAttachment;
|
|
352
|
-
// reset
|
|
353
|
-
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
354
|
-
const texture = manager
|
|
355
|
-
.getTextureFromCurrentAttachment();
|
|
356
|
-
if (!this._$canApply()
|
|
357
|
-
|| !currentAttachment
|
|
358
|
-
|| !this._$mapBitmap) {
|
|
359
|
-
return texture;
|
|
360
|
-
}
|
|
361
|
-
// matrix to scale
|
|
362
|
-
const xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
|
|
363
|
-
const yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
|
|
364
|
-
context._$applyDisplacementMapFilter(texture, this._$mapBitmap, texture.width / xScale, texture.height / yScale, this._$mapPoint, this._$componentX, this._$componentY, this._$scaleX, this._$scaleY, this._$mode, $intToR(this._$color, this._$alpha, true), $intToG(this._$color, this._$alpha, true), $intToB(this._$color, this._$alpha, true), this._$alpha);
|
|
365
|
-
manager.releaseAttachment(currentAttachment, true);
|
|
366
|
-
return manager.getTextureFromCurrentAttachment();
|
|
367
|
-
}
|
|
368
|
-
}
|