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