@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,504 +0,0 @@
1
- import { BitmapFilter } from "./BitmapFilter";
2
- import { BlurFilter } from "./BlurFilter";
3
- import { $Math, $clamp, $toColorInt, $getArray, $Deg2Rad, $intToR, $intToG, $intToB, $getBoundsObject, $devicePixelRatio } from "@next2d/share";
4
- /**
5
- * BevelFilter クラスを使用すると、表示オブジェクトにベベル効果を追加できます。
6
- * ボタンなどのオブジェクトにベベル効果を適用すると 3 次元的に表現されます。
7
- * 異なるハイライトカラー、シャドウカラー、ベベルのぼかし量、ベベルの角度、ベベルの配置、
8
- * ノックアウト効果を使用して、ベベルの外観をカスタマイズできます。
9
- *
10
- * The BevelFilter class lets you add a bevel effect to display objects.
11
- * A bevel effect gives objects such as buttons a three-dimensional look.
12
- * You can customize the look of the bevel with different highlight and shadow colors,
13
- * the amount of blur on the bevel, the angle of the bevel, the placement of the bevel,
14
- * and a knockout effect.
15
- *
16
- * @class
17
- * @memberOf next2d.filters
18
- * @extends BitmapFilter
19
- */
20
- export class BevelFilter extends BitmapFilter {
21
- /**
22
- * @param {number} [distance=4]
23
- * @param {number} [angle=45]
24
- * @param {uint} [highlight_color=0xffffff]
25
- * @param {number} [highlight_alpha=1]
26
- * @param {uint} [shadow_color=0x000000]
27
- * @param {number} [shadow_alpha=1]
28
- * @param {number} [blur_x=4]
29
- * @param {number} [blur_y=4]
30
- * @param {number} [strength=1]
31
- * @param {int} [quality=1]
32
- * @param {string} [type=BitmapFilterType.INNER]
33
- * @param {boolean} [knockout=false]
34
- *
35
- * @constructor
36
- * @public
37
- */
38
- constructor(distance = 4, angle = 45, highlight_color = 0xffffff, highlight_alpha = 1, shadow_color = 0, shadow_alpha = 1, blur_x = 4, blur_y = 4, strength = 1, quality = 1, type = "inner", knockout = false) {
39
- super();
40
- /**
41
- * @type {BlurFilter}
42
- * @default BlurFilter
43
- * @private
44
- */
45
- this._$blurFilter = new BlurFilter(blur_x, blur_y, quality);
46
- /**
47
- * @type {number}
48
- * @default 4
49
- * @private
50
- */
51
- this._$distance = 4;
52
- /**
53
- * @type {number}
54
- * @default 45
55
- * @private
56
- */
57
- this._$angle = 45;
58
- /**
59
- * @type {number}
60
- * @default 0xffffff
61
- * @private
62
- */
63
- this._$highlightColor = 0xffffff;
64
- /**
65
- * @type {number}
66
- * @default 1
67
- * @private
68
- */
69
- this._$highlightAlpha = 1;
70
- /**
71
- * @type {number}
72
- * @default 0
73
- * @private
74
- */
75
- this._$shadowColor = 0;
76
- /**
77
- * @type {number}
78
- * @default 1
79
- * @private
80
- */
81
- this._$shadowAlpha = 1;
82
- /**
83
- * @type {number}
84
- * @default 1
85
- * @private
86
- */
87
- this._$strength = 1;
88
- /**
89
- * @type {string}
90
- * @default "inner"
91
- * @private
92
- */
93
- this._$type = "inner";
94
- /**
95
- * @type {boolean}
96
- * @default false
97
- * @private
98
- */
99
- this._$knockout = false;
100
- // setup
101
- this.distance = distance;
102
- this.angle = angle;
103
- this.highlightColor = highlight_color;
104
- this.highlightAlpha = highlight_alpha;
105
- this.shadowColor = shadow_color;
106
- this.shadowAlpha = shadow_alpha;
107
- this.strength = strength;
108
- this.type = type;
109
- this.knockout = knockout;
110
- }
111
- /**
112
- * @description 指定されたクラスのストリングを返します。
113
- * Returns the string representation of the specified class.
114
- *
115
- * @return {string}
116
- * @default [class BevelFilter]
117
- * @method
118
- * @static
119
- */
120
- static toString() {
121
- return "[class BevelFilter]";
122
- }
123
- /**
124
- * @description 指定されたクラスの空間名を返します。
125
- * Returns the space name of the specified class.
126
- *
127
- * @return {string}
128
- * @default next2d.filters.BevelFilter
129
- * @const
130
- * @static
131
- */
132
- static get namespace() {
133
- return "next2d.filters.BevelFilter";
134
- }
135
- /**
136
- * @description 指定されたオブジェクトのストリングを返します。
137
- * Returns the string representation of the specified object.
138
- *
139
- * @return {string}
140
- * @default [object BevelFilter]
141
- * @method
142
- * @public
143
- */
144
- toString() {
145
- return "[object BevelFilter]";
146
- }
147
- /**
148
- * @description 指定されたオブジェクトの空間名を返します。
149
- * Returns the space name of the specified object.
150
- *
151
- * @return {string}
152
- * @default next2d.filters.BevelFilter
153
- * @const
154
- * @public
155
- */
156
- get namespace() {
157
- return "next2d.filters.BevelFilter";
158
- }
159
- /**
160
- * @description シャドウの角度
161
- * The angle of the shadow.
162
- *
163
- * @member {number}
164
- * @default 45
165
- * @public
166
- */
167
- get angle() {
168
- return this._$angle;
169
- }
170
- set angle(angle) {
171
- angle %= 360;
172
- if (angle !== this._$angle) {
173
- this._$angle = $clamp(angle, -360, 360, 45);
174
- this._$doChanged();
175
- }
176
- }
177
- /**
178
- * @description 水平方向のぼかし量。
179
- * The amount of horizontal blur.
180
- *
181
- * @member {number}
182
- * @default 4
183
- * @public
184
- */
185
- get blurX() {
186
- return this._$blurFilter.blurX;
187
- }
188
- set blurX(blur_x) {
189
- this._$blurFilter.blurX = blur_x;
190
- }
191
- /**
192
- * @description 垂直方向のぼかし量。
193
- * The amount of vertical blur.
194
- *
195
- * @member {number}
196
- * @default 4
197
- * @public
198
- */
199
- get blurY() {
200
- return this._$blurFilter.blurY;
201
- }
202
- set blurY(blur_y) {
203
- this._$blurFilter.blurY = blur_y;
204
- }
205
- /**
206
- * @description シャドウのオフセット距離です。
207
- * The offset distance for the shadow, in pixels.
208
- *
209
- * @member {number}
210
- * @default 4
211
- * @public
212
- */
213
- get distance() {
214
- return this._$distance;
215
- }
216
- set distance(distance) {
217
- distance = $clamp(+distance, -255, 255, 4);
218
- if (distance !== this._$distance) {
219
- this._$distance = distance;
220
- this._$doChanged();
221
- }
222
- }
223
- /**
224
- * @description アルファ透明度の値です。
225
- * The alpha transparency value for the color.
226
- *
227
- * @member {number}
228
- * @default 1
229
- * @public
230
- */
231
- get highlightAlpha() {
232
- return this._$highlightAlpha;
233
- }
234
- set highlightAlpha(highlight_alpha) {
235
- highlight_alpha = $clamp(+highlight_alpha, 0, 1, 0);
236
- if (highlight_alpha !== this._$highlightAlpha) {
237
- this._$highlightAlpha = highlight_alpha;
238
- this._$doChanged();
239
- }
240
- }
241
- /**
242
- * @description グローのカラー
243
- * The color of the glow.
244
- *
245
- * @member {number}
246
- * @default 0xffffff
247
- * @public
248
- */
249
- get highlightColor() {
250
- return this._$highlightColor;
251
- }
252
- set highlightColor(highlight_color) {
253
- highlight_color = $clamp($toColorInt(highlight_color), 0, 0xffffff, 0xffffff);
254
- if (highlight_color !== this._$highlightColor) {
255
- this._$highlightColor = highlight_color;
256
- this._$doChanged();
257
- }
258
- }
259
- /**
260
- * @description オブジェクトにノックアウト効果を適用するかどうか
261
- * Specifies whether the object has a knockout effect.
262
- *
263
- * @member {boolean}
264
- * @default false
265
- * @public
266
- */
267
- get knockout() {
268
- return this._$knockout;
269
- }
270
- set knockout(knockout) {
271
- if (knockout !== this._$knockout) {
272
- this._$knockout = !!knockout;
273
- this._$doChanged();
274
- }
275
- }
276
- /**
277
- * @description ぼかしの実行回数です。
278
- * The number of times to perform the blur.
279
- *
280
- * @member {number}
281
- * @default 1
282
- * @public
283
- */
284
- get quality() {
285
- return this._$blurFilter.quality;
286
- }
287
- set quality(quality) {
288
- this._$blurFilter.quality = quality;
289
- }
290
- /**
291
- * @description アルファ透明度の値です。
292
- * The alpha transparency value for the color.
293
- *
294
- * @member {number}
295
- * @default 1
296
- * @public
297
- */
298
- get shadowAlpha() {
299
- return this._$shadowAlpha;
300
- }
301
- set shadowAlpha(shadow_alpha) {
302
- shadow_alpha = $clamp(+shadow_alpha, 0, 1, 0);
303
- if (shadow_alpha !== this._$shadowAlpha) {
304
- this._$shadowAlpha = shadow_alpha;
305
- this._$doChanged();
306
- }
307
- }
308
- /**
309
- * @description グローのカラー
310
- * The color of the glow.
311
- *
312
- * @member {number}
313
- * @default 0
314
- * @public
315
- */
316
- get shadowColor() {
317
- return this._$shadowColor;
318
- }
319
- set shadowColor(shadow_color) {
320
- shadow_color = $clamp($toColorInt(shadow_color), 0, 0xffffff, 0);
321
- if (shadow_color !== this._$shadowColor) {
322
- this._$shadowColor = shadow_color;
323
- this._$doChanged();
324
- }
325
- }
326
- /**
327
- * @description インプリントの強さまたは広がりです。
328
- * The strength of the imprint or spread.
329
- *
330
- * @member {number}
331
- * @default 1
332
- * @public
333
- */
334
- get strength() {
335
- return this._$strength;
336
- }
337
- set strength(strength) {
338
- strength = $clamp(strength | 0, 0, 255, 0);
339
- if (strength !== this._$strength) {
340
- this._$strength = strength;
341
- this._$doChanged();
342
- }
343
- }
344
- /**
345
- * @description オブジェクトでのベベルの配置
346
- * The placement of the bevel on the object.
347
- *
348
- * @member {string}
349
- * @default BitmapFilterType.INNER
350
- * @public
351
- */
352
- get type() {
353
- return this._$type;
354
- }
355
- set type(type) {
356
- type = `${type}`;
357
- if (type !== this._$type) {
358
- this._$type = type;
359
- this._$doChanged();
360
- }
361
- }
362
- /**
363
- * @description オブジェクトのコピーを返します。
364
- * Returns a copy of this filter object.
365
- *
366
- * @return {BevelFilter}
367
- * @method
368
- * @public
369
- */
370
- clone() {
371
- return new BevelFilter(this._$distance, this._$angle, this._$highlightColor, this._$highlightAlpha, this._$shadowColor, this._$shadowAlpha, this._$blurFilter.blurX, this._$blurFilter.blurY, this._$strength, this._$blurFilter.quality, this._$type, this._$knockout);
372
- }
373
- /**
374
- * @return {array}
375
- * @method
376
- * @public
377
- */
378
- _$toArray() {
379
- return $getArray(0, this._$distance, this._$angle, this._$highlightColor, this._$highlightAlpha, this._$shadowColor, this._$shadowAlpha, this._$blurFilter.blurX, this._$blurFilter.blurY, this._$strength, this._$blurFilter.quality, this._$type, this._$knockout);
380
- }
381
- /**
382
- * @return {boolean}
383
- * @method
384
- * @private
385
- */
386
- _$isUpdated() {
387
- return this._$updated || this._$blurFilter._$isUpdated();
388
- }
389
- /**
390
- * @param {object} bounds
391
- * @param {number} [x_scale=null]
392
- * @param {number} [y_scale=null]
393
- * @return {object}
394
- * @method
395
- * @private
396
- */
397
- _$generateFilterRect(bounds, x_scale = 0, y_scale = 0) {
398
- let clone = $getBoundsObject(bounds.xMin, bounds.xMax, bounds.yMin, bounds.yMax);
399
- if (!this._$canApply()) {
400
- return clone;
401
- }
402
- clone = this
403
- ._$blurFilter
404
- ._$generateFilterRect(clone, x_scale, y_scale);
405
- const radian = this._$angle * $Deg2Rad;
406
- let x = $Math.abs($Math.cos(radian) * this._$distance);
407
- let y = $Math.abs($Math.sin(radian) * this._$distance);
408
- if (x_scale) {
409
- x *= x_scale;
410
- }
411
- if (y_scale) {
412
- y *= y_scale;
413
- }
414
- clone.xMin = $Math.min(clone.xMin, x);
415
- if (x > 0) {
416
- clone.xMax += x;
417
- }
418
- clone.yMin = $Math.min(clone.yMin, y);
419
- if (y > 0) {
420
- clone.yMax += y;
421
- }
422
- return clone;
423
- }
424
- /**
425
- * @return {boolean}
426
- * @method
427
- * @private
428
- */
429
- _$canApply() {
430
- return this._$strength > 0
431
- && this._$distance !== 0
432
- && this._$blurFilter._$canApply();
433
- }
434
- /**
435
- * @param {CanvasToWebGLContext} context
436
- * @param {Float32Array} matrix
437
- * @return {WebGLTexture}
438
- * @private
439
- */
440
- _$applyFilter(context, matrix) {
441
- this._$updated = false;
442
- const manager = context.frameBuffer;
443
- const currentAttachment = manager.currentAttachment;
444
- if (!currentAttachment) {
445
- throw new Error("the current attachment is null.");
446
- }
447
- // reset
448
- context.setTransform(1, 0, 0, 1, 0, 0);
449
- const baseTexture = manager
450
- .getTextureFromCurrentAttachment();
451
- if (!this._$canApply()) {
452
- return baseTexture;
453
- }
454
- const baseWidth = currentAttachment.width;
455
- const baseHeight = currentAttachment.height;
456
- const baseOffsetX = context._$offsetX;
457
- const baseOffsetY = context._$offsetY;
458
- // matrix to scale
459
- let xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
460
- let yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
461
- xScale /= $devicePixelRatio;
462
- yScale /= $devicePixelRatio;
463
- xScale *= 2;
464
- yScale *= 2;
465
- // pointer
466
- const radian = this._$angle * $Deg2Rad;
467
- const x = $Math.cos(radian) * this._$distance * xScale;
468
- const y = $Math.sin(radian) * this._$distance * yScale;
469
- // highlight buffer
470
- const highlightTextureBaseAttachment = manager
471
- .createTextureAttachment(baseWidth, baseHeight);
472
- context._$bind(highlightTextureBaseAttachment);
473
- context.reset();
474
- context.drawImage(baseTexture, 0, 0, baseWidth, baseHeight);
475
- context.globalCompositeOperation = "erase";
476
- context.drawImage(baseTexture, x * 2, y * 2, baseWidth, baseHeight);
477
- const highlightTextureBase = this
478
- ._$blurFilter
479
- ._$applyFilter(context, matrix, false);
480
- const blurWidth = highlightTextureBase.width;
481
- const blurHeight = highlightTextureBase.height;
482
- const bevelWidth = $Math.ceil(blurWidth + $Math.abs(x) * 2);
483
- const bevelHeight = $Math.ceil(blurHeight + $Math.abs(y) * 2);
484
- // bevel filter buffer
485
- const isInner = this._$type === "inner";
486
- const width = isInner ? baseWidth : bevelWidth;
487
- const height = isInner ? baseHeight : bevelHeight;
488
- const absX = $Math.abs(x);
489
- const absY = $Math.abs(y);
490
- const blurOffsetX = (blurWidth - baseWidth) / 2;
491
- const blurOffsetY = (blurHeight - baseHeight) / 2;
492
- const baseTextureX = isInner ? 0 : absX + blurOffsetX;
493
- const baseTextureY = isInner ? 0 : absY + blurOffsetY;
494
- const blurTextureX = isInner ? -blurOffsetX - x : absX - x;
495
- const blurTextureY = isInner ? -blurOffsetY - y : absY - y;
496
- context._$bind(currentAttachment);
497
- manager.releaseAttachment(highlightTextureBaseAttachment, true);
498
- context._$applyBitmapFilter(highlightTextureBase, width, height, baseWidth, baseHeight, baseTextureX, baseTextureY, blurWidth, blurHeight, blurTextureX, blurTextureY, false, this._$type, this._$knockout, this._$strength, null, null, null, $intToR(this._$highlightColor, this._$highlightAlpha, true), $intToG(this._$highlightColor, this._$highlightAlpha, true), $intToB(this._$highlightColor, this._$highlightAlpha, true), this._$highlightAlpha, $intToR(this._$shadowColor, this._$shadowAlpha, true), $intToG(this._$shadowColor, this._$shadowAlpha, true), $intToB(this._$shadowColor, this._$shadowAlpha, true), this._$shadowAlpha);
499
- context._$offsetX = baseOffsetX + baseTextureX;
500
- context._$offsetY = baseOffsetY + baseTextureY;
501
- manager.releaseTexture(highlightTextureBase);
502
- return manager.getTextureFromCurrentAttachment();
503
- }
504
- }
@@ -1,75 +0,0 @@
1
- /**
2
- * BitmapFilter クラスは、すべてのイメージフィルター効果の基本クラスです。
3
- * BevelFilter、BlurFilter、ColorMatrixFilter、ConvolutionFilter、DisplacementMapFilter、DropShadowFilter、GlowFilter、GradientBevelFilter、
4
- * および GradientGlowFilter クラスはすべて、BitmapFilter クラスを継承します。
5
- * このフィルター効果は、あらゆる表示オブジェクトに適用できます。
6
- *
7
- * The BitmapFilter class is the base class for all image filter effects.
8
- * The BevelFilter, BlurFilter, ColorMatrixFilter, ConvolutionFilter, DisplacementMapFilter, DropShadowFilter, GlowFilter, GradientBevelFilter,
9
- * and GradientGlowFilter classes all extend the BitmapFilter class.
10
- * You can apply these filter effects to any display object.
11
- * You can neither directly instantiate nor extend BitmapFilter.
12
- *
13
- * @class
14
- * @memberOf next2d.filters
15
- */
16
- export declare class BitmapFilter {
17
- protected _$updated: boolean;
18
- /**
19
- * @constructor
20
- * @public
21
- */
22
- constructor();
23
- /**
24
- * @description 指定されたクラスのストリングを返します。
25
- * Returns the string representation of the specified class.
26
- *
27
- * @return {string}
28
- * @default [class BitmapFilter]
29
- * @method
30
- * @static
31
- */
32
- static toString(): string;
33
- /**
34
- * @description 指定されたクラスの空間名を返します。
35
- * Returns the space name of the specified class.
36
- *
37
- * @return {string}
38
- * @default next2d.filters.BitmapFilter
39
- * @const
40
- * @static
41
- */
42
- static get namespace(): string;
43
- /**
44
- * @description 指定されたオブジェクトのストリングを返します。
45
- * Returns the string representation of the specified object.
46
- *
47
- * @return {string}
48
- * @default [object BitmapFilter]
49
- * @method
50
- * @public
51
- */
52
- toString(): string;
53
- /**
54
- * @description 指定されたオブジェクトの空間名を返します。
55
- * Returns the space name of the specified object.
56
- *
57
- * @return {string}
58
- * @default next2d.filters.BitmapFilter
59
- * @const
60
- * @public
61
- */
62
- get namespace(): string;
63
- /**
64
- * @return {boolean}
65
- * @method
66
- * @private
67
- */
68
- _$isUpdated(): boolean;
69
- /**
70
- * @return {void}
71
- * @method
72
- * @private
73
- */
74
- _$doChanged(): void;
75
- }
@@ -1,95 +0,0 @@
1
- import { $doUpdated } from "@next2d/share";
2
- /**
3
- * BitmapFilter クラスは、すべてのイメージフィルター効果の基本クラスです。
4
- * BevelFilter、BlurFilter、ColorMatrixFilter、ConvolutionFilter、DisplacementMapFilter、DropShadowFilter、GlowFilter、GradientBevelFilter、
5
- * および GradientGlowFilter クラスはすべて、BitmapFilter クラスを継承します。
6
- * このフィルター効果は、あらゆる表示オブジェクトに適用できます。
7
- *
8
- * The BitmapFilter class is the base class for all image filter effects.
9
- * The BevelFilter, BlurFilter, ColorMatrixFilter, ConvolutionFilter, DisplacementMapFilter, DropShadowFilter, GlowFilter, GradientBevelFilter,
10
- * and GradientGlowFilter classes all extend the BitmapFilter class.
11
- * You can apply these filter effects to any display object.
12
- * You can neither directly instantiate nor extend BitmapFilter.
13
- *
14
- * @class
15
- * @memberOf next2d.filters
16
- */
17
- export class BitmapFilter {
18
- /**
19
- * @constructor
20
- * @public
21
- */
22
- constructor() {
23
- /**
24
- * @type {boolean}
25
- * @default true
26
- * @private
27
- */
28
- this._$updated = true;
29
- }
30
- /**
31
- * @description 指定されたクラスのストリングを返します。
32
- * Returns the string representation of the specified class.
33
- *
34
- * @return {string}
35
- * @default [class BitmapFilter]
36
- * @method
37
- * @static
38
- */
39
- static toString() {
40
- return "[class BitmapFilter]";
41
- }
42
- /**
43
- * @description 指定されたクラスの空間名を返します。
44
- * Returns the space name of the specified class.
45
- *
46
- * @return {string}
47
- * @default next2d.filters.BitmapFilter
48
- * @const
49
- * @static
50
- */
51
- static get namespace() {
52
- return "next2d.filters.BitmapFilter";
53
- }
54
- /**
55
- * @description 指定されたオブジェクトのストリングを返します。
56
- * Returns the string representation of the specified object.
57
- *
58
- * @return {string}
59
- * @default [object BitmapFilter]
60
- * @method
61
- * @public
62
- */
63
- toString() {
64
- return "[object BitmapFilter]";
65
- }
66
- /**
67
- * @description 指定されたオブジェクトの空間名を返します。
68
- * Returns the space name of the specified object.
69
- *
70
- * @return {string}
71
- * @default next2d.filters.BitmapFilter
72
- * @const
73
- * @public
74
- */
75
- get namespace() {
76
- return "next2d.filters.BitmapFilter";
77
- }
78
- /**
79
- * @return {boolean}
80
- * @method
81
- * @private
82
- */
83
- _$isUpdated() {
84
- return this._$updated;
85
- }
86
- /**
87
- * @return {void}
88
- * @method
89
- * @private
90
- */
91
- _$doChanged() {
92
- this._$updated = true;
93
- $doUpdated();
94
- }
95
- }