@next2d/filters 1.14.24 → 1.16.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.
@@ -1,6 +1,6 @@
1
1
  import { BitmapFilter } from "./BitmapFilter";
2
2
  import { BlurFilter } from "./BlurFilter";
3
- import { $Math, $clamp, $toColorInt, $getArray, $Deg2Rad, $intToR, $intToG, $intToB, $getBoundsObject } from "@next2d/share";
3
+ import { $Math, $clamp, $toColorInt, $getArray, $Deg2Rad, $intToR, $intToG, $intToB, $getBoundsObject, $devicePixelRatio } from "@next2d/share";
4
4
  /**
5
5
  * BevelFilter クラスを使用すると、表示オブジェクトにベベル効果を追加できます。
6
6
  * ボタンなどのオブジェクトにベベル効果を適用すると 3 次元的に表現されます。
@@ -403,12 +403,22 @@ export class BevelFilter extends BitmapFilter {
403
403
  ._$blurFilter
404
404
  ._$generateFilterRect(clone, x_scale, y_scale);
405
405
  const radian = this._$angle * $Deg2Rad;
406
- const x = $Math.abs($Math.cos(radian) * this._$distance);
407
- const y = $Math.abs($Math.sin(radian) * this._$distance);
408
- clone.xMin += -x;
409
- clone.xMax += x;
410
- clone.yMin += -y;
411
- clone.yMax += y * 2;
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
+ }
412
422
  return clone;
413
423
  }
414
424
  /**
@@ -446,8 +456,12 @@ export class BevelFilter extends BitmapFilter {
446
456
  const baseOffsetX = context._$offsetX;
447
457
  const baseOffsetY = context._$offsetY;
448
458
  // matrix to scale
449
- const xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
450
- const yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
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;
451
465
  // pointer
452
466
  const radian = this._$angle * $Deg2Rad;
453
467
  const x = $Math.cos(radian) * this._$distance * xScale;
@@ -1,5 +1,5 @@
1
1
  import { BitmapFilter } from "./BitmapFilter";
2
- import { $Math, $getArray, $clamp, $getBoundsObject, $poolBoundsObject } from "@next2d/share";
2
+ import { $Math, $getArray, $clamp, $getBoundsObject, $poolBoundsObject, $devicePixelRatio } from "@next2d/share";
3
3
  /**
4
4
  * BlurFilter クラスを使用すると、表示オブジェクトにぼかし効果を適用できます。
5
5
  * ぼかし効果は、イメージの細部をぼかします。ソフトフォーカスがかかっているように見えるぼかしから、
@@ -244,8 +244,12 @@ export class BlurFilter extends BitmapFilter {
244
244
  .createTextureFromCurrentAttachment();
245
245
  }
246
246
  // matrix to scale
247
- const xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
248
- const yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
247
+ let xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
248
+ let yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
249
+ xScale /= $devicePixelRatio;
250
+ yScale /= $devicePixelRatio;
251
+ xScale *= 2;
252
+ yScale *= 2;
249
253
  // after size
250
254
  const baseBounds = $getBoundsObject(0, baseTexture.width, 0, baseTexture.height);
251
255
  const filterBounds = this
@@ -1,6 +1,6 @@
1
1
  import { BitmapFilter } from "./BitmapFilter";
2
2
  import { BlurFilter } from "./BlurFilter";
3
- import { $clamp, $Deg2Rad, $getArray, $Math, $toColorInt, $intToR, $intToG, $intToB, $getBoundsObject } from "@next2d/share";
3
+ import { $clamp, $Deg2Rad, $getArray, $Math, $toColorInt, $intToR, $intToG, $intToB, $getBoundsObject, $devicePixelRatio } from "@next2d/share";
4
4
  /**
5
5
  * DropShadowFilter クラスは、ドロップシャドウを表示オブジェクトに追加します。
6
6
  * シャドウアルゴリズムは、ぼかしフィルターで使用するのと同じボックスフィルターに基づいています。
@@ -373,12 +373,22 @@ export class DropShadowFilter extends BitmapFilter {
373
373
  ._$blurFilter
374
374
  ._$generateFilterRect(clone, x_scale, y_scale);
375
375
  const radian = this._$angle * $Deg2Rad;
376
- const x = $Math.cos(radian) * this._$distance * 2;
377
- const y = $Math.sin(radian) * this._$distance * 2;
376
+ let x = $Math.cos(radian) * this._$distance;
377
+ let y = $Math.sin(radian) * this._$distance;
378
+ if (x_scale) {
379
+ x *= x_scale;
380
+ }
381
+ if (y_scale) {
382
+ y *= y_scale;
383
+ }
378
384
  clone.xMin = $Math.min(clone.xMin, x);
379
- clone.xMax += $Math.abs(x);
385
+ if (x > 0) {
386
+ clone.xMax += x;
387
+ }
380
388
  clone.yMin = $Math.min(clone.yMin, y);
381
- clone.yMax += $Math.abs(y);
389
+ if (y > 0) {
390
+ clone.yMax += y;
391
+ }
382
392
  return clone;
383
393
  }
384
394
  /**
@@ -420,8 +430,12 @@ export class DropShadowFilter extends BitmapFilter {
420
430
  const blurOffsetY = context._$offsetY;
421
431
  const offsetDiffX = blurOffsetX - baseOffsetX;
422
432
  const offsetDiffY = blurOffsetY - baseOffsetY;
423
- const xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
424
- const yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
433
+ let xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
434
+ let yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
435
+ xScale /= $devicePixelRatio;
436
+ yScale /= $devicePixelRatio;
437
+ xScale *= 2;
438
+ yScale *= 2;
425
439
  // shadow point
426
440
  const radian = this._$angle * $Deg2Rad;
427
441
  const x = $Math.cos(radian) * this._$distance * xScale;
@@ -1,6 +1,6 @@
1
1
  import { BitmapFilter } from "./BitmapFilter";
2
2
  import { BlurFilter } from "./BlurFilter";
3
- import { $Array, $clamp, $Deg2Rad, $getArray, $getBoundsObject, $Math, $toColorInt } from "@next2d/share";
3
+ import { $Array, $clamp, $Deg2Rad, $devicePixelRatio, $getArray, $getBoundsObject, $Math, $toColorInt } from "@next2d/share";
4
4
  /**
5
5
  * GradientBevelFilter クラスを使用すると、オブジェクトにグラデーションベベル効果を適用し、表示できます。
6
6
  * グラデーションベベルは、オブジェクトの外側、内側、または上側が斜めになったエッジであり、グラデーションカラーで強調されます。
@@ -392,12 +392,22 @@ export class GradientBevelFilter extends BitmapFilter {
392
392
  ._$blurFilter
393
393
  ._$generateFilterRect(clone, x_scale, y_scale);
394
394
  const radian = this._$angle * $Deg2Rad;
395
- const x = $Math.abs($Math.cos(radian) * this._$distance);
396
- const y = $Math.abs($Math.sin(radian) * this._$distance);
397
- clone.xMin += -x;
398
- clone.xMax += x;
399
- clone.yMin += -y;
400
- clone.yMax += y * 2;
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
+ }
401
411
  return clone;
402
412
  }
403
413
  /**
@@ -433,8 +443,12 @@ export class GradientBevelFilter extends BitmapFilter {
433
443
  const baseOffsetX = context._$offsetX;
434
444
  const baseOffsetY = context._$offsetY;
435
445
  // matrix to scale
436
- const xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
437
- const yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
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;
438
452
  // pointer
439
453
  const radian = +(this._$angle * $Deg2Rad);
440
454
  const x = +($Math.cos(radian) * this._$distance * xScale);
@@ -1,6 +1,6 @@
1
1
  import { BitmapFilter } from "./BitmapFilter";
2
2
  import { BlurFilter } from "./BlurFilter";
3
- import { $Array, $clamp, $Deg2Rad, $getArray, $getBoundsObject, $Math, $toColorInt } from "@next2d/share";
3
+ import { $Array, $clamp, $Deg2Rad, $getArray, $getBoundsObject, $Math, $toColorInt, $devicePixelRatio } from "@next2d/share";
4
4
  /**
5
5
  * GradientGlowFilter クラスを使用すると、表示オブジェクトにグラデーショングロー効果を適用できます。
6
6
  * グラデーショングローとは、制御可能なカラーグラデーションによるリアルな輝きです。
@@ -390,12 +390,22 @@ export class GradientGlowFilter extends BitmapFilter {
390
390
  ._$blurFilter
391
391
  ._$generateFilterRect(clone, x_scale, y_scale);
392
392
  const radian = this._$angle * $Deg2Rad;
393
- const x = $Math.abs($Math.cos(radian) * this._$distance);
394
- const y = $Math.abs($Math.sin(radian) * this._$distance);
395
- clone.xMin += -x;
396
- clone.xMax += x;
397
- clone.yMin += -y;
398
- clone.yMax += y * 2;
393
+ let x = $Math.abs($Math.cos(radian) * this._$distance);
394
+ let y = $Math.abs($Math.sin(radian) * this._$distance);
395
+ if (x_scale) {
396
+ x *= x_scale;
397
+ }
398
+ if (y_scale) {
399
+ y *= y_scale;
400
+ }
401
+ clone.xMin = $Math.min(clone.xMin, x);
402
+ if (x > 0) {
403
+ clone.xMax += x;
404
+ }
405
+ clone.yMin = $Math.min(clone.yMin, y);
406
+ if (y > 0) {
407
+ clone.yMax += y;
408
+ }
399
409
  return clone;
400
410
  }
401
411
  /**
@@ -439,8 +449,12 @@ export class GradientGlowFilter extends BitmapFilter {
439
449
  const offsetDiffX = blurOffsetX - baseOffsetX;
440
450
  const offsetDiffY = blurOffsetY - baseOffsetY;
441
451
  // matrix to scale
442
- const xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
443
- const yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
452
+ let xScale = $Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
453
+ let yScale = $Math.sqrt(matrix[2] * matrix[2] + matrix[3] * matrix[3]);
454
+ xScale /= $devicePixelRatio;
455
+ yScale /= $devicePixelRatio;
456
+ xScale *= 2;
457
+ yScale *= 2;
444
458
  // shadow point
445
459
  const radian = +(this._$angle * $Deg2Rad);
446
460
  const x = +($Math.cos(radian) * this._$distance * xScale);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/filters",
3
- "version": "1.14.24",
3
+ "version": "1.16.0",
4
4
  "description": "Next2D Filters Packages",
5
5
  "author": "Toshiyuki Ienaga<ienaga@tvon.jp> (https://github.com/ienaga/)",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "url": "git+https://github.com/Next2D/Player.git"
33
33
  },
34
34
  "peerDependencies": {
35
- "@next2d/share": "1.14.24",
36
- "@next2d/webgl": "1.14.24"
35
+ "@next2d/share": "1.16.0",
36
+ "@next2d/webgl": "1.16.0"
37
37
  }
38
38
  }