@next2d/geom 1.14.20
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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/ColorTransform.d.ts +201 -0
- package/dist/ColorTransform.js +278 -0
- package/dist/Matrix.d.ts +299 -0
- package/dist/Matrix.js +454 -0
- package/dist/Point.d.ts +213 -0
- package/dist/Point.js +274 -0
- package/dist/Rectangle.d.ts +364 -0
- package/dist/Rectangle.js +513 -0
- package/dist/Transform.d.ts +209 -0
- package/dist/Transform.js +483 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +42 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { Rectangle } from "./Rectangle";
|
|
2
|
+
import { ColorTransform } from "./ColorTransform";
|
|
3
|
+
import { Matrix } from "./Matrix";
|
|
4
|
+
import { PlaceObjectImpl, DisplayObjectImpl, FilterArrayImpl, BlendModeImpl, SurfaceFilterImpl } from "@next2d/interface";
|
|
5
|
+
/**
|
|
6
|
+
* Transform クラスは、表示オブジェクトに適用されるカラー調整プロパティと 2 次元の変換オブジェクトへのアクセスを提供します。
|
|
7
|
+
* 変換時に、表示オブジェクトのカラーまたは方向と位置が、現在の値または座標から新しい値または座標に調整(オフセット)されます。
|
|
8
|
+
* Transform クラスは、表示オブジェクトおよびすべての親オブジェクトに適用されるカラー変換と 2 次元マトリックス変換に関するデータも収集します。
|
|
9
|
+
* concatenatedColorTransform プロパティと concatenatedMatrix プロパティを使用して、これらの結合された変換にアクセスできます。
|
|
10
|
+
* カラー変換を適用するには、ColorTransform オブジェクトを作成し、オブジェクトのメソッドとプロパティを使用してカラー調整を設定した後、
|
|
11
|
+
* colorTransformation プロパティ(表示オブジェクトの transform プロパティの)を新しい ColorTransformation オブジェクトに割り当てます。
|
|
12
|
+
* 2 次元変換を適用するには、Matrix オブジェクトを作成し、マトリックスの 2 次元変換を設定した後、表示オブジェクトの transform.matrix プロパティを新しい Matrix オブジェクトに割り当てます。
|
|
13
|
+
*
|
|
14
|
+
* The Transform class provides access to color adjustment properties and two--dimensional transformation objects that can be applied to a display object.
|
|
15
|
+
* During the transformation, the color or the orientation and position of a display object is adjusted (offset) from the current values or coordinates to new values or coordinates.
|
|
16
|
+
* The Transform class also collects data about color and two-dimensional matrix transformations that are applied to a display object and all of its parent objects.
|
|
17
|
+
* You can access these combined transformations through the concatenatedColorTransform and concatenatedMatrix properties.
|
|
18
|
+
* To apply color transformations: create a ColorTransform object,
|
|
19
|
+
* set the color adjustments using the object's methods and properties,
|
|
20
|
+
* and then assign the colorTransformation property of the transform property of the display object to the new ColorTransformation object.
|
|
21
|
+
* To apply two-dimensional transformations: create a Matrix object,
|
|
22
|
+
* set the matrix's two-dimensional transformation,
|
|
23
|
+
* and then assign the transform.matrix property of the display object to the new Matrix object.
|
|
24
|
+
*
|
|
25
|
+
* @example <caption>Example usage of Transform.</caption>
|
|
26
|
+
* // new Transform
|
|
27
|
+
* const {Transform} = next2d.geom;
|
|
28
|
+
* const transform = new Transform(displayObject);
|
|
29
|
+
*
|
|
30
|
+
* @class
|
|
31
|
+
* @memberOf next2d.geom
|
|
32
|
+
*/
|
|
33
|
+
export declare class Transform {
|
|
34
|
+
private readonly _$displayObject;
|
|
35
|
+
private _$matrix;
|
|
36
|
+
private _$colorTransform;
|
|
37
|
+
_$blendMode: BlendModeImpl | null;
|
|
38
|
+
_$filters: FilterArrayImpl | null;
|
|
39
|
+
/**
|
|
40
|
+
* @param {DisplayObject} src
|
|
41
|
+
*
|
|
42
|
+
* @constructor
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
constructor(src: DisplayObjectImpl<any>);
|
|
46
|
+
/**
|
|
47
|
+
* 指定されたクラスのストリングを返します。
|
|
48
|
+
* Returns the string representation of the specified class.
|
|
49
|
+
*
|
|
50
|
+
* @return {string}
|
|
51
|
+
* @default [class Transform]
|
|
52
|
+
* @method
|
|
53
|
+
* @static
|
|
54
|
+
*/
|
|
55
|
+
static toString(): string;
|
|
56
|
+
/**
|
|
57
|
+
* @description 指定されたクラスの空間名を返します。
|
|
58
|
+
* Returns the space name of the specified class.
|
|
59
|
+
*
|
|
60
|
+
* @member {string}
|
|
61
|
+
* @default next2d.geom.Transform
|
|
62
|
+
* @const
|
|
63
|
+
* @static
|
|
64
|
+
*/
|
|
65
|
+
static get namespace(): string;
|
|
66
|
+
/**
|
|
67
|
+
* @description 指定されたオブジェクトのストリングを返します。
|
|
68
|
+
* Returns the string representation of the specified object.
|
|
69
|
+
*
|
|
70
|
+
* @return {string}
|
|
71
|
+
* @method
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
toString(): string;
|
|
75
|
+
/**
|
|
76
|
+
* @description 指定されたオブジェクトの空間名を返します。
|
|
77
|
+
* Returns the space name of the specified object.
|
|
78
|
+
*
|
|
79
|
+
* @member {string}
|
|
80
|
+
* @default next2d.geom.Transform
|
|
81
|
+
* @const
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
get namespace(): string;
|
|
85
|
+
/**
|
|
86
|
+
* @description 表示オブジェクトのカラーを全体的に調整する値を格納している
|
|
87
|
+
* ColorTransform オブジェクトです。
|
|
88
|
+
* A ColorTransform object containing values that universally adjust
|
|
89
|
+
* the colors in the display object.
|
|
90
|
+
*
|
|
91
|
+
* @member {ColorTransform}
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
get colorTransform(): ColorTransform;
|
|
95
|
+
set colorTransform(color_transform: ColorTransform);
|
|
96
|
+
/**
|
|
97
|
+
* @description この表示オブジェクトおよびルートレベルまでのすべての親オブジェクトに適用される、
|
|
98
|
+
* 結合されたカラー変換を表す ColorTransform オブジェクトです。
|
|
99
|
+
* A ColorTransform object representing
|
|
100
|
+
* the combined color transformations applied to the display object
|
|
101
|
+
* and all of its parent objects, back to the root level.
|
|
102
|
+
*
|
|
103
|
+
* @member {ColorTransform}
|
|
104
|
+
* @readonly
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
get concatenatedColorTransform(): ColorTransform;
|
|
108
|
+
/**
|
|
109
|
+
* @description 表示オブジェクトの拡大 / 縮小、回転、および移動を変更する値を格納している
|
|
110
|
+
* Matrix オブジェクトです。
|
|
111
|
+
* A Matrix object containing values that alter the scaling,
|
|
112
|
+
* rotation, and translation of the display object.
|
|
113
|
+
*
|
|
114
|
+
* @member {Matrix}
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
get matrix(): Matrix;
|
|
118
|
+
set matrix(matrix: Matrix);
|
|
119
|
+
/**
|
|
120
|
+
* @description この表示オブジェクトおよびルートレベルまでのそのすべての親オブジェクトの結合された
|
|
121
|
+
* 変換マトリックスを表す Matrix オブジェクトです。
|
|
122
|
+
* A Matrix object representing the combined transformation matrixes
|
|
123
|
+
* of the display object and all of its parent objects, back to the root level.
|
|
124
|
+
*
|
|
125
|
+
* @member {Matrix}
|
|
126
|
+
* @readonly
|
|
127
|
+
* @method
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
get concatenatedMatrix(): Matrix;
|
|
131
|
+
/**
|
|
132
|
+
* @description ステージ上の表示オブジェクトの境界を示す矩形を定義する Transform オブジェクトです。
|
|
133
|
+
* A Transform object that defines the bounding rectangle of
|
|
134
|
+
* the display object on the stage.
|
|
135
|
+
*
|
|
136
|
+
* @member {Transform}
|
|
137
|
+
* @readonly
|
|
138
|
+
* @method
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
pixelBounds(): Rectangle;
|
|
142
|
+
/**
|
|
143
|
+
* matrix プロパティから取得される Matrix の Matrix._$matrix と同じ値を返しますが、matrix プロパティと異なり Matrix を複製しません。
|
|
144
|
+
* 返される値は一時的に使用することのみできます。返される値の要素を直接更新してはいけません。返される値をプール(Util.$poolFloat32Array)してはいけません。
|
|
145
|
+
*
|
|
146
|
+
* @return {Float32Array}
|
|
147
|
+
* @method
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
_$rawMatrix(): Float32Array;
|
|
151
|
+
/**
|
|
152
|
+
* colorTransform プロパティから取得される ColorTransform の colorTransform._$colorTransform と同じ値を返しますが、colorTransform プロパティと異なり ColorTransform を複製しません。
|
|
153
|
+
* 返される値は一時的に使用することのみできます。返される値の要素を直接更新してはいけません。返される値をプール(Util.$poolFloat32Array)してはいけません。
|
|
154
|
+
*
|
|
155
|
+
* @return {Float32Array}
|
|
156
|
+
* @method
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
_$rawColorTransform(): Float32Array;
|
|
160
|
+
/**
|
|
161
|
+
* @param {Float32Array} [matrix=null]
|
|
162
|
+
* @param {Float32Array} [color_transform=null]
|
|
163
|
+
* @param {array} [filters=null]
|
|
164
|
+
* @param {string} [blend_mode=""]
|
|
165
|
+
* @return {void}
|
|
166
|
+
* @method
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
_$transform(matrix?: Float32Array | null, color_transform?: Float32Array | null, filters?: FilterArrayImpl | null, blend_mode?: BlendModeImpl | ""): void;
|
|
170
|
+
/**
|
|
171
|
+
* @param {Float32Array} [matrix=null]
|
|
172
|
+
* @param {object} [place_object=null]
|
|
173
|
+
* @return {void}
|
|
174
|
+
* @method
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
_$setMatrix(matrix?: Float32Array | number[] | null, place_object?: PlaceObjectImpl | null): void;
|
|
178
|
+
/**
|
|
179
|
+
* @param {Float32Array} [color_transform=null]
|
|
180
|
+
* @param {object} [place_object=null]
|
|
181
|
+
* @return {void}
|
|
182
|
+
* @method
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
_$setColorTransform(color_transform?: Float32Array | number[] | null, place_object?: PlaceObjectImpl | null): void;
|
|
186
|
+
/**
|
|
187
|
+
* @param {array} [filters=null]
|
|
188
|
+
* @param {object} [place_object=null]
|
|
189
|
+
* @return {void}
|
|
190
|
+
* @method
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
_$setFilters(filters?: FilterArrayImpl | null, place_object?: PlaceObjectImpl | null): void;
|
|
194
|
+
/**
|
|
195
|
+
* @param {array} surface_filter_list
|
|
196
|
+
* @return {array}
|
|
197
|
+
* @method
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
_$buildFilter(surface_filter_list: SurfaceFilterImpl[]): FilterArrayImpl;
|
|
201
|
+
/**
|
|
202
|
+
* @param {string} [blend_mode=""]
|
|
203
|
+
* @param {object} [place_object=null]
|
|
204
|
+
* @return {void}
|
|
205
|
+
* @method
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
_$setBlendMode(blend_mode?: BlendModeImpl | "", place_object?: PlaceObjectImpl | null): void;
|
|
209
|
+
}
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { Rectangle } from "./Rectangle";
|
|
2
|
+
import { BevelFilter, BlurFilter, ColorMatrixFilter, ConvolutionFilter, DisplacementMapFilter, DropShadowFilter, GlowFilter, GradientBevelFilter, GradientGlowFilter } from "@next2d/filters";
|
|
3
|
+
import { $getColorTransform, $getMatrix } from "@next2d/util";
|
|
4
|
+
import { $Array, $Math, $MATRIX_ARRAY_IDENTITY, $COLOR_ARRAY_IDENTITY, $doUpdated, $getFloat32Array6, $getArray, $poolArray, $multiplicationColor, $multiplicationMatrix, $poolBoundsObject, $getFloat32Array8 } from "@next2d/share";
|
|
5
|
+
/**
|
|
6
|
+
* Transform クラスは、表示オブジェクトに適用されるカラー調整プロパティと 2 次元の変換オブジェクトへのアクセスを提供します。
|
|
7
|
+
* 変換時に、表示オブジェクトのカラーまたは方向と位置が、現在の値または座標から新しい値または座標に調整(オフセット)されます。
|
|
8
|
+
* Transform クラスは、表示オブジェクトおよびすべての親オブジェクトに適用されるカラー変換と 2 次元マトリックス変換に関するデータも収集します。
|
|
9
|
+
* concatenatedColorTransform プロパティと concatenatedMatrix プロパティを使用して、これらの結合された変換にアクセスできます。
|
|
10
|
+
* カラー変換を適用するには、ColorTransform オブジェクトを作成し、オブジェクトのメソッドとプロパティを使用してカラー調整を設定した後、
|
|
11
|
+
* colorTransformation プロパティ(表示オブジェクトの transform プロパティの)を新しい ColorTransformation オブジェクトに割り当てます。
|
|
12
|
+
* 2 次元変換を適用するには、Matrix オブジェクトを作成し、マトリックスの 2 次元変換を設定した後、表示オブジェクトの transform.matrix プロパティを新しい Matrix オブジェクトに割り当てます。
|
|
13
|
+
*
|
|
14
|
+
* The Transform class provides access to color adjustment properties and two--dimensional transformation objects that can be applied to a display object.
|
|
15
|
+
* During the transformation, the color or the orientation and position of a display object is adjusted (offset) from the current values or coordinates to new values or coordinates.
|
|
16
|
+
* The Transform class also collects data about color and two-dimensional matrix transformations that are applied to a display object and all of its parent objects.
|
|
17
|
+
* You can access these combined transformations through the concatenatedColorTransform and concatenatedMatrix properties.
|
|
18
|
+
* To apply color transformations: create a ColorTransform object,
|
|
19
|
+
* set the color adjustments using the object's methods and properties,
|
|
20
|
+
* and then assign the colorTransformation property of the transform property of the display object to the new ColorTransformation object.
|
|
21
|
+
* To apply two-dimensional transformations: create a Matrix object,
|
|
22
|
+
* set the matrix's two-dimensional transformation,
|
|
23
|
+
* and then assign the transform.matrix property of the display object to the new Matrix object.
|
|
24
|
+
*
|
|
25
|
+
* @example <caption>Example usage of Transform.</caption>
|
|
26
|
+
* // new Transform
|
|
27
|
+
* const {Transform} = next2d.geom;
|
|
28
|
+
* const transform = new Transform(displayObject);
|
|
29
|
+
*
|
|
30
|
+
* @class
|
|
31
|
+
* @memberOf next2d.geom
|
|
32
|
+
*/
|
|
33
|
+
export class Transform {
|
|
34
|
+
/**
|
|
35
|
+
* @param {DisplayObject} src
|
|
36
|
+
*
|
|
37
|
+
* @constructor
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
constructor(src) {
|
|
41
|
+
/**
|
|
42
|
+
* @type {DisplayObject}
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
this._$displayObject = src;
|
|
46
|
+
/**
|
|
47
|
+
* @type {Matrix}
|
|
48
|
+
* @default null
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
this._$matrix = null;
|
|
52
|
+
/**
|
|
53
|
+
* @type {ColorTransform}
|
|
54
|
+
* @default null
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
this._$colorTransform = null;
|
|
58
|
+
/**
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @default null
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
this._$blendMode = null;
|
|
64
|
+
/**
|
|
65
|
+
* @type {array}
|
|
66
|
+
* @default null
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
this._$filters = null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 指定されたクラスのストリングを返します。
|
|
73
|
+
* Returns the string representation of the specified class.
|
|
74
|
+
*
|
|
75
|
+
* @return {string}
|
|
76
|
+
* @default [class Transform]
|
|
77
|
+
* @method
|
|
78
|
+
* @static
|
|
79
|
+
*/
|
|
80
|
+
static toString() {
|
|
81
|
+
return "[class Transform]";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description 指定されたクラスの空間名を返します。
|
|
85
|
+
* Returns the space name of the specified class.
|
|
86
|
+
*
|
|
87
|
+
* @member {string}
|
|
88
|
+
* @default next2d.geom.Transform
|
|
89
|
+
* @const
|
|
90
|
+
* @static
|
|
91
|
+
*/
|
|
92
|
+
static get namespace() {
|
|
93
|
+
return "next2d.geom.Transform";
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @description 指定されたオブジェクトのストリングを返します。
|
|
97
|
+
* Returns the string representation of the specified object.
|
|
98
|
+
*
|
|
99
|
+
* @return {string}
|
|
100
|
+
* @method
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
toString() {
|
|
104
|
+
return "[object Transform]";
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @description 指定されたオブジェクトの空間名を返します。
|
|
108
|
+
* Returns the space name of the specified object.
|
|
109
|
+
*
|
|
110
|
+
* @member {string}
|
|
111
|
+
* @default next2d.geom.Transform
|
|
112
|
+
* @const
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
get namespace() {
|
|
116
|
+
return "next2d.geom.Transform";
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @description 表示オブジェクトのカラーを全体的に調整する値を格納している
|
|
120
|
+
* ColorTransform オブジェクトです。
|
|
121
|
+
* A ColorTransform object containing values that universally adjust
|
|
122
|
+
* the colors in the display object.
|
|
123
|
+
*
|
|
124
|
+
* @member {ColorTransform}
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
get colorTransform() {
|
|
128
|
+
if (this._$colorTransform) {
|
|
129
|
+
return this._$colorTransform._$clone();
|
|
130
|
+
}
|
|
131
|
+
const placeObject = this
|
|
132
|
+
._$displayObject
|
|
133
|
+
._$getPlaceObject();
|
|
134
|
+
if (placeObject && placeObject.colorTransform) {
|
|
135
|
+
const buffer = placeObject.colorTransform;
|
|
136
|
+
return $getColorTransform(buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7]);
|
|
137
|
+
}
|
|
138
|
+
this._$transform();
|
|
139
|
+
if (!this._$colorTransform) {
|
|
140
|
+
this._$colorTransform = $getColorTransform();
|
|
141
|
+
}
|
|
142
|
+
return this._$colorTransform._$clone();
|
|
143
|
+
}
|
|
144
|
+
set colorTransform(color_transform) {
|
|
145
|
+
this._$transform(null, color_transform._$colorTransform);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @description この表示オブジェクトおよびルートレベルまでのすべての親オブジェクトに適用される、
|
|
149
|
+
* 結合されたカラー変換を表す ColorTransform オブジェクトです。
|
|
150
|
+
* A ColorTransform object representing
|
|
151
|
+
* the combined color transformations applied to the display object
|
|
152
|
+
* and all of its parent objects, back to the root level.
|
|
153
|
+
*
|
|
154
|
+
* @member {ColorTransform}
|
|
155
|
+
* @readonly
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
get concatenatedColorTransform() {
|
|
159
|
+
let colorTransform = this._$rawColorTransform();
|
|
160
|
+
let parent = this._$displayObject._$parent;
|
|
161
|
+
while (parent) {
|
|
162
|
+
colorTransform = $multiplicationColor(parent._$transform._$rawColorTransform(), colorTransform);
|
|
163
|
+
parent = parent._$parent;
|
|
164
|
+
}
|
|
165
|
+
return $getColorTransform(colorTransform[0], colorTransform[1], colorTransform[2], colorTransform[3], colorTransform[4], colorTransform[5], colorTransform[6], colorTransform[7]);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @description 表示オブジェクトの拡大 / 縮小、回転、および移動を変更する値を格納している
|
|
169
|
+
* Matrix オブジェクトです。
|
|
170
|
+
* A Matrix object containing values that alter the scaling,
|
|
171
|
+
* rotation, and translation of the display object.
|
|
172
|
+
*
|
|
173
|
+
* @member {Matrix}
|
|
174
|
+
* @public
|
|
175
|
+
*/
|
|
176
|
+
get matrix() {
|
|
177
|
+
if (this._$matrix) {
|
|
178
|
+
return this._$matrix._$clone();
|
|
179
|
+
}
|
|
180
|
+
const placeObject = this
|
|
181
|
+
._$displayObject
|
|
182
|
+
._$getPlaceObject();
|
|
183
|
+
if (placeObject && placeObject.matrix) {
|
|
184
|
+
const buffer = placeObject.matrix;
|
|
185
|
+
return $getMatrix(buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]);
|
|
186
|
+
}
|
|
187
|
+
this._$transform();
|
|
188
|
+
if (!this._$matrix) {
|
|
189
|
+
this._$matrix = $getMatrix();
|
|
190
|
+
}
|
|
191
|
+
return this._$matrix._$clone();
|
|
192
|
+
}
|
|
193
|
+
set matrix(matrix) {
|
|
194
|
+
this._$transform(matrix._$matrix, null);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @description この表示オブジェクトおよびルートレベルまでのそのすべての親オブジェクトの結合された
|
|
198
|
+
* 変換マトリックスを表す Matrix オブジェクトです。
|
|
199
|
+
* A Matrix object representing the combined transformation matrixes
|
|
200
|
+
* of the display object and all of its parent objects, back to the root level.
|
|
201
|
+
*
|
|
202
|
+
* @member {Matrix}
|
|
203
|
+
* @readonly
|
|
204
|
+
* @method
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
207
|
+
get concatenatedMatrix() {
|
|
208
|
+
let matrix = this._$rawMatrix();
|
|
209
|
+
let parent = this._$displayObject._$parent;
|
|
210
|
+
while (parent) {
|
|
211
|
+
matrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), matrix);
|
|
212
|
+
parent = parent._$parent;
|
|
213
|
+
}
|
|
214
|
+
return $getMatrix(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @description ステージ上の表示オブジェクトの境界を示す矩形を定義する Transform オブジェクトです。
|
|
218
|
+
* A Transform object that defines the bounding rectangle of
|
|
219
|
+
* the display object on the stage.
|
|
220
|
+
*
|
|
221
|
+
* @member {Transform}
|
|
222
|
+
* @readonly
|
|
223
|
+
* @method
|
|
224
|
+
* @public
|
|
225
|
+
*/
|
|
226
|
+
pixelBounds() {
|
|
227
|
+
if (!this._$displayObject) {
|
|
228
|
+
return new Rectangle(0, 0, 0, 0);
|
|
229
|
+
}
|
|
230
|
+
const bounds = this
|
|
231
|
+
._$displayObject
|
|
232
|
+
._$getBounds(null);
|
|
233
|
+
const rectangle = new Rectangle(bounds.xMin, bounds.yMin, +$Math.abs(bounds.xMax - bounds.xMin), +$Math.abs(bounds.yMax - bounds.yMin));
|
|
234
|
+
$poolBoundsObject(bounds);
|
|
235
|
+
return rectangle;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* matrix プロパティから取得される Matrix の Matrix._$matrix と同じ値を返しますが、matrix プロパティと異なり Matrix を複製しません。
|
|
239
|
+
* 返される値は一時的に使用することのみできます。返される値の要素を直接更新してはいけません。返される値をプール(Util.$poolFloat32Array)してはいけません。
|
|
240
|
+
*
|
|
241
|
+
* @return {Float32Array}
|
|
242
|
+
* @method
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
_$rawMatrix() {
|
|
246
|
+
if (this._$matrix !== null) {
|
|
247
|
+
return this._$matrix._$matrix;
|
|
248
|
+
}
|
|
249
|
+
const placeObject = this
|
|
250
|
+
._$displayObject
|
|
251
|
+
._$getPlaceObject();
|
|
252
|
+
if (placeObject && placeObject.matrix) {
|
|
253
|
+
if ($Array.isArray(placeObject.matrix)) {
|
|
254
|
+
const matrix = placeObject.matrix;
|
|
255
|
+
placeObject.matrix = $getFloat32Array6(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
|
256
|
+
$poolArray(matrix);
|
|
257
|
+
}
|
|
258
|
+
return placeObject.matrix;
|
|
259
|
+
}
|
|
260
|
+
return $MATRIX_ARRAY_IDENTITY;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* colorTransform プロパティから取得される ColorTransform の colorTransform._$colorTransform と同じ値を返しますが、colorTransform プロパティと異なり ColorTransform を複製しません。
|
|
264
|
+
* 返される値は一時的に使用することのみできます。返される値の要素を直接更新してはいけません。返される値をプール(Util.$poolFloat32Array)してはいけません。
|
|
265
|
+
*
|
|
266
|
+
* @return {Float32Array}
|
|
267
|
+
* @method
|
|
268
|
+
* @private
|
|
269
|
+
*/
|
|
270
|
+
_$rawColorTransform() {
|
|
271
|
+
if (this._$colorTransform !== null) {
|
|
272
|
+
return this._$colorTransform._$colorTransform;
|
|
273
|
+
}
|
|
274
|
+
const placeObject = this
|
|
275
|
+
._$displayObject
|
|
276
|
+
._$getPlaceObject();
|
|
277
|
+
if (placeObject && placeObject.colorTransform) {
|
|
278
|
+
if ($Array.isArray(placeObject.colorTransform)) {
|
|
279
|
+
const colorTransform = placeObject.colorTransform;
|
|
280
|
+
placeObject.colorTransform = $getFloat32Array8(colorTransform[0], colorTransform[1], colorTransform[2], colorTransform[3], colorTransform[4], colorTransform[5], colorTransform[6], colorTransform[7]);
|
|
281
|
+
$poolArray(colorTransform);
|
|
282
|
+
}
|
|
283
|
+
return placeObject.colorTransform;
|
|
284
|
+
}
|
|
285
|
+
return $COLOR_ARRAY_IDENTITY;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @param {Float32Array} [matrix=null]
|
|
289
|
+
* @param {Float32Array} [color_transform=null]
|
|
290
|
+
* @param {array} [filters=null]
|
|
291
|
+
* @param {string} [blend_mode=""]
|
|
292
|
+
* @return {void}
|
|
293
|
+
* @method
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
_$transform(matrix = null, color_transform = null, filters = null, blend_mode = "") {
|
|
297
|
+
const placeObject = this
|
|
298
|
+
._$displayObject
|
|
299
|
+
._$getPlaceObject();
|
|
300
|
+
// Matrix
|
|
301
|
+
this._$setMatrix(matrix, placeObject);
|
|
302
|
+
// ColorTransform
|
|
303
|
+
this._$setColorTransform(color_transform, placeObject);
|
|
304
|
+
// Filter
|
|
305
|
+
this._$setFilters(filters, placeObject);
|
|
306
|
+
// BlendMode
|
|
307
|
+
this._$setBlendMode(blend_mode, placeObject);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* @param {Float32Array} [matrix=null]
|
|
311
|
+
* @param {object} [place_object=null]
|
|
312
|
+
* @return {void}
|
|
313
|
+
* @method
|
|
314
|
+
* @private
|
|
315
|
+
*/
|
|
316
|
+
_$setMatrix(matrix = null, place_object = null) {
|
|
317
|
+
if (matrix || place_object) {
|
|
318
|
+
this._$displayObject._$doChanged();
|
|
319
|
+
$doUpdated();
|
|
320
|
+
}
|
|
321
|
+
// Matrix
|
|
322
|
+
if (!this._$matrix) {
|
|
323
|
+
this._$matrix = $getMatrix(1, 0, 0, 1, 0, 0);
|
|
324
|
+
if (!matrix
|
|
325
|
+
&& place_object
|
|
326
|
+
&& place_object.matrix) {
|
|
327
|
+
matrix = place_object.matrix;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// update
|
|
331
|
+
if (matrix) {
|
|
332
|
+
const currentMatrix = this._$matrix._$matrix;
|
|
333
|
+
currentMatrix[0] = matrix[0];
|
|
334
|
+
currentMatrix[1] = matrix[1];
|
|
335
|
+
currentMatrix[2] = matrix[2];
|
|
336
|
+
currentMatrix[3] = matrix[3];
|
|
337
|
+
currentMatrix[4] = matrix[4];
|
|
338
|
+
currentMatrix[5] = matrix[5];
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @param {Float32Array} [color_transform=null]
|
|
343
|
+
* @param {object} [place_object=null]
|
|
344
|
+
* @return {void}
|
|
345
|
+
* @method
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
_$setColorTransform(color_transform = null, place_object = null) {
|
|
349
|
+
if (color_transform || place_object) {
|
|
350
|
+
this._$displayObject._$doChanged();
|
|
351
|
+
$doUpdated();
|
|
352
|
+
}
|
|
353
|
+
if (!this._$colorTransform) {
|
|
354
|
+
this._$colorTransform = $getColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
|
|
355
|
+
if (!color_transform
|
|
356
|
+
&& place_object
|
|
357
|
+
&& place_object.colorTransform) {
|
|
358
|
+
color_transform = place_object.colorTransform;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (color_transform) {
|
|
362
|
+
const colorTransform = this._$colorTransform._$colorTransform;
|
|
363
|
+
colorTransform[0] = color_transform[0];
|
|
364
|
+
colorTransform[1] = color_transform[1];
|
|
365
|
+
colorTransform[2] = color_transform[2];
|
|
366
|
+
colorTransform[3] = color_transform[3];
|
|
367
|
+
colorTransform[4] = color_transform[4];
|
|
368
|
+
colorTransform[5] = color_transform[5];
|
|
369
|
+
colorTransform[6] = color_transform[6];
|
|
370
|
+
colorTransform[7] = color_transform[7];
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @param {array} [filters=null]
|
|
375
|
+
* @param {object} [place_object=null]
|
|
376
|
+
* @return {void}
|
|
377
|
+
* @method
|
|
378
|
+
* @private
|
|
379
|
+
*/
|
|
380
|
+
_$setFilters(filters = null, place_object = null) {
|
|
381
|
+
if ($Array.isArray(filters)) {
|
|
382
|
+
if (this._$filters) {
|
|
383
|
+
$poolArray(this._$filters);
|
|
384
|
+
}
|
|
385
|
+
this._$filters = filters.slice(0);
|
|
386
|
+
this._$displayObject._$doChanged();
|
|
387
|
+
$doUpdated();
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (this._$filters) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (!place_object) {
|
|
394
|
+
this._$filters = $getArray();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (place_object.filters) {
|
|
398
|
+
this._$filters = place_object.filters.slice(0);
|
|
399
|
+
for (let idx = 0; idx < this._$filters.length; ++idx) {
|
|
400
|
+
this._$filters[idx] = this._$filters[idx].clone();
|
|
401
|
+
}
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (place_object.surfaceFilterList) {
|
|
405
|
+
// build origin
|
|
406
|
+
place_object.filters = this._$buildFilter(place_object.surfaceFilterList);
|
|
407
|
+
// use clone
|
|
408
|
+
this._$filters = place_object.filters.slice(0);
|
|
409
|
+
for (let idx = 0; idx < this._$filters.length; ++idx) {
|
|
410
|
+
this._$filters[idx] = this._$filters[idx].clone();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* @param {array} surface_filter_list
|
|
416
|
+
* @return {array}
|
|
417
|
+
* @method
|
|
418
|
+
* @public
|
|
419
|
+
*/
|
|
420
|
+
_$buildFilter(surface_filter_list) {
|
|
421
|
+
const filters = $getArray();
|
|
422
|
+
const length = surface_filter_list.length;
|
|
423
|
+
for (let idx = 0; idx < length; ++idx) {
|
|
424
|
+
const filter = surface_filter_list[idx];
|
|
425
|
+
if (filter.params[0] === null) {
|
|
426
|
+
filter.params.shift();
|
|
427
|
+
}
|
|
428
|
+
switch (filter.class) {
|
|
429
|
+
case "BevelFilter":
|
|
430
|
+
filters.push(new BevelFilter(...filter.params));
|
|
431
|
+
break;
|
|
432
|
+
case "BlurFilter":
|
|
433
|
+
filters.push(new BlurFilter(...filter.params));
|
|
434
|
+
break;
|
|
435
|
+
case "ColorMatrixFilter":
|
|
436
|
+
filters.push(new ColorMatrixFilter(...filter.params));
|
|
437
|
+
break;
|
|
438
|
+
case "ConvolutionFilter":
|
|
439
|
+
filters.push(new ConvolutionFilter(...filter.params));
|
|
440
|
+
break;
|
|
441
|
+
case "DisplacementMapFilter":
|
|
442
|
+
filters.push(new DisplacementMapFilter(...filter.params));
|
|
443
|
+
break;
|
|
444
|
+
case "DropShadowFilter":
|
|
445
|
+
filters.push(new DropShadowFilter(...filter.params));
|
|
446
|
+
break;
|
|
447
|
+
case "GlowFilter":
|
|
448
|
+
filters.push(new GlowFilter(...filter.params));
|
|
449
|
+
break;
|
|
450
|
+
case "GradientBevelFilter":
|
|
451
|
+
filters.push(new GradientBevelFilter(...filter.params));
|
|
452
|
+
break;
|
|
453
|
+
case "GradientGlowFilter":
|
|
454
|
+
filters.push(new GradientGlowFilter(...filter.params));
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return filters;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* @param {string} [blend_mode=""]
|
|
462
|
+
* @param {object} [place_object=null]
|
|
463
|
+
* @return {void}
|
|
464
|
+
* @method
|
|
465
|
+
* @private
|
|
466
|
+
*/
|
|
467
|
+
_$setBlendMode(blend_mode = "", place_object = null) {
|
|
468
|
+
if (blend_mode) {
|
|
469
|
+
this._$blendMode = blend_mode;
|
|
470
|
+
this._$displayObject._$doChanged();
|
|
471
|
+
$doUpdated();
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
if (this._$blendMode) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (place_object && place_object.blendMode) {
|
|
478
|
+
this._$blendMode = place_object.blendMode;
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
this._$blendMode = "normal";
|
|
482
|
+
}
|
|
483
|
+
}
|