@next2d/filters 1.18.11 → 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
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @description フィルターの設定値を配列で返却します。
3
+ * Returns an array of filter settings.
4
+ *
5
+ * @param {BlurFilter} blur_filter
6
+ * @return {Float32Array}
7
+ * @method
8
+ * @protected
9
+ */
10
+ export const execute = (blur_filter) => {
11
+ return new Float32Array([
12
+ blur_filter.$filterType,
13
+ blur_filter.blurX,
14
+ blur_filter.blurY,
15
+ blur_filter.quality
16
+ ]);
17
+ };
@@ -0,0 +1,17 @@
1
+ import type { BlurFilter } from "../../BlurFilter";
2
+ import type { BevelFilter } from "../../BevelFilter";
3
+ import type { DropShadowFilter } from "../../DropShadowFilter";
4
+ import type { GlowFilter } from "../../GlowFilter";
5
+ import type { GradientBevelFilter } from "../../GradientBevelFilter";
6
+ import type { GradientGlowFilter } from "../../GradientGlowFilter";
7
+ /**
8
+ * @description Filterの描画後の描画範囲を返却
9
+ * Returns the drawing range after drawing Filter
10
+ *
11
+ * @param {BlurFilter} filter
12
+ * @param {Float32Array} bounds
13
+ * @return {Float32Array}
14
+ * @method
15
+ * @protected
16
+ */
17
+ export declare const execute: (filter: BlurFilter | BevelFilter | DropShadowFilter | GlowFilter | GradientBevelFilter | GradientGlowFilter, bounds: Float32Array) => Float32Array;
@@ -0,0 +1,29 @@
1
+ import { execute as blurFilterCanApplyFilterService } from "../service/BlurFilterCanApplyFilterService";
2
+ /**
3
+ * @return {array}
4
+ * @private
5
+ */
6
+ const $STEP = [0.5, 1.05, 1.4, 1.55, 1.75, 1.9, 2, 2.15, 2.2, 2.3, 2.5, 3, 3, 3.5, 3.5];
7
+ /**
8
+ * @description Filterの描画後の描画範囲を返却
9
+ * Returns the drawing range after drawing Filter
10
+ *
11
+ * @param {BlurFilter} filter
12
+ * @param {Float32Array} bounds
13
+ * @return {Float32Array}
14
+ * @method
15
+ * @protected
16
+ */
17
+ export const execute = (filter, bounds) => {
18
+ if (!blurFilterCanApplyFilterService(filter)) {
19
+ return bounds;
20
+ }
21
+ const step = $STEP[filter.quality - 1];
22
+ const dx = Math.round(filter.blurX * step);
23
+ const dy = Math.round(filter.blurY * step);
24
+ bounds[0] -= dx;
25
+ bounds[2] += dx;
26
+ bounds[1] -= dy;
27
+ bounds[3] += dy;
28
+ return bounds;
29
+ };
@@ -0,0 +1,142 @@
1
+ import type { IFilterQuality } from "./interface/IFilterQuality";
2
+ import { BitmapFilter } from "./BitmapFilter";
3
+ /**
4
+ * @description BlurFilter クラスを使用すると、表示オブジェクトにぼかし効果を適用できます。
5
+ * ぼかし効果は、イメージの細部をぼかします。ソフトフォーカスがかかっているように見えるぼかしから、
6
+ * 半透明ガラスを通してイメージを見るようにかすんで見えるガウスぼかしまで作成できます。
7
+ * このフィルターの quality プロパティを低く設定すると、ソフトフォーカスがかかっているように見えるぼかしになります。
8
+ * quality プロパティを高く設定すると、ガウスぼかしフィルターに似たものになります。
9
+ *
10
+ * The BlurFilter class lets you apply a blur visual effect to display objects.
11
+ * A blur effect softens the details of an image.
12
+ * You can produce blurs that range from a softly unfocused look to a Gaussian blur,
13
+ * a hazy appearance like viewing an image through semi-opaque glass.
14
+ * When the quality property of this filter is set to low, the result is a softly unfocused look.
15
+ * When the quality property is set to high, it approximates a Gaussian blur filter.
16
+ *
17
+ * @class
18
+ * @memberOf next2d.filters
19
+ * @extends BitmapFilter
20
+ */
21
+ export declare class BlurFilter extends BitmapFilter {
22
+ /**
23
+ * @description フィルター認識番号
24
+ * Filter Recognition Number
25
+ *
26
+ * @member {number}
27
+ * @public
28
+ */
29
+ readonly $filterType: number;
30
+ /**
31
+ * @description 水平方向のぼかし量。
32
+ * The amount of horizontal blur.
33
+ *
34
+ * @member {number}
35
+ * @default 4
36
+ * @private
37
+ */
38
+ private _$blurX;
39
+ /**
40
+ * @description 垂直方向のぼかし量。
41
+ * The amount of vertical blur.
42
+ *
43
+ * @member {number}
44
+ * @default 4
45
+ * @private
46
+ */
47
+ private _$blurY;
48
+ /**
49
+ * @description ぼかしの実行回数です。
50
+ * The number of times to perform the blur.
51
+ *
52
+ * @member {number}
53
+ * @default 1
54
+ * @private
55
+ */
56
+ private _$quality;
57
+ /**
58
+ * @param {number} [blur_x=4]
59
+ * @param {number} [blur_y=4]
60
+ * @param {number} [quality=1]
61
+ *
62
+ * @constructor
63
+ * @public
64
+ */
65
+ constructor(blur_x?: number, blur_y?: number, quality?: IFilterQuality);
66
+ /**
67
+ * @description 水平方向のぼかし量。
68
+ * The amount of horizontal blur.
69
+ *
70
+ * @member {number}
71
+ * @default 4
72
+ * @public
73
+ */
74
+ get blurX(): number;
75
+ set blurX(blur_x: number);
76
+ /**
77
+ * @description 垂直方向のぼかし量。
78
+ * The amount of vertical blur.
79
+ *
80
+ * @member {number}
81
+ * @default 4
82
+ * @public
83
+ */
84
+ get blurY(): number;
85
+ set blurY(blur_y: number);
86
+ /**
87
+ * @description ぼかしの実行回数です。
88
+ * The number of times to perform the blur.
89
+ *
90
+ * @member {number}
91
+ * @default 1
92
+ * @public
93
+ */
94
+ get quality(): IFilterQuality;
95
+ set quality(quality: IFilterQuality);
96
+ /**
97
+ * @description オブジェクトのコピーを返します。
98
+ * Returns a copy of this filter object.
99
+ *
100
+ * @return {BlurFilter}
101
+ * @method
102
+ * @public
103
+ */
104
+ clone(): BlurFilter;
105
+ /**
106
+ * @description 設定されたフィルターの値を配列で返します。
107
+ * Returns the value of the specified filter as an array.
108
+ *
109
+ * @return {array}
110
+ * @method
111
+ * @public
112
+ */
113
+ toArray(): number[];
114
+ /**
115
+ * @description 設定されたフィルターの値を数値配列で返します。
116
+ * Returns the value of the specified filter as a number array.
117
+ *
118
+ * @return {Float32Array}
119
+ * @method
120
+ * @public
121
+ */
122
+ toNumberArray(): Float32Array;
123
+ /**
124
+ * @description フィルターを適用できるかどうかを返します。
125
+ * Returns whether the filter can be applied.
126
+ *
127
+ * @return {boolean}
128
+ * @method
129
+ * @public
130
+ */
131
+ canApplyFilter(): boolean;
132
+ /**
133
+ * @description フィルターの描画範囲のバウンディングボックスを返します。
134
+ * Returns the bounding box of the filter drawing area.
135
+ *
136
+ * @param {Float32Array} bounds
137
+ * @return {Float32Array}
138
+ * @method
139
+ * @public
140
+ */
141
+ getBounds(bounds: Float32Array): Float32Array;
142
+ }
@@ -0,0 +1,213 @@
1
+ import { BitmapFilter } from "./BitmapFilter";
2
+ import { $clamp } from "./FilterUtil";
3
+ import { execute as blurFilterToArrayService } from "./BlurFilter/service/BlurFilterToArrayService";
4
+ import { execute as blurFilterGetBoundsUseCase } from "./BlurFilter/usecase/BlurFilterGetBoundsUseCase";
5
+ import { execute as blurFilterCanApplyFilterService } from "./BlurFilter/service/BlurFilterCanApplyFilterService";
6
+ import { execute as blurFilterToNumberArrayService } from "./BlurFilter/service/BlurFilterToNumberArrayService";
7
+ /**
8
+ * @description BlurFilter クラスを使用すると、表示オブジェクトにぼかし効果を適用できます。
9
+ * ぼかし効果は、イメージの細部をぼかします。ソフトフォーカスがかかっているように見えるぼかしから、
10
+ * 半透明ガラスを通してイメージを見るようにかすんで見えるガウスぼかしまで作成できます。
11
+ * このフィルターの quality プロパティを低く設定すると、ソフトフォーカスがかかっているように見えるぼかしになります。
12
+ * quality プロパティを高く設定すると、ガウスぼかしフィルターに似たものになります。
13
+ *
14
+ * The BlurFilter class lets you apply a blur visual effect to display objects.
15
+ * A blur effect softens the details of an image.
16
+ * You can produce blurs that range from a softly unfocused look to a Gaussian blur,
17
+ * a hazy appearance like viewing an image through semi-opaque glass.
18
+ * When the quality property of this filter is set to low, the result is a softly unfocused look.
19
+ * When the quality property is set to high, it approximates a Gaussian blur filter.
20
+ *
21
+ * @class
22
+ * @memberOf next2d.filters
23
+ * @extends BitmapFilter
24
+ */
25
+ export class BlurFilter extends BitmapFilter {
26
+ /**
27
+ * @param {number} [blur_x=4]
28
+ * @param {number} [blur_y=4]
29
+ * @param {number} [quality=1]
30
+ *
31
+ * @constructor
32
+ * @public
33
+ */
34
+ constructor(blur_x = 4, blur_y = 4, quality = 1) {
35
+ super();
36
+ /**
37
+ * @description フィルター認識番号
38
+ * Filter Recognition Number
39
+ *
40
+ * @member {number}
41
+ * @public
42
+ */
43
+ Object.defineProperty(this, "$filterType", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: 1
48
+ });
49
+ /**
50
+ * @description 水平方向のぼかし量。
51
+ * The amount of horizontal blur.
52
+ *
53
+ * @member {number}
54
+ * @default 4
55
+ * @private
56
+ */
57
+ Object.defineProperty(this, "_$blurX", {
58
+ enumerable: true,
59
+ configurable: true,
60
+ writable: true,
61
+ value: void 0
62
+ });
63
+ /**
64
+ * @description 垂直方向のぼかし量。
65
+ * The amount of vertical blur.
66
+ *
67
+ * @member {number}
68
+ * @default 4
69
+ * @private
70
+ */
71
+ Object.defineProperty(this, "_$blurY", {
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true,
75
+ value: void 0
76
+ });
77
+ /**
78
+ * @description ぼかしの実行回数です。
79
+ * The number of times to perform the blur.
80
+ *
81
+ * @member {number}
82
+ * @default 1
83
+ * @private
84
+ */
85
+ Object.defineProperty(this, "_$quality", {
86
+ enumerable: true,
87
+ configurable: true,
88
+ writable: true,
89
+ value: void 0
90
+ });
91
+ // default
92
+ this._$blurX = 4;
93
+ this._$blurY = 4;
94
+ this._$quality = 1;
95
+ // setup
96
+ this.blurX = blur_x;
97
+ this.blurY = blur_y;
98
+ this.quality = quality;
99
+ }
100
+ /**
101
+ * @description 水平方向のぼかし量。
102
+ * The amount of horizontal blur.
103
+ *
104
+ * @member {number}
105
+ * @default 4
106
+ * @public
107
+ */
108
+ get blurX() {
109
+ return this._$blurX;
110
+ }
111
+ set blurX(blur_x) {
112
+ blur_x = $clamp(+blur_x, 0, 255, 0);
113
+ if (blur_x === this._$blurX) {
114
+ return;
115
+ }
116
+ this._$blurX = blur_x;
117
+ this.$updated = true;
118
+ }
119
+ /**
120
+ * @description 垂直方向のぼかし量。
121
+ * The amount of vertical blur.
122
+ *
123
+ * @member {number}
124
+ * @default 4
125
+ * @public
126
+ */
127
+ get blurY() {
128
+ return this._$blurY;
129
+ }
130
+ set blurY(blur_y) {
131
+ blur_y = $clamp(+blur_y, 0, 255, 0);
132
+ if (blur_y === this._$blurY) {
133
+ return;
134
+ }
135
+ this._$blurY = blur_y;
136
+ this.$updated = true;
137
+ }
138
+ /**
139
+ * @description ぼかしの実行回数です。
140
+ * The number of times to perform the blur.
141
+ *
142
+ * @member {number}
143
+ * @default 1
144
+ * @public
145
+ */
146
+ get quality() {
147
+ return this._$quality;
148
+ }
149
+ set quality(quality) {
150
+ quality = $clamp(quality | 0, 0, 15, 1);
151
+ if (quality === this._$quality) {
152
+ return;
153
+ }
154
+ this._$quality = quality;
155
+ this.$updated = true;
156
+ }
157
+ /**
158
+ * @description オブジェクトのコピーを返します。
159
+ * Returns a copy of this filter object.
160
+ *
161
+ * @return {BlurFilter}
162
+ * @method
163
+ * @public
164
+ */
165
+ clone() {
166
+ return new BlurFilter(this._$blurX, this._$blurY, this._$quality);
167
+ }
168
+ /**
169
+ * @description 設定されたフィルターの値を配列で返します。
170
+ * Returns the value of the specified filter as an array.
171
+ *
172
+ * @return {array}
173
+ * @method
174
+ * @public
175
+ */
176
+ toArray() {
177
+ return blurFilterToArrayService(this);
178
+ }
179
+ /**
180
+ * @description 設定されたフィルターの値を数値配列で返します。
181
+ * Returns the value of the specified filter as a number array.
182
+ *
183
+ * @return {Float32Array}
184
+ * @method
185
+ * @public
186
+ */
187
+ toNumberArray() {
188
+ return blurFilterToNumberArrayService(this);
189
+ }
190
+ /**
191
+ * @description フィルターを適用できるかどうかを返します。
192
+ * Returns whether the filter can be applied.
193
+ *
194
+ * @return {boolean}
195
+ * @method
196
+ * @public
197
+ */
198
+ canApplyFilter() {
199
+ return blurFilterCanApplyFilterService(this);
200
+ }
201
+ /**
202
+ * @description フィルターの描画範囲のバウンディングボックスを返します。
203
+ * Returns the bounding box of the filter drawing area.
204
+ *
205
+ * @param {Float32Array} bounds
206
+ * @return {Float32Array}
207
+ * @method
208
+ * @public
209
+ */
210
+ getBounds(bounds) {
211
+ return blurFilterGetBoundsUseCase(this, bounds);
212
+ }
213
+ }
@@ -0,0 +1,11 @@
1
+ import type { ColorMatrixFilter } from "../../ColorMatrixFilter";
2
+ /**
3
+ * @description フィルターの設定値を配列で返却します。
4
+ * Returns an array of filter settings.
5
+ *
6
+ * @param {BevelFilter} color_matrix_filter
7
+ * @return {Array<number | number[]>}
8
+ * @method
9
+ * @protected
10
+ */
11
+ export declare const execute: (color_matrix_filter: ColorMatrixFilter) => Array<number | number[]>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @description フィルターの設定値を配列で返却します。
3
+ * Returns an array of filter settings.
4
+ *
5
+ * @param {BevelFilter} color_matrix_filter
6
+ * @return {Array<number | number[]>}
7
+ * @method
8
+ * @protected
9
+ */
10
+ export const execute = (color_matrix_filter) => {
11
+ return [
12
+ color_matrix_filter.$filterType,
13
+ color_matrix_filter.matrix
14
+ ];
15
+ };
@@ -0,0 +1,11 @@
1
+ import type { ColorMatrixFilter } from "../../ColorMatrixFilter";
2
+ /**
3
+ * @description フィルターの設定値を数値配列で返却します。
4
+ * Returns a numeric array of filter settings.
5
+ *
6
+ * @param {ColorMatrixFilter} color_matrix_filter
7
+ * @return {Float32Array}
8
+ * @method
9
+ * @protected
10
+ */
11
+ export declare const execute: (color_matrix_filter: ColorMatrixFilter) => Float32Array;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @description フィルターの設定値を数値配列で返却します。
3
+ * Returns a numeric array of filter settings.
4
+ *
5
+ * @param {ColorMatrixFilter} color_matrix_filter
6
+ * @return {Float32Array}
7
+ * @method
8
+ * @protected
9
+ */
10
+ export const execute = (color_matrix_filter) => {
11
+ return new Float32Array([
12
+ color_matrix_filter.$filterType,
13
+ ...color_matrix_filter.matrix
14
+ ]);
15
+ };
@@ -0,0 +1,78 @@
1
+ import { BitmapFilter } from "./BitmapFilter";
2
+ /**
3
+ * @description ColorMatrixFilter クラスを使用すると、表示オブジェクトにぼかし効果を適用できます。
4
+ * ぼかし効果は、イメージの細部をぼかします。ソフトフォーカスがかかっているように見えるぼかしから、
5
+ * 半透明ガラスを通してイメージを見るようにかすんで見えるガウスぼかしまで作成できます。
6
+ * このフィルターの quality プロパティを低く設定すると、ソフトフォーカスがかかっているように見えるぼかしになります。
7
+ * quality プロパティを高く設定すると、ガウスぼかしフィルターに似たものになります。
8
+ *
9
+ * The ColorMatrixFilter class lets you apply a blur visual effect to display objects.
10
+ * A blur effect softens the details of an image.
11
+ * You can produce blurs that range from a softly unfocused look to a Gaussian blur,
12
+ * a hazy appearance like viewing an image through semi-opaque glass.
13
+ * When the quality property of this filter is set to low, the result is a softly unfocused look.
14
+ * When the quality property is set to high, it approximates a Gaussian blur filter.
15
+ *
16
+ * @class
17
+ * @memberOf next2d.filters
18
+ * @extends BitmapFilter
19
+ */
20
+ export declare class ColorMatrixFilter extends BitmapFilter {
21
+ /**
22
+ * @description フィルター認識番号
23
+ * Filter Recognition Number
24
+ *
25
+ * @member {number}
26
+ * @public
27
+ */
28
+ $filterType: number;
29
+ /**
30
+ * @type {array}
31
+ * @private
32
+ */
33
+ private _$matrix;
34
+ /**
35
+ * @param {array} [matrix=null]
36
+ *
37
+ * @constructor
38
+ * @public
39
+ */
40
+ constructor(matrix?: number[] | null);
41
+ /**
42
+ * @description 4×5 カラー変換用の20個のアイテムの配列
43
+ * An array of 20 items for 4x5 color transform.
44
+ *
45
+ * @member {array}
46
+ * @default null
47
+ * @public
48
+ */
49
+ get matrix(): number[];
50
+ set matrix(matrix: number[]);
51
+ /**
52
+ * @description オブジェクトのコピーを返します。
53
+ * Returns a copy of this filter object.
54
+ *
55
+ * @return {ColorMatrixFilter}
56
+ * @method
57
+ * @public
58
+ */
59
+ clone(): ColorMatrixFilter;
60
+ /**
61
+ * @description 設定されたフィルターの値を配列で返します。
62
+ * Returns the value of the specified filter as an array.
63
+ *
64
+ * @return {array}
65
+ * @method
66
+ * @public
67
+ */
68
+ toArray(): Array<number | number[]>;
69
+ /**
70
+ * @description 設定されたフィルターの値を数値配列で返します。
71
+ * Returns the value of the specified filter as a number array.
72
+ *
73
+ * @return {Float32Array}
74
+ * @method
75
+ * @public
76
+ */
77
+ toNumberArray(): Float32Array;
78
+ }
@@ -0,0 +1,129 @@
1
+ import { BitmapFilter } from "./BitmapFilter";
2
+ import { execute as colorMatrixFilterToArrayService } from "./ColorMatrixFilter/service/ColorMatrixFilterToArrayService";
3
+ import { execute as colorMatrixFilterToNumberArrayService } from "./ColorMatrixFilter/service/ColorMatrixFilterToNumberArrayService";
4
+ /**
5
+ * @description ColorMatrixFilter クラスを使用すると、表示オブジェクトにぼかし効果を適用できます。
6
+ * ぼかし効果は、イメージの細部をぼかします。ソフトフォーカスがかかっているように見えるぼかしから、
7
+ * 半透明ガラスを通してイメージを見るようにかすんで見えるガウスぼかしまで作成できます。
8
+ * このフィルターの quality プロパティを低く設定すると、ソフトフォーカスがかかっているように見えるぼかしになります。
9
+ * quality プロパティを高く設定すると、ガウスぼかしフィルターに似たものになります。
10
+ *
11
+ * The ColorMatrixFilter class lets you apply a blur visual effect to display objects.
12
+ * A blur effect softens the details of an image.
13
+ * You can produce blurs that range from a softly unfocused look to a Gaussian blur,
14
+ * a hazy appearance like viewing an image through semi-opaque glass.
15
+ * When the quality property of this filter is set to low, the result is a softly unfocused look.
16
+ * When the quality property is set to high, it approximates a Gaussian blur filter.
17
+ *
18
+ * @class
19
+ * @memberOf next2d.filters
20
+ * @extends BitmapFilter
21
+ */
22
+ export class ColorMatrixFilter extends BitmapFilter {
23
+ /**
24
+ * @param {array} [matrix=null]
25
+ *
26
+ * @constructor
27
+ * @public
28
+ */
29
+ constructor(matrix = null) {
30
+ super();
31
+ /**
32
+ * @description フィルター認識番号
33
+ * Filter Recognition Number
34
+ *
35
+ * @member {number}
36
+ * @public
37
+ */
38
+ Object.defineProperty(this, "$filterType", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: 2
43
+ });
44
+ /**
45
+ * @type {array}
46
+ * @private
47
+ */
48
+ Object.defineProperty(this, "_$matrix", {
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ value: void 0
53
+ });
54
+ // default
55
+ this._$matrix = [
56
+ 1, 0, 0, 0, 0,
57
+ 0, 1, 0, 0, 0,
58
+ 0, 0, 1, 0, 0,
59
+ 0, 0, 0, 1, 0
60
+ ];
61
+ // setup
62
+ if (matrix && matrix.length === 20) {
63
+ this.matrix = matrix;
64
+ }
65
+ }
66
+ /**
67
+ * @description 4×5 カラー変換用の20個のアイテムの配列
68
+ * An array of 20 items for 4x5 color transform.
69
+ *
70
+ * @member {array}
71
+ * @default null
72
+ * @public
73
+ */
74
+ get matrix() {
75
+ return this._$matrix;
76
+ }
77
+ set matrix(matrix) {
78
+ if (this._$matrix === matrix) {
79
+ return;
80
+ }
81
+ if (!Array.isArray(matrix) || matrix.length !== 20) {
82
+ return;
83
+ }
84
+ for (let idx = 0; idx < 20; idx++) {
85
+ if (matrix[idx] === this._$matrix[idx]) {
86
+ continue;
87
+ }
88
+ this.$updated = true;
89
+ break;
90
+ }
91
+ if (!this.$updated) {
92
+ return;
93
+ }
94
+ this._$matrix = matrix;
95
+ }
96
+ /**
97
+ * @description オブジェクトのコピーを返します。
98
+ * Returns a copy of this filter object.
99
+ *
100
+ * @return {ColorMatrixFilter}
101
+ * @method
102
+ * @public
103
+ */
104
+ clone() {
105
+ return new ColorMatrixFilter(this._$matrix);
106
+ }
107
+ /**
108
+ * @description 設定されたフィルターの値を配列で返します。
109
+ * Returns the value of the specified filter as an array.
110
+ *
111
+ * @return {array}
112
+ * @method
113
+ * @public
114
+ */
115
+ toArray() {
116
+ return colorMatrixFilterToArrayService(this);
117
+ }
118
+ /**
119
+ * @description 設定されたフィルターの値を数値配列で返します。
120
+ * Returns the value of the specified filter as a number array.
121
+ *
122
+ * @return {Float32Array}
123
+ * @method
124
+ * @public
125
+ */
126
+ toNumberArray() {
127
+ return colorMatrixFilterToNumberArrayService(this);
128
+ }
129
+ }