@next2d/geom 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.
- package/package.json +8 -24
- package/src/ColorTransform/service/ColorTransformConcatService.d.ts +12 -0
- package/src/ColorTransform/service/ColorTransformConcatService.js +25 -0
- package/{dist → src}/ColorTransform.d.ts +57 -69
- package/src/ColorTransform.js +240 -0
- package/src/GeomUtil.d.ts +63 -0
- package/src/GeomUtil.js +102 -0
- package/src/Matrix/service/MatirxConcatService.d.ts +12 -0
- package/src/Matrix/service/MatirxConcatService.js +34 -0
- package/src/Matrix/service/MatrixCloneService.d.ts +11 -0
- package/src/Matrix/service/MatrixCloneService.js +13 -0
- package/src/Matrix/service/MatrixCopyFromService.d.ts +12 -0
- package/src/Matrix/service/MatrixCopyFromService.js +18 -0
- package/src/Matrix/service/MatrixCreateBoxService.d.ts +15 -0
- package/src/Matrix/service/MatrixCreateBoxService.js +19 -0
- package/src/Matrix/service/MatrixCreateGradientBoxService.d.ts +16 -0
- package/src/Matrix/service/MatrixCreateGradientBoxService.js +33 -0
- package/src/Matrix/service/MatrixDeltaTransformPointService.d.ts +13 -0
- package/src/Matrix/service/MatrixDeltaTransformPointService.js +14 -0
- package/src/Matrix/service/MatrixIdentityService.d.ts +11 -0
- package/src/Matrix/service/MatrixIdentityService.js +17 -0
- package/src/Matrix/service/MatrixInvertService.d.ts +11 -0
- package/src/Matrix/service/MatrixInvertService.js +37 -0
- package/src/Matrix/service/MatrixRotateService.d.ts +11 -0
- package/src/Matrix/service/MatrixRotateService.js +24 -0
- package/src/Matrix/service/MatrixScaleService.d.ts +13 -0
- package/src/Matrix/service/MatrixScaleService.js +20 -0
- package/src/Matrix/service/MatrixSetToService.d.ts +17 -0
- package/src/Matrix/service/MatrixSetToService.js +24 -0
- package/src/Matrix/service/MatrixTransformPointService.d.ts +13 -0
- package/src/Matrix/service/MatrixTransformPointService.js +17 -0
- package/src/Matrix/service/MatrixTranslateService.d.ts +13 -0
- package/src/Matrix/service/MatrixTranslateService.js +15 -0
- package/{dist → src}/Matrix.d.ts +45 -69
- package/{dist → src}/Matrix.js +92 -204
- package/src/Point/service/PointAddService.d.ts +12 -0
- package/src/Point/service/PointAddService.js +14 -0
- package/src/Point/service/PointCloneService.d.ts +11 -0
- package/src/Point/service/PointCloneService.js +13 -0
- package/src/Point/service/PointCopyFromService.d.ts +12 -0
- package/src/Point/service/PointCopyFromService.js +14 -0
- package/src/Point/service/PointDistanceService.d.ts +12 -0
- package/src/Point/service/PointDistanceService.js +14 -0
- package/src/Point/service/PointEqualsService.d.ts +12 -0
- package/src/Point/service/PointEqualsService.js +13 -0
- package/src/Point/service/PointInterpolateService.d.ts +13 -0
- package/src/Point/service/PointInterpolateService.js +15 -0
- package/src/Point/service/PointNormalizeService.d.ts +12 -0
- package/src/Point/service/PointNormalizeService.js +15 -0
- package/src/Point/service/PointOffsetService.d.ts +13 -0
- package/src/Point/service/PointOffsetService.js +15 -0
- package/src/Point/service/PointPolarService.d.ts +12 -0
- package/src/Point/service/PointPolarService.js +14 -0
- package/src/Point/service/PointSetToService.d.ts +13 -0
- package/src/Point/service/PointSetToService.js +15 -0
- package/src/Point/service/PointSubtractService.d.ts +12 -0
- package/src/Point/service/PointSubtractService.js +14 -0
- package/{dist → src}/Point.d.ts +34 -82
- package/{dist → src}/Point.js +67 -128
- package/src/Rectangle/service/RectangleCloneService.d.ts +11 -0
- package/src/Rectangle/service/RectangleCloneService.js +13 -0
- package/src/Rectangle/service/RectangleContainsPointService.d.ts +13 -0
- package/src/Rectangle/service/RectangleContainsPointService.js +16 -0
- package/src/Rectangle/service/RectangleContainsRectService.d.ts +12 -0
- package/src/Rectangle/service/RectangleContainsRectService.js +16 -0
- package/src/Rectangle/service/RectangleContainsService.d.ts +13 -0
- package/src/Rectangle/service/RectangleContainsService.js +17 -0
- package/src/Rectangle/service/RectangleCopyFromService.d.ts +12 -0
- package/src/Rectangle/service/RectangleCopyFromService.js +16 -0
- package/src/Rectangle/service/RectangleEqualsService.d.ts +12 -0
- package/src/Rectangle/service/RectangleEqualsService.js +16 -0
- package/src/Rectangle/service/RectangleInflatePointService.d.ts +13 -0
- package/src/Rectangle/service/RectangleInflatePointService.js +16 -0
- package/src/Rectangle/service/RectangleInflateService.d.ts +13 -0
- package/src/Rectangle/service/RectangleInflateService.js +17 -0
- package/src/Rectangle/service/RectangleIntersectionService.d.ts +12 -0
- package/src/Rectangle/service/RectangleIntersectionService.js +22 -0
- package/src/Rectangle/service/RectangleIntersectsService.d.ts +12 -0
- package/src/Rectangle/service/RectangleIntersectsService.js +17 -0
- package/src/Rectangle/service/RectangleIsEmptyService.d.ts +11 -0
- package/src/Rectangle/service/RectangleIsEmptyService.js +12 -0
- package/src/Rectangle/service/RectangleOffsetPointService.d.ts +13 -0
- package/src/Rectangle/service/RectangleOffsetPointService.js +14 -0
- package/src/Rectangle/service/RectangleOffsetService.d.ts +13 -0
- package/src/Rectangle/service/RectangleOffsetService.js +15 -0
- package/src/Rectangle/service/RectangleSetEmptyService.d.ts +11 -0
- package/src/Rectangle/service/RectangleSetEmptyService.js +12 -0
- package/src/Rectangle/service/RectangleSetToService.d.ts +15 -0
- package/src/Rectangle/service/RectangleSetToService.js +19 -0
- package/src/Rectangle/service/RectangleUnionService.d.ts +12 -0
- package/src/Rectangle/service/RectangleUnionService.js +20 -0
- package/{dist → src}/Rectangle.d.ts +50 -102
- package/{dist → src}/Rectangle.js +110 -205
- package/{dist → src}/index.d.ts +0 -1
- package/{dist → src}/index.js +0 -1
- package/dist/ColorTransform.js +0 -278
- package/dist/Transform.d.ts +0 -209
- package/dist/Transform.js +0 -478
package/package.json
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/geom",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Next2D Geom
|
|
5
|
-
"author": "Toshiyuki Ienaga<ienaga@
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Next2D Geom Package",
|
|
5
|
+
"author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://next2d.app",
|
|
8
8
|
"bugs": "https://github.com/Next2D/Player/issues",
|
|
9
|
-
"main": "
|
|
10
|
-
"types": "
|
|
11
|
-
"
|
|
12
|
-
"dist"
|
|
13
|
-
],
|
|
9
|
+
"main": "src/index.js",
|
|
10
|
+
"types": "src/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
14
12
|
"exports": {
|
|
15
13
|
".": {
|
|
16
|
-
"import":
|
|
17
|
-
|
|
18
|
-
"default": "./dist/index.js"
|
|
19
|
-
},
|
|
20
|
-
"require": {
|
|
21
|
-
"types": "./dist/index.d.ts",
|
|
22
|
-
"default": "./dist/index.js"
|
|
23
|
-
}
|
|
14
|
+
"import": "./src/index.js",
|
|
15
|
+
"require": "./src/index.js"
|
|
24
16
|
}
|
|
25
17
|
},
|
|
26
18
|
"keywords": [
|
|
@@ -30,13 +22,5 @@
|
|
|
30
22
|
"repository": {
|
|
31
23
|
"type": "git",
|
|
32
24
|
"url": "git+https://github.com/Next2D/Player.git"
|
|
33
|
-
},
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"@next2d/interface": "1.18.11",
|
|
36
|
-
"@next2d/display": "1.18.11",
|
|
37
|
-
"@next2d/core": "1.18.11",
|
|
38
|
-
"@next2d/util": "1.18.11",
|
|
39
|
-
"@next2d/filters": "1.18.11",
|
|
40
|
-
"@next2d/share": "1.18.11"
|
|
41
25
|
}
|
|
42
26
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColorTransform } from "../../ColorTransform";
|
|
2
|
+
/**
|
|
3
|
+
* @description 指定のColorTransformを連結
|
|
4
|
+
* Concatenate the specified ColorTransform
|
|
5
|
+
*
|
|
6
|
+
* @param {ColorTransform} color_transform1
|
|
7
|
+
* @param {ColorTransform} color_transform2
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const execute: (color_transform1: ColorTransform, color_transform2: ColorTransform) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ColorTransform } from "../../ColorTransform";
|
|
2
|
+
/**
|
|
3
|
+
* @description 指定のColorTransformを連結
|
|
4
|
+
* Concatenate the specified ColorTransform
|
|
5
|
+
*
|
|
6
|
+
* @param {ColorTransform} color_transform1
|
|
7
|
+
* @param {ColorTransform} color_transform2
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const execute = (color_transform1, color_transform2) => {
|
|
13
|
+
const multiColor = ColorTransform.multiply(color_transform1._$colorTransform, color_transform2._$colorTransform);
|
|
14
|
+
// update
|
|
15
|
+
color_transform1._$colorTransform[0] = multiColor[0];
|
|
16
|
+
color_transform1._$colorTransform[1] = multiColor[1];
|
|
17
|
+
color_transform1._$colorTransform[2] = multiColor[2];
|
|
18
|
+
color_transform1._$colorTransform[3] = multiColor[3];
|
|
19
|
+
color_transform1._$colorTransform[4] = multiColor[4];
|
|
20
|
+
color_transform1._$colorTransform[5] = multiColor[5];
|
|
21
|
+
color_transform1._$colorTransform[6] = multiColor[6];
|
|
22
|
+
color_transform1._$colorTransform[7] = multiColor[7];
|
|
23
|
+
// pool
|
|
24
|
+
ColorTransform.release(multiColor);
|
|
25
|
+
};
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ColorTransform クラスを使用すると、表示オブジェクトのカラー値を調整することができます。
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
2
|
+
* @description ColorTransform クラスを使用すると、表示オブジェクトのカラー値を調整することができます。
|
|
3
|
+
* カラー調整、つまり "カラー変換" は、赤、緑、青、アルファ透明度の 4 つのチャンネルすべてに適用できます。
|
|
4
|
+
* <ul>
|
|
5
|
+
* <li>新しい red 値 = (古い red 値 * redMultiplier ) + redOffset</li>
|
|
6
|
+
* <li>新しい green 値 = (古い green 値 * greenMultiplier ) + greenOffset</li>
|
|
7
|
+
* <li>新しい blue 値 = (古い blue 値 * blueMultiplier ) + blueOffset</li>
|
|
8
|
+
* <li>新しい alpha 値 = (古い alpha 値 * alphaMultiplier ) + alphaOffset</li>
|
|
9
|
+
* </ul>
|
|
10
|
+
* 算出後、カラーチャンネル値が 255 よりも大きい場合は 255 に設定されます。
|
|
11
|
+
* 0 より小さい場合は 0 に設定されます。
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
13
|
+
* The ColorTransform class lets you adjust the color values in a display object.
|
|
14
|
+
* The color adjustment or color transformation can be applied
|
|
15
|
+
* to all four channels: red, green, blue, and alpha transparency.
|
|
16
|
+
* <ul>
|
|
17
|
+
* <li>New red value = (old red value * redMultiplier) + redOffset</li>
|
|
18
|
+
* <li>New green value = (old green value * greenMultiplier) + greenOffset</li>
|
|
19
|
+
* <li>New blue value = (old blue value * blueMultiplier) + blueOffset</li>
|
|
20
|
+
* <li>New alpha value = (old alpha value * alphaMultiplier) + alphaOffset</li>
|
|
21
|
+
* </ul>
|
|
22
|
+
* If any of the color channel values is greater than 255 after the calculation,
|
|
23
|
+
* it is set to 255. If it is less than 0, it is set to 0.
|
|
24
24
|
*
|
|
25
25
|
* @class
|
|
26
26
|
* @memberOf next2d.geom
|
|
27
27
|
*/
|
|
28
28
|
export declare class ColorTransform {
|
|
29
|
+
/**
|
|
30
|
+
* @type {Float32Array}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
29
33
|
readonly _$colorTransform: Float32Array;
|
|
30
34
|
/**
|
|
31
35
|
* @param {number} [red_multiplier=1]
|
|
@@ -37,58 +41,19 @@ export declare class ColorTransform {
|
|
|
37
41
|
* @param {number} [blue_offset=0]
|
|
38
42
|
* @param {number} [alpha_offset=0]
|
|
39
43
|
*
|
|
40
|
-
* @example <caption>Example usage of ColorTransform.</caption>
|
|
41
|
-
* // new ColorTransform
|
|
42
|
-
* const {ColorTransform} = next2d.geom;
|
|
43
|
-
* const colorTransform = new ColorTransform();
|
|
44
|
-
* // set new ColorTransform
|
|
45
|
-
* const {MovieClip} = next2d.display;
|
|
46
|
-
* const movieClip = new MovieClip();
|
|
47
|
-
* movieClip.transform.colorTransform = colorTransform;
|
|
48
|
-
*
|
|
49
44
|
* @constructor
|
|
50
45
|
* @public
|
|
51
46
|
*/
|
|
52
47
|
constructor(red_multiplier?: number, green_multiplier?: number, blue_multiplier?: number, alpha_multiplier?: number, red_offset?: number, green_offset?: number, blue_offset?: number, alpha_offset?: number);
|
|
53
48
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @return {string}
|
|
58
|
-
* @default [class ColorTransform]
|
|
59
|
-
* @method
|
|
60
|
-
* @static
|
|
61
|
-
*/
|
|
62
|
-
static toString(): string;
|
|
63
|
-
/**
|
|
64
|
-
* @description 指定されたクラスの空間名を返します。
|
|
65
|
-
* Returns the space name of the specified class.
|
|
49
|
+
* @description ColorTransform の内部Float32Arrayデータを返却
|
|
50
|
+
* Returns the internal Float32Array data of ColorTransform
|
|
66
51
|
*
|
|
67
|
-
* @member {
|
|
68
|
-
* @
|
|
69
|
-
* @const
|
|
70
|
-
* @static
|
|
71
|
-
*/
|
|
72
|
-
static get namespace(): string;
|
|
73
|
-
/**
|
|
74
|
-
* @description 指定されたオブジェクトのストリングを返します。
|
|
75
|
-
* Returns the string representation of the specified object.
|
|
76
|
-
*
|
|
77
|
-
* @return {string}
|
|
78
|
-
* @method
|
|
52
|
+
* @member {Float32Array}
|
|
53
|
+
* @readonly
|
|
79
54
|
* @public
|
|
80
55
|
*/
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @description 指定されたオブジェクトの空間名を返します。
|
|
84
|
-
* Returns the space name of the specified object.
|
|
85
|
-
*
|
|
86
|
-
* @member {string}
|
|
87
|
-
* @default next2d.geom.ColorTransform
|
|
88
|
-
* @const
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
get namespace(): string;
|
|
56
|
+
get rawData(): Float32Array;
|
|
92
57
|
/**
|
|
93
58
|
* @description アルファ透明度チャンネル値に乗算する 10 進数値です。
|
|
94
59
|
* A decimal value that is multiplied with the alpha transparency channel value.
|
|
@@ -177,6 +142,15 @@ export declare class ColorTransform {
|
|
|
177
142
|
*/
|
|
178
143
|
get redOffset(): number;
|
|
179
144
|
set redOffset(red_offset: number);
|
|
145
|
+
/**
|
|
146
|
+
* @description オブジェクトの複製を返します。
|
|
147
|
+
* Returns a copy of this ColorTransform object.
|
|
148
|
+
*
|
|
149
|
+
* @return {ColorTransform}
|
|
150
|
+
* @method
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
clone(): ColorTransform;
|
|
180
154
|
/**
|
|
181
155
|
* @description 2 番目のパラメーターで指定された ColorTransform オブジェクトと
|
|
182
156
|
* 現在の ColorTransform オブジェクトを連結し
|
|
@@ -186,16 +160,30 @@ export declare class ColorTransform {
|
|
|
186
160
|
* and sets the current object as the result,
|
|
187
161
|
* which is an additive combination of the two color transformations.
|
|
188
162
|
*
|
|
189
|
-
* @param {ColorTransform}
|
|
163
|
+
* @param {ColorTransform} color_transform
|
|
190
164
|
* @return {void}
|
|
191
165
|
* @method
|
|
192
166
|
* @public
|
|
193
167
|
*/
|
|
194
|
-
concat(
|
|
168
|
+
concat(color_transform: ColorTransform): void;
|
|
195
169
|
/**
|
|
196
|
-
* @
|
|
170
|
+
* @description 指定された配列の値を乗算します
|
|
171
|
+
* Multiplies the value of the specified array.
|
|
172
|
+
*
|
|
173
|
+
* @param {Float32Array} a
|
|
174
|
+
* @param {Float32Array} b
|
|
175
|
+
* @return {Float32Array}
|
|
176
|
+
* @method
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
static multiply(a: Float32Array, b: Float32Array): Float32Array;
|
|
180
|
+
/**
|
|
181
|
+
* @description 利用したFloat32Arrayを再利用する為にプールします。
|
|
182
|
+
* Pool the Float32Array used for reuse.
|
|
183
|
+
*
|
|
184
|
+
* @param {Float32Array} buffer
|
|
197
185
|
* @method
|
|
198
186
|
* @private
|
|
199
187
|
*/
|
|
200
|
-
|
|
188
|
+
static release(buffer: Float32Array): void;
|
|
201
189
|
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { execute as colorTransformConcatService } from "../src/ColorTransform/service/ColorTransformConcatService";
|
|
2
|
+
import { $getFloat32Array8, $poolFloat32Array8, $clamp } from "./GeomUtil";
|
|
3
|
+
/**
|
|
4
|
+
* @description ColorTransform クラスを使用すると、表示オブジェクトのカラー値を調整することができます。
|
|
5
|
+
* カラー調整、つまり "カラー変換" は、赤、緑、青、アルファ透明度の 4 つのチャンネルすべてに適用できます。
|
|
6
|
+
* <ul>
|
|
7
|
+
* <li>新しい red 値 = (古い red 値 * redMultiplier ) + redOffset</li>
|
|
8
|
+
* <li>新しい green 値 = (古い green 値 * greenMultiplier ) + greenOffset</li>
|
|
9
|
+
* <li>新しい blue 値 = (古い blue 値 * blueMultiplier ) + blueOffset</li>
|
|
10
|
+
* <li>新しい alpha 値 = (古い alpha 値 * alphaMultiplier ) + alphaOffset</li>
|
|
11
|
+
* </ul>
|
|
12
|
+
* 算出後、カラーチャンネル値が 255 よりも大きい場合は 255 に設定されます。
|
|
13
|
+
* 0 より小さい場合は 0 に設定されます。
|
|
14
|
+
*
|
|
15
|
+
* The ColorTransform class lets you adjust the color values in a display object.
|
|
16
|
+
* The color adjustment or color transformation can be applied
|
|
17
|
+
* to all four channels: red, green, blue, and alpha transparency.
|
|
18
|
+
* <ul>
|
|
19
|
+
* <li>New red value = (old red value * redMultiplier) + redOffset</li>
|
|
20
|
+
* <li>New green value = (old green value * greenMultiplier) + greenOffset</li>
|
|
21
|
+
* <li>New blue value = (old blue value * blueMultiplier) + blueOffset</li>
|
|
22
|
+
* <li>New alpha value = (old alpha value * alphaMultiplier) + alphaOffset</li>
|
|
23
|
+
* </ul>
|
|
24
|
+
* If any of the color channel values is greater than 255 after the calculation,
|
|
25
|
+
* it is set to 255. If it is less than 0, it is set to 0.
|
|
26
|
+
*
|
|
27
|
+
* @class
|
|
28
|
+
* @memberOf next2d.geom
|
|
29
|
+
*/
|
|
30
|
+
export class ColorTransform {
|
|
31
|
+
/**
|
|
32
|
+
* @param {number} [red_multiplier=1]
|
|
33
|
+
* @param {number} [green_multiplier=1]
|
|
34
|
+
* @param {number} [blue_multiplier=1]
|
|
35
|
+
* @param {number} [alpha_multiplier=1]
|
|
36
|
+
* @param {number} [red_offset=0]
|
|
37
|
+
* @param {number} [green_offset=0]
|
|
38
|
+
* @param {number} [blue_offset=0]
|
|
39
|
+
* @param {number} [alpha_offset=0]
|
|
40
|
+
*
|
|
41
|
+
* @constructor
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
constructor(red_multiplier = 1, green_multiplier = 1, blue_multiplier = 1, alpha_multiplier = 1, red_offset = 0, green_offset = 0, blue_offset = 0, alpha_offset = 0) {
|
|
45
|
+
/**
|
|
46
|
+
* @type {Float32Array}
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
Object.defineProperty(this, "_$colorTransform", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: void 0
|
|
54
|
+
});
|
|
55
|
+
this._$colorTransform = $getFloat32Array8(red_multiplier, green_multiplier, blue_multiplier, alpha_multiplier, red_offset, green_offset, blue_offset, alpha_offset);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description ColorTransform の内部Float32Arrayデータを返却
|
|
59
|
+
* Returns the internal Float32Array data of ColorTransform
|
|
60
|
+
*
|
|
61
|
+
* @member {Float32Array}
|
|
62
|
+
* @readonly
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
get rawData() {
|
|
66
|
+
return this._$colorTransform;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description アルファ透明度チャンネル値に乗算する 10 進数値です。
|
|
70
|
+
* A decimal value that is multiplied with the alpha transparency channel value.
|
|
71
|
+
*
|
|
72
|
+
* @member {number}
|
|
73
|
+
* @default 1
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
get alphaMultiplier() {
|
|
77
|
+
return this._$colorTransform[3];
|
|
78
|
+
}
|
|
79
|
+
set alphaMultiplier(alpha_multiplier) {
|
|
80
|
+
this._$colorTransform[3] = $clamp(alpha_multiplier, 0, 1, 1);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @description アルファ透明度チャンネル値に alphaMultiplier 値を乗算した後に加算する数値です。
|
|
84
|
+
* 数値の範囲は -255 ~ 255 です。
|
|
85
|
+
* A number from -255 to 255 that is added to the alpha transparency channel value after
|
|
86
|
+
* it has been multiplied by the alphaMultiplier value.
|
|
87
|
+
*
|
|
88
|
+
* @member {number}
|
|
89
|
+
* @default 0
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
get alphaOffset() {
|
|
93
|
+
return this._$colorTransform[7];
|
|
94
|
+
}
|
|
95
|
+
set alphaOffset(alpha_offset) {
|
|
96
|
+
this._$colorTransform[7] = $clamp(alpha_offset, -255, 255, 0);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @description 青チャンネル値に乗算する 10 進数値です。
|
|
100
|
+
* A decimal value that is multiplied with the blue channel value.
|
|
101
|
+
*
|
|
102
|
+
* @member {number}
|
|
103
|
+
* @default 1
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
get blueMultiplier() {
|
|
107
|
+
return this._$colorTransform[2];
|
|
108
|
+
}
|
|
109
|
+
set blueMultiplier(blue_multiplier) {
|
|
110
|
+
this._$colorTransform[2] = $clamp(blue_multiplier, 0, 1, 1);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @description 青チャンネル値に blueMultiplier 値を乗算した後に加算する数値です。
|
|
114
|
+
* 数値の範囲は -255 ~ 255 です。
|
|
115
|
+
* A number from -255 to 255 that is added to the blue channel value after
|
|
116
|
+
* it has been multiplied by the blueMultiplier value.
|
|
117
|
+
*
|
|
118
|
+
* @member {number}
|
|
119
|
+
* @default 0
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
get blueOffset() {
|
|
123
|
+
return this._$colorTransform[6];
|
|
124
|
+
}
|
|
125
|
+
set blueOffset(blue_offset) {
|
|
126
|
+
this._$colorTransform[6] = $clamp(blue_offset, -255, 255, 0);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @description 緑チャンネル値に乗算する 10 進数値です。
|
|
130
|
+
* A decimal value that is multiplied with the green channel value.
|
|
131
|
+
*
|
|
132
|
+
* @member {number}
|
|
133
|
+
* @default 1
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
get greenMultiplier() {
|
|
137
|
+
return this._$colorTransform[1];
|
|
138
|
+
}
|
|
139
|
+
set greenMultiplier(green_multiplier) {
|
|
140
|
+
this._$colorTransform[1] = $clamp(green_multiplier, 0, 1, 1);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @description 緑チャンネル値に greenMultiplier 値を乗算した後に加算する数値です。
|
|
144
|
+
* 数値の範囲は -255 ~ 255 です。
|
|
145
|
+
* A number from -255 to 255 that is added to the green channel value after
|
|
146
|
+
* it has been multiplied by the greenMultiplier value.
|
|
147
|
+
*
|
|
148
|
+
* @member {number}
|
|
149
|
+
* @default 0
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
get greenOffset() {
|
|
153
|
+
return this._$colorTransform[5];
|
|
154
|
+
}
|
|
155
|
+
set greenOffset(green_offset) {
|
|
156
|
+
this._$colorTransform[5] = $clamp(green_offset, -255, 255, 0);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @description 赤チャンネル値に乗算する 10 進数値です。
|
|
160
|
+
* A decimal value that is multiplied with the red channel value.
|
|
161
|
+
*
|
|
162
|
+
* @member {number}
|
|
163
|
+
* @default 1
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
get redMultiplier() {
|
|
167
|
+
return this._$colorTransform[0];
|
|
168
|
+
}
|
|
169
|
+
set redMultiplier(red_multiplier) {
|
|
170
|
+
this._$colorTransform[0] = $clamp(red_multiplier, 0, 1, 1);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* @description 赤チャンネル値に redMultiplier 値を乗算した後に加算する数値です。
|
|
174
|
+
* 数値の範囲は -255 ~ 255 です。
|
|
175
|
+
* A number from -255 to 255 that is added to the red channel value after
|
|
176
|
+
* it has been multiplied by the redMultiplier value.
|
|
177
|
+
*
|
|
178
|
+
* @member {number}
|
|
179
|
+
* @default 0
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
get redOffset() {
|
|
183
|
+
return this._$colorTransform[4];
|
|
184
|
+
}
|
|
185
|
+
set redOffset(red_offset) {
|
|
186
|
+
this._$colorTransform[4] = $clamp(red_offset, -255, 255, 0);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @description オブジェクトの複製を返します。
|
|
190
|
+
* Returns a copy of this ColorTransform object.
|
|
191
|
+
*
|
|
192
|
+
* @return {ColorTransform}
|
|
193
|
+
* @method
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
clone() {
|
|
197
|
+
return new ColorTransform(...this._$colorTransform);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @description 2 番目のパラメーターで指定された ColorTransform オブジェクトと
|
|
201
|
+
* 現在の ColorTransform オブジェクトを連結し
|
|
202
|
+
* 2 つのカラー変換を加算的に組み合わせた結果を現在のオブジェクトに設定します。
|
|
203
|
+
* Concatenates the ColorTransform object specified
|
|
204
|
+
* by the second parameter with the current ColorTransform object
|
|
205
|
+
* and sets the current object as the result,
|
|
206
|
+
* which is an additive combination of the two color transformations.
|
|
207
|
+
*
|
|
208
|
+
* @param {ColorTransform} color_transform
|
|
209
|
+
* @return {void}
|
|
210
|
+
* @method
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
213
|
+
concat(color_transform) {
|
|
214
|
+
colorTransformConcatService(this, color_transform);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @description 指定された配列の値を乗算します
|
|
218
|
+
* Multiplies the value of the specified array.
|
|
219
|
+
*
|
|
220
|
+
* @param {Float32Array} a
|
|
221
|
+
* @param {Float32Array} b
|
|
222
|
+
* @return {Float32Array}
|
|
223
|
+
* @method
|
|
224
|
+
* @private
|
|
225
|
+
*/
|
|
226
|
+
static multiply(a, b) {
|
|
227
|
+
return $getFloat32Array8(a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3], a[0] * b[4] + a[4], a[1] * b[5] + a[5], a[2] * b[6] + a[6], a[3] * b[7] + a[7]);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* @description 利用したFloat32Arrayを再利用する為にプールします。
|
|
231
|
+
* Pool the Float32Array used for reuse.
|
|
232
|
+
*
|
|
233
|
+
* @param {Float32Array} buffer
|
|
234
|
+
* @method
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
static release(buffer) {
|
|
238
|
+
$poolFloat32Array8(buffer);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description オブジェクトプールから Float32Array オブジェクトを取得します。
|
|
3
|
+
* Get a Float32Array object from the object pool.
|
|
4
|
+
*
|
|
5
|
+
* @param {number} [f0=0]
|
|
6
|
+
* @param {number} [f1=0]
|
|
7
|
+
* @param {number} [f2=0]
|
|
8
|
+
* @param {number} [f3=0]
|
|
9
|
+
* @param {number} [f4=0]
|
|
10
|
+
* @param {number} [f5=0]
|
|
11
|
+
* @return {Float32Array}
|
|
12
|
+
* @method
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare const $getFloat32Array6: (f0?: number, f1?: number, f2?: number, f3?: number, f4?: number, f5?: number) => Float32Array;
|
|
16
|
+
/**
|
|
17
|
+
* @description 再利用する為に、オブジェクトプールに Float32Array オブジェクトを追加します。
|
|
18
|
+
* Add a Float32Array object to the object pool for reuse.
|
|
19
|
+
*
|
|
20
|
+
* @param {Float32Array} array
|
|
21
|
+
* @method
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
export declare const $poolFloat32Array6: (array: Float32Array) => void;
|
|
25
|
+
/**
|
|
26
|
+
* @description オブジェクトプールから Float32Array オブジェクトを取得します。
|
|
27
|
+
* Get a Float32Array object from the object pool.
|
|
28
|
+
*
|
|
29
|
+
* @param {number} [f0=0]
|
|
30
|
+
* @param {number} [f1=0]
|
|
31
|
+
* @param {number} [f2=0]
|
|
32
|
+
* @param {number} [f3=0]
|
|
33
|
+
* @param {number} [f4=0]
|
|
34
|
+
* @param {number} [f5=0]
|
|
35
|
+
* @param {number} [f6=0]
|
|
36
|
+
* @param {number} [f7=0]
|
|
37
|
+
* @return {Float32Array}
|
|
38
|
+
* @method
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
export declare const $getFloat32Array8: (f0?: number, f1?: number, f2?: number, f3?: number, f4?: number, f5?: number, f6?: number, f7?: number) => Float32Array;
|
|
42
|
+
/**
|
|
43
|
+
* @description 再利用する為に、オブジェクトプールに Float32Array オブジェクトを追加します。
|
|
44
|
+
* Add a Float32Array object to the object pool for reuse.
|
|
45
|
+
*
|
|
46
|
+
* @param {Float32Array} array
|
|
47
|
+
* @method
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
export declare const $poolFloat32Array8: (array: Float32Array) => void;
|
|
51
|
+
/**
|
|
52
|
+
* @description 値が最小値と最大値の間に収まるように調整します。
|
|
53
|
+
* Adjust the value so that it falls between the minimum and maximum values.
|
|
54
|
+
*
|
|
55
|
+
* @param {number} value
|
|
56
|
+
* @param {number} min
|
|
57
|
+
* @param {number} max
|
|
58
|
+
* @param {number} [default_value=null]
|
|
59
|
+
* @return {number}
|
|
60
|
+
* @method
|
|
61
|
+
* @static
|
|
62
|
+
*/
|
|
63
|
+
export declare const $clamp: (value: number, min: number, max: number, default_value?: number | null) => number;
|
package/src/GeomUtil.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {Float32Array[]}
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
const $objectPool6 = [];
|
|
6
|
+
/**
|
|
7
|
+
* @description オブジェクトプールから Float32Array オブジェクトを取得します。
|
|
8
|
+
* Get a Float32Array object from the object pool.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} [f0=0]
|
|
11
|
+
* @param {number} [f1=0]
|
|
12
|
+
* @param {number} [f2=0]
|
|
13
|
+
* @param {number} [f3=0]
|
|
14
|
+
* @param {number} [f4=0]
|
|
15
|
+
* @param {number} [f5=0]
|
|
16
|
+
* @return {Float32Array}
|
|
17
|
+
* @method
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
export const $getFloat32Array6 = (f0 = 1, f1 = 0, f2 = 0, f3 = 1, f4 = 0, f5 = 0) => {
|
|
21
|
+
const array = $objectPool6.pop() || new Float32Array(6);
|
|
22
|
+
array[0] = f0;
|
|
23
|
+
array[1] = f1;
|
|
24
|
+
array[2] = f2;
|
|
25
|
+
array[3] = f3;
|
|
26
|
+
array[4] = f4;
|
|
27
|
+
array[5] = f5;
|
|
28
|
+
return array;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @description 再利用する為に、オブジェクトプールに Float32Array オブジェクトを追加します。
|
|
32
|
+
* Add a Float32Array object to the object pool for reuse.
|
|
33
|
+
*
|
|
34
|
+
* @param {Float32Array} array
|
|
35
|
+
* @method
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
export const $poolFloat32Array6 = (array) => {
|
|
39
|
+
$objectPool6.push(array);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @type {Float32Array[]}
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
const $objectPool8 = [];
|
|
46
|
+
/**
|
|
47
|
+
* @description オブジェクトプールから Float32Array オブジェクトを取得します。
|
|
48
|
+
* Get a Float32Array object from the object pool.
|
|
49
|
+
*
|
|
50
|
+
* @param {number} [f0=0]
|
|
51
|
+
* @param {number} [f1=0]
|
|
52
|
+
* @param {number} [f2=0]
|
|
53
|
+
* @param {number} [f3=0]
|
|
54
|
+
* @param {number} [f4=0]
|
|
55
|
+
* @param {number} [f5=0]
|
|
56
|
+
* @param {number} [f6=0]
|
|
57
|
+
* @param {number} [f7=0]
|
|
58
|
+
* @return {Float32Array}
|
|
59
|
+
* @method
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
export const $getFloat32Array8 = (f0 = 1, f1 = 1, f2 = 1, f3 = 1, f4 = 0, f5 = 0, f6 = 0, f7 = 0) => {
|
|
63
|
+
const array = $objectPool8.pop() || new Float32Array(8);
|
|
64
|
+
array[0] = f0;
|
|
65
|
+
array[1] = f1;
|
|
66
|
+
array[2] = f2;
|
|
67
|
+
array[3] = f3;
|
|
68
|
+
array[4] = f4;
|
|
69
|
+
array[5] = f5;
|
|
70
|
+
array[6] = f6;
|
|
71
|
+
array[7] = f7;
|
|
72
|
+
return array;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @description 再利用する為に、オブジェクトプールに Float32Array オブジェクトを追加します。
|
|
76
|
+
* Add a Float32Array object to the object pool for reuse.
|
|
77
|
+
*
|
|
78
|
+
* @param {Float32Array} array
|
|
79
|
+
* @method
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
export const $poolFloat32Array8 = (array) => {
|
|
83
|
+
$objectPool8.push(array);
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @description 値が最小値と最大値の間に収まるように調整します。
|
|
87
|
+
* Adjust the value so that it falls between the minimum and maximum values.
|
|
88
|
+
*
|
|
89
|
+
* @param {number} value
|
|
90
|
+
* @param {number} min
|
|
91
|
+
* @param {number} max
|
|
92
|
+
* @param {number} [default_value=null]
|
|
93
|
+
* @return {number}
|
|
94
|
+
* @method
|
|
95
|
+
* @static
|
|
96
|
+
*/
|
|
97
|
+
export const $clamp = (value, min, max, default_value = null) => {
|
|
98
|
+
const number = +value;
|
|
99
|
+
return isNaN(number) && default_value !== null
|
|
100
|
+
? default_value
|
|
101
|
+
: Math.min(Math.max(min, isNaN(number) ? 0 : number), max);
|
|
102
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Matrix } from "../../Matrix";
|
|
2
|
+
/**
|
|
3
|
+
* @description 指定のMatrixを連結
|
|
4
|
+
* Concatenate specified Matrix
|
|
5
|
+
*
|
|
6
|
+
* @param {Matrix} matrix1
|
|
7
|
+
* @param {Matrix} matrix2
|
|
8
|
+
* @return {void}
|
|
9
|
+
* @method
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const execute: (matrix1: Matrix, matrix2: Matrix) => void;
|