@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.
Files changed (118) hide show
  1. package/package.json +8 -20
  2. package/src/BevelFilter/service/BevelFilterCanApplyFilterService.d.ts +11 -0
  3. package/src/BevelFilter/service/BevelFilterCanApplyFilterService.js +16 -0
  4. package/src/BevelFilter/service/BevelFilterToArrayService.d.ts +11 -0
  5. package/src/BevelFilter/service/BevelFilterToArrayService.js +26 -0
  6. package/src/BevelFilter/service/BevelFilterToNumberArrayService.d.ts +11 -0
  7. package/src/BevelFilter/service/BevelFilterToNumberArrayService.js +27 -0
  8. package/src/BevelFilter/usecase/BevelFilterGetBoundsUseCase.d.ts +10 -0
  9. package/src/BevelFilter/usecase/BevelFilterGetBoundsUseCase.js +29 -0
  10. package/{dist → src}/BevelFilter.d.ts +117 -84
  11. package/src/BevelFilter.js +513 -0
  12. package/src/BitmapFilter.d.ts +50 -0
  13. package/src/BitmapFilter.js +61 -0
  14. package/src/BlurFilter/service/BlurFilterCanApplyFilterService.d.ts +16 -0
  15. package/src/BlurFilter/service/BlurFilterCanApplyFilterService.js +12 -0
  16. package/src/BlurFilter/service/BlurFilterToArrayService.d.ts +11 -0
  17. package/src/BlurFilter/service/BlurFilterToArrayService.js +17 -0
  18. package/src/BlurFilter/service/BlurFilterToNumberArrayService.d.ts +11 -0
  19. package/src/BlurFilter/service/BlurFilterToNumberArrayService.js +17 -0
  20. package/src/BlurFilter/usecase/BlurFilterGetBoundsUseCase.d.ts +17 -0
  21. package/src/BlurFilter/usecase/BlurFilterGetBoundsUseCase.js +29 -0
  22. package/src/BlurFilter.d.ts +142 -0
  23. package/src/BlurFilter.js +213 -0
  24. package/src/ColorMatrixFilter/service/ColorMatrixFilterToArrayService.d.ts +11 -0
  25. package/src/ColorMatrixFilter/service/ColorMatrixFilterToArrayService.js +15 -0
  26. package/src/ColorMatrixFilter/service/ColorMatrixFilterToNumberArrayService.d.ts +11 -0
  27. package/src/ColorMatrixFilter/service/ColorMatrixFilterToNumberArrayService.js +15 -0
  28. package/src/ColorMatrixFilter.d.ts +78 -0
  29. package/src/ColorMatrixFilter.js +129 -0
  30. package/src/ConvolutionFilter/service/ConvolutionFilterCanApplyFilterService.d.ts +11 -0
  31. package/src/ConvolutionFilter/service/ConvolutionFilterCanApplyFilterService.js +13 -0
  32. package/src/ConvolutionFilter/service/ConvolutionFilterToArrayService.d.ts +11 -0
  33. package/src/ConvolutionFilter/service/ConvolutionFilterToArrayService.js +23 -0
  34. package/src/ConvolutionFilter/service/ConvolutionFilterToNumberArrayService.d.ts +11 -0
  35. package/src/ConvolutionFilter/service/ConvolutionFilterToNumberArrayService.js +24 -0
  36. package/{dist → src}/ConvolutionFilter.d.ts +75 -63
  37. package/{dist → src}/ConvolutionFilter.js +148 -126
  38. package/src/DisplacementMapFilter/service/DisplacementMapFilterCanApplyFilterService.d.ts +11 -0
  39. package/src/DisplacementMapFilter/service/DisplacementMapFilterCanApplyFilterService.js +16 -0
  40. package/src/DisplacementMapFilter/service/DisplacementMapFilterToArrayService.d.ts +11 -0
  41. package/src/DisplacementMapFilter/service/DisplacementMapFilterToArrayService.js +28 -0
  42. package/src/DisplacementMapFilter/service/DisplacementMapFilterToNumberArrayService.d.ts +11 -0
  43. package/src/DisplacementMapFilter/service/DisplacementMapFilterToNumberArrayService.js +36 -0
  44. package/src/DisplacementMapFilter.d.ts +274 -0
  45. package/src/DisplacementMapFilter.js +481 -0
  46. package/src/DropShadowFilter/service/DropShadowFilterCanApplyFilterService.d.ts +11 -0
  47. package/src/DropShadowFilter/service/DropShadowFilterCanApplyFilterService.js +16 -0
  48. package/src/DropShadowFilter/service/DropShadowFilterToArrayService.d.ts +11 -0
  49. package/src/DropShadowFilter/service/DropShadowFilterToArrayService.js +25 -0
  50. package/src/DropShadowFilter/service/DropShadowFilterToNumberArrayService.d.ts +11 -0
  51. package/src/DropShadowFilter/service/DropShadowFilterToNumberArrayService.js +25 -0
  52. package/src/DropShadowFilter/usecase/DropShadowFilterGetBoundsUseCase.d.ts +10 -0
  53. package/src/DropShadowFilter/usecase/DropShadowFilterGetBoundsUseCase.js +33 -0
  54. package/{dist → src}/DropShadowFilter.d.ts +98 -73
  55. package/src/DropShadowFilter.js +466 -0
  56. package/src/FilterUtil.d.ts +36 -0
  57. package/src/FilterUtil.js +60 -0
  58. package/src/GlowFilter/service/GlowFilterCanApplyFilterService.d.ts +11 -0
  59. package/src/GlowFilter/service/GlowFilterCanApplyFilterService.js +16 -0
  60. package/src/GlowFilter/service/GlowFilterToArrayService.d.ts +11 -0
  61. package/src/GlowFilter/service/GlowFilterToArrayService.js +22 -0
  62. package/src/GlowFilter/service/GlowFilterToNumberArrayService.d.ts +11 -0
  63. package/src/GlowFilter/service/GlowFilterToNumberArrayService.js +22 -0
  64. package/src/GlowFilter/usecase/GlowFilterGetBoundsUseCase.d.ts +10 -0
  65. package/src/GlowFilter/usecase/GlowFilterGetBoundsUseCase.js +19 -0
  66. package/{dist → src}/GlowFilter.d.ts +84 -74
  67. package/src/GlowFilter.js +367 -0
  68. package/src/GradientBevelFilter/service/GradientBevelFilterCanApplyFilterService.d.ts +11 -0
  69. package/src/GradientBevelFilter/service/GradientBevelFilterCanApplyFilterService.js +19 -0
  70. package/src/GradientBevelFilter/service/GradientBevelFilterToArrayService.d.ts +11 -0
  71. package/src/GradientBevelFilter/service/GradientBevelFilterToArrayService.js +25 -0
  72. package/src/GradientBevelFilter/service/GradientBevelFilterToNumberArrayService.d.ts +11 -0
  73. package/src/GradientBevelFilter/service/GradientBevelFilterToNumberArrayService.js +29 -0
  74. package/src/GradientBevelFilter/usecase/GradientBevelFilterGetBoundsUseCase.d.ts +10 -0
  75. package/src/GradientBevelFilter/usecase/GradientBevelFilterGetBoundsUseCase.js +29 -0
  76. package/{dist → src}/GradientBevelFilter.d.ts +102 -77
  77. package/src/GradientBevelFilter.js +482 -0
  78. package/src/GradientGlowFilter/service/GradientGlowFilterCanApplyFilterService.d.ts +11 -0
  79. package/src/GradientGlowFilter/service/GradientGlowFilterCanApplyFilterService.js +19 -0
  80. package/src/GradientGlowFilter/service/GradientGlowFilterToArrayService.d.ts +11 -0
  81. package/src/GradientGlowFilter/service/GradientGlowFilterToArrayService.js +25 -0
  82. package/src/GradientGlowFilter/service/GradientGlowFilterToNumberArrayService.d.ts +11 -0
  83. package/src/GradientGlowFilter/service/GradientGlowFilterToNumberArrayService.js +29 -0
  84. package/src/GradientGlowFilter/usecase/GradientGlowFilterGetBoundsUseCase.d.ts +10 -0
  85. package/src/GradientGlowFilter/usecase/GradientGlowFilterGetBoundsUseCase.js +19 -0
  86. package/{dist → src}/GradientGlowFilter.d.ts +102 -78
  87. package/src/GradientGlowFilter.js +480 -0
  88. package/src/interface/IBitmapDataChannel.d.ts +1 -0
  89. package/src/interface/IBitmapFilterType.d.ts +1 -0
  90. package/{dist/interface/BoundsImpl.d.ts → src/interface/IBounds.d.ts} +1 -1
  91. package/src/interface/IDisplacementMapFilterMode.d.ts +1 -0
  92. package/src/interface/IFilterQuality.d.ts +1 -0
  93. package/dist/BevelFilter.js +0 -504
  94. package/dist/BitmapFilter.d.ts +0 -75
  95. package/dist/BitmapFilter.js +0 -95
  96. package/dist/BlurFilter.d.ts +0 -150
  97. package/dist/BlurFilter.js +0 -375
  98. package/dist/ColorMatrixFilter.d.ts +0 -116
  99. package/dist/ColorMatrixFilter.js +0 -179
  100. package/dist/DisplacementMapFilter.d.ts +0 -211
  101. package/dist/DisplacementMapFilter.js +0 -368
  102. package/dist/DropShadowFilter.js +0 -475
  103. package/dist/GlowFilter.js +0 -356
  104. package/dist/GradientBevelFilter.js +0 -490
  105. package/dist/GradientGlowFilter.js +0 -480
  106. package/dist/interface/AttachmentImpl.d.ts +0 -11
  107. package/dist/interface/BitmapDataChannelImpl.d.ts +0 -1
  108. package/dist/interface/BitmapFilterTypeImpl.d.ts +0 -1
  109. package/dist/interface/DisplacementMapFilterModeImpl.d.ts +0 -1
  110. package/dist/interface/FilterQualityImpl.d.ts +0 -1
  111. package/dist/interface/FilterQualityImpl.js +0 -1
  112. /package/{dist → src}/index.d.ts +0 -0
  113. /package/{dist → src}/index.js +0 -0
  114. /package/{dist/interface/AttachmentImpl.js → src/interface/IBitmapDataChannel.js} +0 -0
  115. /package/{dist/interface/BitmapDataChannelImpl.js → src/interface/IBitmapFilterType.js} +0 -0
  116. /package/{dist/interface/BitmapFilterTypeImpl.js → src/interface/IBounds.js} +0 -0
  117. /package/{dist/interface/BoundsImpl.js → src/interface/IDisplacementMapFilterMode.js} +0 -0
  118. /package/{dist/interface/DisplacementMapFilterModeImpl.js → src/interface/IFilterQuality.js} +0 -0
@@ -1,356 +0,0 @@
1
- import { BitmapFilter } from "./BitmapFilter";
2
- import { BlurFilter } from "./BlurFilter";
3
- import { $intToB, $intToG, $intToR, $clamp, $toColorInt, $getArray, $getBoundsObject } from "@next2d/share";
4
- /**
5
- * GlowFilter クラスを使用すると、表示オブジェクトにグロー効果を適用できます。
6
- * グローのスタイルには複数のオプションがあり、内側グロー、外側グロー、ノックアウトモードなどがあります。
7
- * グローフィルターは、distance プロパティと angle プロパティを 0 に設定したドロップシャドウフィルターによく似ています。
8
- *
9
- * The GlowFilter class lets you apply a glow effect to display objects.
10
- * You have several options for the style of the glow, including inner or outer glow and knockout mode.
11
- * The glow filter is similar to the drop shadow filter with the distance
12
- * and angle properties of the drop shadow filter set to 0.
13
- *
14
- * @class
15
- * @memberOf next2d.filters
16
- * @extends BitmapFilter
17
- */
18
- export class GlowFilter extends BitmapFilter {
19
- /**
20
- * @param {number} [color=0xFF0000]
21
- * @param {number} [alpha=1]
22
- * @param {number} [blur_x=6]
23
- * @param {number} [blur_y=6]
24
- * @param {number} [strength=2]
25
- * @param {int} [quality=1]
26
- * @param {boolean} [inner=false]
27
- * @param {boolean} [knockout=false]
28
- *
29
- * @constructor
30
- * @public
31
- */
32
- constructor(color = 0, alpha = 1, blur_x = 4, blur_y = 4, strength = 1, quality = 1, inner = false, knockout = false) {
33
- super();
34
- /**
35
- * @type {BlurFilter}
36
- * @default BlurFilter
37
- * @private
38
- */
39
- this._$blurFilter = new BlurFilter(blur_x, blur_y, quality);
40
- /**
41
- * @type {number}
42
- * @default 0
43
- * @private
44
- */
45
- this._$color = 0;
46
- /**
47
- * @type {number}
48
- * @default 1
49
- * @private
50
- */
51
- this._$alpha = 1;
52
- /**
53
- * @type {number}
54
- * @default 1
55
- * @private
56
- */
57
- this._$strength = 1;
58
- /**
59
- * @type {boolean}
60
- * @default false
61
- * @private
62
- */
63
- this._$inner = false;
64
- /**
65
- * @type {boolean}
66
- * @default false
67
- * @private
68
- */
69
- this._$knockout = false;
70
- // setup
71
- this.color = color;
72
- this.alpha = alpha;
73
- this.strength = strength;
74
- this.inner = inner;
75
- this.knockout = knockout;
76
- }
77
- /**
78
- * @description 指定されたクラスのストリングを返します。
79
- * Returns the string representation of the specified class.
80
- *
81
- * @return {string}
82
- * @default [class GlowFilter]
83
- * @method
84
- * @static
85
- */
86
- static toString() {
87
- return "[class GlowFilter]";
88
- }
89
- /**
90
- * @description 指定されたクラスの空間名を返します。
91
- * Returns the space name of the specified class.
92
- *
93
- * @return {string}
94
- * @default next2d.filters.GlowFilter
95
- * @const
96
- * @static
97
- */
98
- static get namespace() {
99
- return "next2d.filters.GlowFilter";
100
- }
101
- /**
102
- * @description 指定されたオブジェクトのストリングを返します。
103
- * Returns the string representation of the specified object.
104
- *
105
- * @return {string}
106
- * @default [object GlowFilter]
107
- * @method
108
- * @public
109
- */
110
- toString() {
111
- return "[object GlowFilter]";
112
- }
113
- /**
114
- * @description 指定されたオブジェクトの空間名を返します。
115
- * Returns the space name of the specified object.
116
- *
117
- * @return {string}
118
- * @default next2d.filters.GlowFilter
119
- * @const
120
- * @public
121
- */
122
- get namespace() {
123
- return "next2d.filters.GlowFilter";
124
- }
125
- /**
126
- * @description アルファ透明度の値です。
127
- * The alpha transparency value for the color.
128
- *
129
- * @member {number}
130
- * @default 1
131
- * @public
132
- */
133
- get alpha() {
134
- return this._$alpha;
135
- }
136
- set alpha(alpha) {
137
- alpha = $clamp(+alpha, 0, 1, 0);
138
- if (alpha !== this._$alpha) {
139
- this._$alpha = alpha;
140
- this._$doChanged();
141
- }
142
- }
143
- /**
144
- * @description 水平方向のぼかし量。
145
- * The amount of horizontal blur.
146
- *
147
- * @member {number}
148
- * @default 4
149
- * @public
150
- */
151
- get blurX() {
152
- return this._$blurFilter.blurX;
153
- }
154
- set blurX(blur_x) {
155
- this._$blurFilter.blurX = blur_x;
156
- }
157
- /**
158
- * @description 垂直方向のぼかし量。
159
- * The amount of vertical blur.
160
- *
161
- * @member {number}
162
- * @default 4
163
- * @public
164
- */
165
- get blurY() {
166
- return this._$blurFilter.blurY;
167
- }
168
- set blurY(blur_y) {
169
- this._$blurFilter.blurY = blur_y;
170
- }
171
- /**
172
- * @description グローのカラー
173
- * The color of the glow.
174
- *
175
- * @member {number}
176
- * @default 4
177
- * @public
178
- */
179
- get color() {
180
- return this._$color;
181
- }
182
- set color(color) {
183
- color = $clamp($toColorInt(color), 0, 0xffffff, 4);
184
- if (color !== this._$color) {
185
- this._$color = color;
186
- this._$doChanged();
187
- }
188
- }
189
- /**
190
- * @description グローが内側グローであるかどうか
191
- * Specifies whether the glow is an inner glow.
192
- *
193
- * @member {boolean}
194
- * @default true
195
- * @public
196
- */
197
- get inner() {
198
- return this._$inner;
199
- }
200
- set inner(inner) {
201
- if (inner !== this._$inner) {
202
- this._$inner = !!inner;
203
- this._$doChanged();
204
- }
205
- }
206
- /**
207
- * @description オブジェクトにノックアウト効果を適用するかどうか
208
- * Specifies whether the object has a knockout effect.
209
- *
210
- * @member {boolean}
211
- * @default true
212
- * @public
213
- */
214
- get knockout() {
215
- return this._$knockout;
216
- }
217
- set knockout(knockout) {
218
- if (knockout !== this._$knockout) {
219
- this._$knockout = !!knockout;
220
- this._$doChanged();
221
- }
222
- }
223
- /**
224
- * @description ぼかしの実行回数です。
225
- * The number of times to perform the blur.
226
- *
227
- * @member {number}
228
- * @default 1
229
- * @public
230
- */
231
- get quality() {
232
- return this._$blurFilter.quality;
233
- }
234
- set quality(quality) {
235
- this._$blurFilter.quality = quality;
236
- }
237
- /**
238
- * @description インプリントの強さまたは広がりです。
239
- * The strength of the imprint or spread.
240
- *
241
- * @member {number}
242
- * @default 1
243
- * @public
244
- */
245
- get strength() {
246
- return this._$strength;
247
- }
248
- set strength(strength) {
249
- strength = $clamp(strength | 0, 0, 255, 0);
250
- if (strength !== this._$strength) {
251
- this._$strength = strength;
252
- this._$doChanged();
253
- }
254
- }
255
- /**
256
- * @description オブジェクトのコピーを返します。
257
- * Returns a copy of this filter object.
258
- *
259
- * @return {GlowFilter}
260
- * @method
261
- * @public
262
- */
263
- clone() {
264
- return new GlowFilter(this._$color, this._$alpha, this._$blurFilter.blurX, this._$blurFilter.blurY, this._$strength, this._$blurFilter.quality, this._$inner, this._$knockout);
265
- }
266
- /**
267
- * @return {array}
268
- * @method
269
- * @public
270
- */
271
- _$toArray() {
272
- return $getArray(6, this._$color, this._$alpha, this._$blurFilter.blurX, this._$blurFilter.blurY, this._$strength, this._$blurFilter.quality, this._$inner, this._$knockout);
273
- }
274
- /**
275
- * @return {boolean}
276
- * @method
277
- * @public
278
- */
279
- _$isUpdated() {
280
- return this._$updated || this._$blurFilter._$isUpdated();
281
- }
282
- /**
283
- * @param {object} bounds
284
- * @param {number} [x_scale=0]
285
- * @param {number} [y_scale=0]
286
- * @return {object}
287
- * @method
288
- * @private
289
- */
290
- _$generateFilterRect(bounds, x_scale = 0, y_scale = 0) {
291
- const clone = $getBoundsObject(bounds.xMin, bounds.xMax, bounds.yMin, bounds.yMax);
292
- if (!this._$canApply()) {
293
- return clone;
294
- }
295
- return this
296
- ._$blurFilter
297
- ._$generateFilterRect(clone, x_scale, y_scale);
298
- }
299
- /**
300
- * @return {boolean}
301
- * @method
302
- * @private
303
- */
304
- _$canApply() {
305
- return this._$alpha > 0
306
- && this._$strength > 0
307
- && this._$blurFilter._$canApply();
308
- }
309
- /**
310
- * @param {CanvasToWebGLContext} context
311
- * @param {array} matrix
312
- * @return {WebGLTexture}
313
- * @method
314
- * @private
315
- */
316
- _$applyFilter(context, matrix) {
317
- const manager = context.frameBuffer;
318
- const currentAttachment = manager.currentAttachment;
319
- if (!currentAttachment) {
320
- throw new Error("the current attachment is null.");
321
- }
322
- this._$updated = false;
323
- // reset
324
- context.setTransform(1, 0, 0, 1, 0, 0);
325
- if (!this._$canApply()) {
326
- return manager
327
- .getTextureFromCurrentAttachment();
328
- }
329
- const baseWidth = currentAttachment.width;
330
- const baseHeight = currentAttachment.height;
331
- const baseOffsetX = context._$offsetX;
332
- const baseOffsetY = context._$offsetY;
333
- const blurTexture = this
334
- ._$blurFilter
335
- ._$applyFilter(context, matrix, false);
336
- const blurWidth = blurTexture.width;
337
- const blurHeight = blurTexture.height;
338
- const blurOffsetX = context._$offsetX;
339
- const blurOffsetY = context._$offsetY;
340
- const width = this._$inner ? baseWidth : blurWidth;
341
- const height = this._$inner ? baseHeight : blurHeight;
342
- const baseTextureX = this._$inner ? 0 : blurOffsetX - baseOffsetX;
343
- const baseTextureY = this._$inner ? 0 : blurOffsetY - baseOffsetY;
344
- const blurTextureX = this._$inner ? -blurOffsetX : 0;
345
- const blurTextureY = this._$inner ? -blurOffsetY : 0;
346
- const type = this._$inner
347
- ? "inner"
348
- : "outer";
349
- context._$bind(currentAttachment);
350
- context._$applyBitmapFilter(blurTexture, width, height, baseWidth, baseHeight, baseTextureX, baseTextureY, blurWidth, blurHeight, blurTextureX, blurTextureY, true, type, this._$knockout, this._$strength, null, null, null, $intToR(this._$color, this._$alpha, true), $intToG(this._$color, this._$alpha, true), $intToB(this._$color, this._$alpha, true), this._$alpha, 0, 0, 0, 0);
351
- context._$offsetX = baseOffsetX + baseTextureX;
352
- context._$offsetY = baseOffsetY + baseTextureY;
353
- manager.releaseTexture(blurTexture);
354
- return manager.getTextureFromCurrentAttachment();
355
- }
356
- }