@next2d/filters 1.18.12 → 2.0.1
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,14 +1,17 @@
|
|
|
1
1
|
import { BitmapFilter } from "./BitmapFilter";
|
|
2
|
-
import {
|
|
2
|
+
import { execute as convolutionFilterCanApplyFilterService } from "./ConvolutionFilter/service/ConvolutionFilterCanApplyFilterService";
|
|
3
|
+
import { execute as convolutionFilterToArrayService } from "./ConvolutionFilter/service/ConvolutionFilterToArrayService";
|
|
4
|
+
import { execute as convolutionFilterToNumberArrayService } from "./ConvolutionFilter/service/ConvolutionFilterToNumberArrayService";
|
|
5
|
+
import { $clamp, $convertColorStringToNumber } from "./FilterUtil";
|
|
3
6
|
/**
|
|
4
|
-
* ConvolutionFilter クラスを使用すると、マトリックス畳み込みフィルター効果を適用できます。
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
+
* @description ConvolutionFilter クラスを使用すると、マトリックス畳み込みフィルター効果を適用できます。
|
|
8
|
+
* 畳み込みでは、入力イメージ内のピクセルを、隣接するピクセルと組み合わせて、イメージを作成します。
|
|
9
|
+
* 畳み込みを使用すると、ぼかし、エッジ検出、シャープ、エンボス、ベベルなど、幅広いイメージ効果を実現できます。
|
|
7
10
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* The ConvolutionFilter class applies a matrix convolution filter effect.
|
|
12
|
+
* A convolution combines pixels in the input image with neighboring pixels to produce an image.
|
|
13
|
+
* A wide variety of image effects can be achieved through convolutions, including blurring,
|
|
14
|
+
* edge detection, sharpening, embossing, and beveling.
|
|
12
15
|
*
|
|
13
16
|
* @class
|
|
14
17
|
* @memberOf next2d.filters
|
|
@@ -31,59 +34,127 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
31
34
|
*/
|
|
32
35
|
constructor(matrix_x = 0, matrix_y = 0, matrix = null, divisor = 1, bias = 0, preserve_alpha = true, clamp = true, color = 0, alpha = 0) {
|
|
33
36
|
super();
|
|
37
|
+
/**
|
|
38
|
+
* @description フィルター認識番号
|
|
39
|
+
* Filter Recognition Number
|
|
40
|
+
*
|
|
41
|
+
* @member {number}
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
Object.defineProperty(this, "$filterType", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: 3
|
|
49
|
+
});
|
|
34
50
|
/**
|
|
35
51
|
* @type {number}
|
|
36
52
|
* @default 0
|
|
37
53
|
* @private
|
|
38
54
|
*/
|
|
39
|
-
this
|
|
55
|
+
Object.defineProperty(this, "_$matrixX", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: void 0
|
|
60
|
+
});
|
|
40
61
|
/**
|
|
41
62
|
* @type {number}
|
|
42
63
|
* @default 0
|
|
43
64
|
* @private
|
|
44
65
|
*/
|
|
45
|
-
this
|
|
66
|
+
Object.defineProperty(this, "_$matrixY", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
value: void 0
|
|
71
|
+
});
|
|
46
72
|
/**
|
|
47
73
|
* @type {array}
|
|
48
74
|
* @default null
|
|
49
75
|
* @private
|
|
50
76
|
*/
|
|
51
|
-
this
|
|
77
|
+
Object.defineProperty(this, "_$matrix", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: void 0
|
|
82
|
+
});
|
|
52
83
|
/**
|
|
53
84
|
* @type {number}
|
|
54
85
|
* @default 1
|
|
55
86
|
* @private
|
|
56
87
|
*/
|
|
57
|
-
this
|
|
88
|
+
Object.defineProperty(this, "_$divisor", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
configurable: true,
|
|
91
|
+
writable: true,
|
|
92
|
+
value: void 0
|
|
93
|
+
});
|
|
58
94
|
/**
|
|
59
95
|
* @type {number}
|
|
60
96
|
* @default 0
|
|
61
97
|
* @private
|
|
62
98
|
*/
|
|
63
|
-
this
|
|
99
|
+
Object.defineProperty(this, "_$bias", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
configurable: true,
|
|
102
|
+
writable: true,
|
|
103
|
+
value: void 0
|
|
104
|
+
});
|
|
64
105
|
/**
|
|
65
106
|
* @type {boolean}
|
|
66
107
|
* @default true
|
|
67
108
|
* @private
|
|
68
109
|
*/
|
|
69
|
-
this
|
|
110
|
+
Object.defineProperty(this, "_$preserveAlpha", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
configurable: true,
|
|
113
|
+
writable: true,
|
|
114
|
+
value: void 0
|
|
115
|
+
});
|
|
70
116
|
/**
|
|
71
117
|
* @type {boolean}
|
|
72
118
|
* @default true
|
|
73
119
|
* @private
|
|
74
120
|
*/
|
|
75
|
-
this
|
|
121
|
+
Object.defineProperty(this, "_$clamp", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
configurable: true,
|
|
124
|
+
writable: true,
|
|
125
|
+
value: void 0
|
|
126
|
+
});
|
|
76
127
|
/**
|
|
77
128
|
* @type {number}
|
|
78
129
|
* @default 0
|
|
79
130
|
* @private
|
|
80
131
|
*/
|
|
81
|
-
this
|
|
132
|
+
Object.defineProperty(this, "_$color", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
configurable: true,
|
|
135
|
+
writable: true,
|
|
136
|
+
value: void 0
|
|
137
|
+
});
|
|
82
138
|
/**
|
|
83
139
|
* @type {number}
|
|
84
140
|
* @default 0
|
|
85
141
|
* @private
|
|
86
142
|
*/
|
|
143
|
+
Object.defineProperty(this, "_$alpha", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
configurable: true,
|
|
146
|
+
writable: true,
|
|
147
|
+
value: void 0
|
|
148
|
+
});
|
|
149
|
+
// default
|
|
150
|
+
this._$matrixX = 0;
|
|
151
|
+
this._$matrixY = 0;
|
|
152
|
+
this._$matrix = null;
|
|
153
|
+
this._$divisor = 1;
|
|
154
|
+
this._$bias = 0;
|
|
155
|
+
this._$preserveAlpha = true;
|
|
156
|
+
this._$clamp = true;
|
|
157
|
+
this._$color = 0;
|
|
87
158
|
this._$alpha = 0;
|
|
88
159
|
// setup
|
|
89
160
|
this.matrixX = matrix_x;
|
|
@@ -96,54 +167,6 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
96
167
|
this.color = color;
|
|
97
168
|
this.alpha = alpha;
|
|
98
169
|
}
|
|
99
|
-
/**
|
|
100
|
-
* @description 指定されたクラスのストリングを返します。
|
|
101
|
-
* Returns the string representation of the specified class.
|
|
102
|
-
*
|
|
103
|
-
* @return {string}
|
|
104
|
-
* @default [class ConvolutionFilter]
|
|
105
|
-
* @method
|
|
106
|
-
* @static
|
|
107
|
-
*/
|
|
108
|
-
static toString() {
|
|
109
|
-
return "[class ConvolutionFilter]";
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* @description 指定されたクラスの空間名を返します。
|
|
113
|
-
* Returns the space name of the specified class.
|
|
114
|
-
*
|
|
115
|
-
* @return {string}
|
|
116
|
-
* @default next2d.filters.ConvolutionFilter
|
|
117
|
-
* @const
|
|
118
|
-
* @static
|
|
119
|
-
*/
|
|
120
|
-
static get namespace() {
|
|
121
|
-
return "next2d.filters.ConvolutionFilter";
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @description 指定されたオブジェクトのストリングを返します。
|
|
125
|
-
* Returns the string representation of the specified object.
|
|
126
|
-
*
|
|
127
|
-
* @return {string}
|
|
128
|
-
* @default [object ConvolutionFilter]
|
|
129
|
-
* @method
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
132
|
-
toString() {
|
|
133
|
-
return "[object ConvolutionFilter]";
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @description 指定されたオブジェクトの空間名を返します。
|
|
137
|
-
* Returns the space name of the specified object.
|
|
138
|
-
*
|
|
139
|
-
* @return {string}
|
|
140
|
-
* @default next2d.filters.ConvolutionFilter
|
|
141
|
-
* @const
|
|
142
|
-
* @public
|
|
143
|
-
*/
|
|
144
|
-
get namespace() {
|
|
145
|
-
return "next2d.filters.ConvolutionFilter";
|
|
146
|
-
}
|
|
147
170
|
/**
|
|
148
171
|
* @description アルファ透明度の値です。
|
|
149
172
|
* The alpha transparency value for the color.
|
|
@@ -157,10 +180,11 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
157
180
|
}
|
|
158
181
|
set alpha(alpha) {
|
|
159
182
|
alpha = $clamp(+alpha, 0, 1, 0);
|
|
160
|
-
if (alpha
|
|
161
|
-
|
|
162
|
-
this._$doChanged();
|
|
183
|
+
if (alpha === this._$alpha) {
|
|
184
|
+
return;
|
|
163
185
|
}
|
|
186
|
+
this._$alpha = alpha;
|
|
187
|
+
this.$updated = true;
|
|
164
188
|
}
|
|
165
189
|
/**
|
|
166
190
|
* @description マトリックス変換の結果に加算するバイアス量です。
|
|
@@ -174,10 +198,12 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
174
198
|
return this._$bias;
|
|
175
199
|
}
|
|
176
200
|
set bias(bias) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
201
|
+
bias |= 0;
|
|
202
|
+
if (bias === this._$bias) {
|
|
203
|
+
return;
|
|
180
204
|
}
|
|
205
|
+
this._$bias = bias;
|
|
206
|
+
this.$updated = true;
|
|
181
207
|
}
|
|
182
208
|
/**
|
|
183
209
|
* @description イメージをクランプする必要があるかどうかを示します。
|
|
@@ -191,10 +217,12 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
191
217
|
return this._$clamp;
|
|
192
218
|
}
|
|
193
219
|
set clamp(clamp) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
220
|
+
clamp = !!clamp;
|
|
221
|
+
if (clamp === this._$clamp) {
|
|
222
|
+
return;
|
|
197
223
|
}
|
|
224
|
+
this._$clamp = clamp;
|
|
225
|
+
this.$updated = true;
|
|
198
226
|
}
|
|
199
227
|
/**
|
|
200
228
|
* @description ソースイメージの外にあるピクセルを置換する 16 進数のカラー値です。
|
|
@@ -208,11 +236,14 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
208
236
|
return this._$color;
|
|
209
237
|
}
|
|
210
238
|
set color(color) {
|
|
211
|
-
color = $clamp(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
239
|
+
color = $clamp(typeof color === "string"
|
|
240
|
+
? $convertColorStringToNumber(color)
|
|
241
|
+
: color, 0, 0xffffff, 0);
|
|
242
|
+
if (color === this._$color) {
|
|
243
|
+
return;
|
|
215
244
|
}
|
|
245
|
+
this._$color = color;
|
|
246
|
+
this.$updated = true;
|
|
216
247
|
}
|
|
217
248
|
/**
|
|
218
249
|
* @description マトリックス変換中に使用する除数です。
|
|
@@ -226,10 +257,12 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
226
257
|
return this._$divisor;
|
|
227
258
|
}
|
|
228
259
|
set divisor(divisor) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
260
|
+
divisor |= 0;
|
|
261
|
+
if (divisor === this._$divisor) {
|
|
262
|
+
return;
|
|
232
263
|
}
|
|
264
|
+
this._$divisor = divisor;
|
|
265
|
+
this.$updated = true;
|
|
233
266
|
}
|
|
234
267
|
/**
|
|
235
268
|
* @description マトリックス変換に使用する値の配列です。
|
|
@@ -243,12 +276,11 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
243
276
|
return this._$matrix;
|
|
244
277
|
}
|
|
245
278
|
set matrix(matrix) {
|
|
246
|
-
if (
|
|
247
|
-
|
|
279
|
+
if (this._$matrix === matrix) {
|
|
280
|
+
return;
|
|
248
281
|
}
|
|
249
|
-
|
|
250
|
-
this
|
|
251
|
-
this._$doChanged();
|
|
282
|
+
this._$matrix = matrix;
|
|
283
|
+
this.$updated = true;
|
|
252
284
|
}
|
|
253
285
|
/**
|
|
254
286
|
* @description マトリックスの x 次元 (マトリックスの列数) です。
|
|
@@ -263,10 +295,11 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
263
295
|
}
|
|
264
296
|
set matrixX(matrix_x) {
|
|
265
297
|
matrix_x = $clamp(matrix_x | 0, 0, 15, 0) | 0;
|
|
266
|
-
if (matrix_x
|
|
267
|
-
|
|
268
|
-
this._$doChanged();
|
|
298
|
+
if (matrix_x === this._$matrixX) {
|
|
299
|
+
return;
|
|
269
300
|
}
|
|
301
|
+
this._$matrixX = matrix_x;
|
|
302
|
+
this.$updated = true;
|
|
270
303
|
}
|
|
271
304
|
/**
|
|
272
305
|
* @description マトリックスの y 次元(マトリックスの行数)です。
|
|
@@ -281,10 +314,11 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
281
314
|
}
|
|
282
315
|
set matrixY(matrix_y) {
|
|
283
316
|
matrix_y = $clamp(matrix_y | 0, 0, 15, 0) | 0;
|
|
284
|
-
if (matrix_y
|
|
285
|
-
|
|
286
|
-
this._$doChanged();
|
|
317
|
+
if (matrix_y === this._$matrixY) {
|
|
318
|
+
return;
|
|
287
319
|
}
|
|
320
|
+
this._$matrixY = matrix_y;
|
|
321
|
+
this.$updated = true;
|
|
288
322
|
}
|
|
289
323
|
/**
|
|
290
324
|
* @description アルファチャンネルがフィルター効果なしで維持されるかどうか、またはカラーチャンネルだけではなく
|
|
@@ -300,10 +334,12 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
300
334
|
return this._$preserveAlpha;
|
|
301
335
|
}
|
|
302
336
|
set preserveAlpha(preserve_alpha) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
337
|
+
preserve_alpha = !!preserve_alpha;
|
|
338
|
+
if (preserve_alpha === this._$preserveAlpha) {
|
|
339
|
+
return;
|
|
306
340
|
}
|
|
341
|
+
this._$preserveAlpha = preserve_alpha;
|
|
342
|
+
this.$updated = true;
|
|
307
343
|
}
|
|
308
344
|
/**
|
|
309
345
|
* @description オブジェクトのコピーを返します。
|
|
@@ -317,50 +353,36 @@ export class ConvolutionFilter extends BitmapFilter {
|
|
|
317
353
|
return new ConvolutionFilter(this._$matrixX, this._$matrixY, this._$matrix ? this._$matrix.slice() : null, this._$divisor, this._$bias, this._$preserveAlpha, this._$clamp, this._$color, this._$alpha);
|
|
318
354
|
}
|
|
319
355
|
/**
|
|
356
|
+
* @description 設定されたフィルターの値を配列で返します。
|
|
357
|
+
* Returns the value of the specified filter as an array.
|
|
358
|
+
*
|
|
320
359
|
* @return {array}
|
|
321
360
|
* @method
|
|
322
361
|
* @public
|
|
323
362
|
*/
|
|
324
|
-
|
|
325
|
-
return
|
|
363
|
+
toArray() {
|
|
364
|
+
return convolutionFilterToArrayService(this);
|
|
326
365
|
}
|
|
327
366
|
/**
|
|
328
|
-
* @
|
|
329
|
-
*
|
|
367
|
+
* @description 設定されたフィルターの値を数値配列で返します。
|
|
368
|
+
* Returns the value of the specified filter as a number array.
|
|
369
|
+
*
|
|
370
|
+
* @return {Float32Array}
|
|
330
371
|
* @method
|
|
331
|
-
* @
|
|
372
|
+
* @public
|
|
332
373
|
*/
|
|
333
|
-
|
|
334
|
-
return
|
|
374
|
+
toNumberArray() {
|
|
375
|
+
return convolutionFilterToNumberArrayService(this);
|
|
335
376
|
}
|
|
336
377
|
/**
|
|
378
|
+
* @description フィルターを適用できるかどうかを返します。
|
|
379
|
+
* Returns whether the filter can be applied.
|
|
380
|
+
*
|
|
337
381
|
* @return {boolean}
|
|
338
382
|
* @method
|
|
339
|
-
* @
|
|
340
|
-
*/
|
|
341
|
-
_$canApply() {
|
|
342
|
-
return this._$matrix !== null
|
|
343
|
-
&& this._$matrixX * this._$matrixY === this._$matrix.length;
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* @param {CanvasToWebGLContext} context
|
|
347
|
-
* @return {WebGLTexture}
|
|
348
|
-
* @method
|
|
349
|
-
* @private
|
|
383
|
+
* @public
|
|
350
384
|
*/
|
|
351
|
-
|
|
352
|
-
this
|
|
353
|
-
const manager = context.frameBuffer;
|
|
354
|
-
const currentAttachment = manager.currentAttachment;
|
|
355
|
-
// reset
|
|
356
|
-
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
357
|
-
const texture = manager
|
|
358
|
-
.getTextureFromCurrentAttachment();
|
|
359
|
-
if (!this._$canApply() || !this._$matrix) {
|
|
360
|
-
return texture;
|
|
361
|
-
}
|
|
362
|
-
context._$applyConvolutionFilter(texture, this._$matrixX, this._$matrixY, this._$matrix, this._$divisor, this._$bias, this._$preserveAlpha, this._$clamp, $intToR(this._$color, this._$alpha, false), $intToG(this._$color, this._$alpha, false), $intToB(this._$color, this._$alpha, false), this._$alpha);
|
|
363
|
-
manager.releaseAttachment(currentAttachment, true);
|
|
364
|
-
return manager.getTextureFromCurrentAttachment();
|
|
385
|
+
canApplyFilter() {
|
|
386
|
+
return convolutionFilterCanApplyFilterService(this);
|
|
365
387
|
}
|
|
366
388
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DisplacementMapFilter } from "../../DisplacementMapFilter";
|
|
2
|
+
/**
|
|
3
|
+
* @description フィルターを適用できるかどうかを返します。
|
|
4
|
+
* Returns whether the filter can be applied.
|
|
5
|
+
*
|
|
6
|
+
* @param {DisplacementMapFilter} displacement_map_filter
|
|
7
|
+
* @return {boolean}
|
|
8
|
+
* @method
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
export declare const execute: (displacement_map_filter: DisplacementMapFilter) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description フィルターを適用できるかどうかを返します。
|
|
3
|
+
* Returns whether the filter can be applied.
|
|
4
|
+
*
|
|
5
|
+
* @param {DisplacementMapFilter} displacement_map_filter
|
|
6
|
+
* @return {boolean}
|
|
7
|
+
* @method
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export const execute = (displacement_map_filter) => {
|
|
11
|
+
return displacement_map_filter.bitmapBuffer !== null
|
|
12
|
+
&& displacement_map_filter.componentX > 0
|
|
13
|
+
&& displacement_map_filter.componentY > 0
|
|
14
|
+
&& displacement_map_filter.scaleX !== 0
|
|
15
|
+
&& displacement_map_filter.scaleY !== 0;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DisplacementMapFilter } from "../../DisplacementMapFilter";
|
|
2
|
+
/**
|
|
3
|
+
* @description フィルターの設定値を配列で返却します。
|
|
4
|
+
* Returns an array of filter settings.
|
|
5
|
+
*
|
|
6
|
+
* @param {DisplacementMapFilter} displacement_map_filter
|
|
7
|
+
* @return {Array<number | string | number[] | null>}
|
|
8
|
+
* @method
|
|
9
|
+
* @protected
|
|
10
|
+
*/
|
|
11
|
+
export declare const execute: (displacement_map_filter: DisplacementMapFilter) => Array<number | string | number[] | null>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description フィルターの設定値を配列で返却します。
|
|
3
|
+
* Returns an array of filter settings.
|
|
4
|
+
*
|
|
5
|
+
* @param {DisplacementMapFilter} displacement_map_filter
|
|
6
|
+
* @return {Array<number | string | number[] | null>}
|
|
7
|
+
* @method
|
|
8
|
+
* @protected
|
|
9
|
+
*/
|
|
10
|
+
export const execute = (displacement_map_filter) => {
|
|
11
|
+
return [
|
|
12
|
+
displacement_map_filter.$filterType,
|
|
13
|
+
displacement_map_filter.bitmapBuffer
|
|
14
|
+
? Array.from(displacement_map_filter.bitmapBuffer)
|
|
15
|
+
: null,
|
|
16
|
+
displacement_map_filter.bitmapWidth,
|
|
17
|
+
displacement_map_filter.bitmapHeight,
|
|
18
|
+
displacement_map_filter.mapPointX,
|
|
19
|
+
displacement_map_filter.mapPointY,
|
|
20
|
+
displacement_map_filter.componentX,
|
|
21
|
+
displacement_map_filter.componentY,
|
|
22
|
+
displacement_map_filter.scaleX,
|
|
23
|
+
displacement_map_filter.scaleY,
|
|
24
|
+
displacement_map_filter.mode,
|
|
25
|
+
displacement_map_filter.color,
|
|
26
|
+
displacement_map_filter.alpha
|
|
27
|
+
];
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DisplacementMapFilter } from "../../DisplacementMapFilter";
|
|
2
|
+
/**
|
|
3
|
+
* @description フィルターの設定値を数値配列で返却します。
|
|
4
|
+
* Returns a numeric array of filter settings.
|
|
5
|
+
*
|
|
6
|
+
* @param {DisplacementMapFilter} displacement_map_filter
|
|
7
|
+
* @return {Float32Array}
|
|
8
|
+
* @method
|
|
9
|
+
* @protected
|
|
10
|
+
*/
|
|
11
|
+
export declare const execute: (displacement_map_filter: DisplacementMapFilter) => Float32Array;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description フィルターの設定値を数値配列で返却します。
|
|
3
|
+
* Returns a numeric array of filter settings.
|
|
4
|
+
*
|
|
5
|
+
* @param {DisplacementMapFilter} displacement_map_filter
|
|
6
|
+
* @return {Float32Array}
|
|
7
|
+
* @method
|
|
8
|
+
* @protected
|
|
9
|
+
*/
|
|
10
|
+
export const execute = (displacement_map_filter) => {
|
|
11
|
+
let mode = 2;
|
|
12
|
+
switch (displacement_map_filter.mode) {
|
|
13
|
+
case "clamp":
|
|
14
|
+
mode = 0;
|
|
15
|
+
break;
|
|
16
|
+
case "color":
|
|
17
|
+
mode = 1;
|
|
18
|
+
break;
|
|
19
|
+
case "wrap":
|
|
20
|
+
mode = 2;
|
|
21
|
+
break;
|
|
22
|
+
case "ignore":
|
|
23
|
+
mode = 3;
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
mode = 2;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
const buffer = displacement_map_filter.bitmapBuffer || new Uint8Array();
|
|
30
|
+
const array = [displacement_map_filter.$filterType, buffer.length];
|
|
31
|
+
for (let idx = 0; idx < buffer.length; idx += 4096) {
|
|
32
|
+
array.push(...buffer.subarray(idx, idx + 4096));
|
|
33
|
+
}
|
|
34
|
+
array.push(displacement_map_filter.bitmapWidth, displacement_map_filter.bitmapHeight, displacement_map_filter.mapPointX, displacement_map_filter.mapPointY, displacement_map_filter.componentX, displacement_map_filter.componentY, displacement_map_filter.scaleX, displacement_map_filter.scaleY, mode, displacement_map_filter.color, displacement_map_filter.alpha);
|
|
35
|
+
return new Float32Array(array);
|
|
36
|
+
};
|