@next2d/renderer 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/LICENSE +21 -0
- package/README.md +11 -0
- package/package.json +31 -0
- package/src/Command/service/CommandInitializeContextService.d.ts +11 -0
- package/src/Command/service/CommandInitializeContextService.js +27 -0
- package/src/Command/service/CommandRemoveCacheService.d.ts +10 -0
- package/src/Command/service/CommandRemoveCacheService.js +24 -0
- package/src/Command/service/CommandResizeService.d.ts +12 -0
- package/src/Command/service/CommandResizeService.js +27 -0
- package/src/Command/usecase/CommandCaptureUseCase.d.ts +13 -0
- package/src/Command/usecase/CommandCaptureUseCase.js +53 -0
- package/src/Command/usecase/CommandRenderUseCase.d.ts +11 -0
- package/src/Command/usecase/CommandRenderUseCase.js +70 -0
- package/src/CommandController.d.ts +38 -0
- package/src/CommandController.js +102 -0
- package/src/DisplayObject/service/DisplayObjectGetBlendModeService.d.ts +11 -0
- package/src/DisplayObject/service/DisplayObjectGetBlendModeService.js +45 -0
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerClipRenderUseCase.d.ts +11 -0
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerClipRenderUseCase.js +29 -0
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRenderUseCase.d.ts +12 -0
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRenderUseCase.js +120 -0
- package/src/RendererUtil.d.ts +136 -0
- package/src/RendererUtil.js +214 -0
- package/src/Shape/service/ShapeCommandService.d.ts +11 -0
- package/src/Shape/service/ShapeCommandService.js +252 -0
- package/src/Shape/usecase/ShapeClipRenderUseCase.d.ts +11 -0
- package/src/Shape/usecase/ShapeClipRenderUseCase.js +33 -0
- package/src/Shape/usecase/ShapeRenderUseCase.d.ts +11 -0
- package/src/Shape/usecase/ShapeRenderUseCase.js +154 -0
- package/src/TextField/service/TextFieldGenerateFontStyleService.d.ts +11 -0
- package/src/TextField/service/TextFieldGenerateFontStyleService.js +19 -0
- package/src/TextField/service/TextFiledGetAlignOffsetService.d.ts +15 -0
- package/src/TextField/service/TextFiledGetAlignOffsetService.js +33 -0
- package/src/TextField/usecase/TextFieldDrawOffscreenCanvasUseCase.d.ts +15 -0
- package/src/TextField/usecase/TextFieldDrawOffscreenCanvasUseCase.js +272 -0
- package/src/TextField/usecase/TextFieldRenderUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldRenderUseCase.js +150 -0
- package/src/Video/usecase/VideoRenderUseCase.d.ts +12 -0
- package/src/Video/usecase/VideoRenderUseCase.js +88 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +26 -0
- package/src/interface/IBlendMode.d.ts +1 -0
- package/src/interface/IBlendMode.js +1 -0
- package/src/interface/IMessage.d.ts +11 -0
- package/src/interface/IMessage.js +1 -0
- package/src/interface/INode.d.ts +7 -0
- package/src/interface/INode.js +1 -0
- package/src/interface/IRGBA.d.ts +6 -0
- package/src/interface/IRGBA.js +1 -0
- package/src/interface/ITextData.d.ts +8 -0
- package/src/interface/ITextData.js +1 -0
- package/src/interface/ITextFieldAutoSize.d.ts +1 -0
- package/src/interface/ITextFieldAutoSize.js +1 -0
- package/src/interface/ITextFormat.d.ts +14 -0
- package/src/interface/ITextFormat.js +1 -0
- package/src/interface/ITextFormatAlign.d.ts +1 -0
- package/src/interface/ITextFormatAlign.js +1 -0
- package/src/interface/ITextObject.d.ts +12 -0
- package/src/interface/ITextObject.js +1 -0
- package/src/interface/ITextObjectMode.d.ts +1 -0
- package/src/interface/ITextObjectMode.js +1 -0
- package/src/interface/ITextSetting.d.ts +25 -0
- package/src/interface/ITextSetting.js +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { $context } from "../../RendererUtil";
|
|
2
|
+
import { execute as shapeRenderUseCase } from "../../Shape/usecase/ShapeRenderUseCase";
|
|
3
|
+
import { execute as shapeClipRenderUseCase } from "../../Shape/usecase/ShapeClipRenderUseCase";
|
|
4
|
+
import { execute as textFieldRenderUseCase } from "../../TextField/usecase/TextFieldRenderUseCase";
|
|
5
|
+
import { execute as videoRenderUseCase } from "../../Video/usecase/VideoRenderUseCase";
|
|
6
|
+
import { execute as displayObjectContainerClipRenderUseCase } from "./DisplayObjectContainerClipRenderUseCase";
|
|
7
|
+
/**
|
|
8
|
+
* @description DisplayObjectContainerの描画を実行します。
|
|
9
|
+
* Execute the drawing of DisplayObjectContainer.
|
|
10
|
+
*
|
|
11
|
+
* @param {Float32Array} render_queue
|
|
12
|
+
* @param {number} index
|
|
13
|
+
* @param {ImageBitmap[]} [image_bitmaps=null]
|
|
14
|
+
* @return {number}
|
|
15
|
+
* @method
|
|
16
|
+
* @protected
|
|
17
|
+
*/
|
|
18
|
+
export const execute = (render_queue, index, image_bitmaps) => {
|
|
19
|
+
const useMaskDisplayObject = Boolean(render_queue[index++]);
|
|
20
|
+
if (useMaskDisplayObject) {
|
|
21
|
+
// これまでの描画データを描画して初期化
|
|
22
|
+
$context.drawArraysInstanced();
|
|
23
|
+
// 設定値を保存
|
|
24
|
+
$context.save();
|
|
25
|
+
// マスク描画の開始準備
|
|
26
|
+
$context.beginMask();
|
|
27
|
+
// マスクの範囲を設定
|
|
28
|
+
$context.setMaskBounds(render_queue[index++], render_queue[index++], render_queue[index++], render_queue[index++]);
|
|
29
|
+
const type = render_queue[index++];
|
|
30
|
+
switch (type) {
|
|
31
|
+
case 0x00: // container
|
|
32
|
+
index = displayObjectContainerClipRenderUseCase(render_queue, index);
|
|
33
|
+
break;
|
|
34
|
+
case 0x01: // shape
|
|
35
|
+
index = shapeClipRenderUseCase(render_queue, index);
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
$context.endMask();
|
|
41
|
+
}
|
|
42
|
+
let endClipDepth = 0;
|
|
43
|
+
let canRenderMask = true;
|
|
44
|
+
const length = render_queue[index++];
|
|
45
|
+
for (let idx = 0; length > idx; idx++) {
|
|
46
|
+
const depth = render_queue[index++];
|
|
47
|
+
const clipDepth = render_queue[index++];
|
|
48
|
+
// end mask
|
|
49
|
+
if (endClipDepth && depth > endClipDepth) {
|
|
50
|
+
if (canRenderMask) {
|
|
51
|
+
$context.restore();
|
|
52
|
+
$context.leaveMask();
|
|
53
|
+
}
|
|
54
|
+
// reset
|
|
55
|
+
endClipDepth = 0;
|
|
56
|
+
canRenderMask = true;
|
|
57
|
+
}
|
|
58
|
+
if (!canRenderMask) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// start mask
|
|
62
|
+
if (clipDepth) {
|
|
63
|
+
endClipDepth = clipDepth;
|
|
64
|
+
canRenderMask = Boolean(render_queue[index++]);
|
|
65
|
+
if (!canRenderMask) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// これまでの描画データを描画して初期化
|
|
69
|
+
$context.drawArraysInstanced();
|
|
70
|
+
// 設定値を保存
|
|
71
|
+
$context.save();
|
|
72
|
+
// マスク描画の開始準備
|
|
73
|
+
$context.beginMask();
|
|
74
|
+
// マスクの範囲を設定
|
|
75
|
+
$context.setMaskBounds(render_queue[index++], render_queue[index++], render_queue[index++], render_queue[index++]);
|
|
76
|
+
const type = render_queue[index++];
|
|
77
|
+
switch (type) {
|
|
78
|
+
case 0x00: // container
|
|
79
|
+
index = displayObjectContainerClipRenderUseCase(render_queue, index);
|
|
80
|
+
break;
|
|
81
|
+
case 0x01: // shape
|
|
82
|
+
index = shapeClipRenderUseCase(render_queue, index);
|
|
83
|
+
break;
|
|
84
|
+
// text, videoはマスク対象外
|
|
85
|
+
default:
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
$context.endMask();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
// hidden
|
|
92
|
+
if (!render_queue[index++]) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const type = render_queue[index++];
|
|
96
|
+
switch (type) {
|
|
97
|
+
case 0x00: // container
|
|
98
|
+
index = execute(render_queue, index, image_bitmaps);
|
|
99
|
+
break;
|
|
100
|
+
case 0x01: // shape
|
|
101
|
+
index = shapeRenderUseCase(render_queue, index);
|
|
102
|
+
break;
|
|
103
|
+
case 0x02: // text
|
|
104
|
+
index = textFieldRenderUseCase(render_queue, index);
|
|
105
|
+
break;
|
|
106
|
+
case 0x03: // video
|
|
107
|
+
index = videoRenderUseCase(render_queue, index, image_bitmaps);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
console.error("unknown type", type);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// end mask
|
|
115
|
+
if (endClipDepth || useMaskDisplayObject) {
|
|
116
|
+
$context.restore();
|
|
117
|
+
$context.leaveMask();
|
|
118
|
+
}
|
|
119
|
+
return index;
|
|
120
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { Context } from "@next2d/webgl";
|
|
2
|
+
import type { IRGBA } from "./interface/IRGBA";
|
|
3
|
+
/**
|
|
4
|
+
* @type {number}
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const $samples: number;
|
|
8
|
+
/**
|
|
9
|
+
* @type {Context}
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare let $context: Context;
|
|
13
|
+
/**
|
|
14
|
+
* @description Next2DのWebGLの描画コンテキストを設定
|
|
15
|
+
* Set the drawing context of Next2D's WebGL
|
|
16
|
+
*
|
|
17
|
+
* @param {number} context
|
|
18
|
+
* @return {void}
|
|
19
|
+
* @method
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const $setContext: (context: Context) => void;
|
|
23
|
+
/**
|
|
24
|
+
* @type {CanvasToWebGLContext}
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare let $canvas: OffscreenCanvas;
|
|
28
|
+
/**
|
|
29
|
+
* @description OffscreenCanvasをutilの変数のセット
|
|
30
|
+
* Set OffscreenCanvas to util variable
|
|
31
|
+
*
|
|
32
|
+
* @param {OffscreenCanvas} canvas
|
|
33
|
+
* @return {void}
|
|
34
|
+
* @method
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare const $setCanvas: (canvas: OffscreenCanvas) => void;
|
|
38
|
+
/**
|
|
39
|
+
* @description 描画エリアの幅を返却
|
|
40
|
+
* Returns the width of the drawing area
|
|
41
|
+
*
|
|
42
|
+
* @return {number}
|
|
43
|
+
* @method
|
|
44
|
+
* @protected
|
|
45
|
+
*/
|
|
46
|
+
export declare const $getRendererWidth: () => number;
|
|
47
|
+
/**
|
|
48
|
+
* @description 描画エリアの高さを返却
|
|
49
|
+
* Returns the height of the drawing area
|
|
50
|
+
*
|
|
51
|
+
* @return {number}
|
|
52
|
+
* @method
|
|
53
|
+
* @protected
|
|
54
|
+
*/
|
|
55
|
+
export declare const $getRendererHeight: () => number;
|
|
56
|
+
/**
|
|
57
|
+
* @description 描画エリアの幅を設定
|
|
58
|
+
* Set the width of the drawing area
|
|
59
|
+
*
|
|
60
|
+
* @param {number} width
|
|
61
|
+
* @param {number} height
|
|
62
|
+
* @return {void}
|
|
63
|
+
* @method
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare const $setRendererSize: (width: number, height: number) => void;
|
|
67
|
+
/**
|
|
68
|
+
* @description リサイズ中かどうかを取得
|
|
69
|
+
* Get whether it is being resized
|
|
70
|
+
*
|
|
71
|
+
* @return {boolean}
|
|
72
|
+
* @method
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export declare const $isResize: () => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @description リサイズ処理完了
|
|
78
|
+
* Resize processing complete
|
|
79
|
+
*
|
|
80
|
+
* @return {void}
|
|
81
|
+
* @method
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
export declare const $resizeComplete: () => void;
|
|
85
|
+
/**
|
|
86
|
+
* @description プールされたArrayがあればプールから、なければ新規作成して返却
|
|
87
|
+
* If there is a pooled Array, return it from the pool,
|
|
88
|
+
* otherwise create a new one and return it.
|
|
89
|
+
*
|
|
90
|
+
* @param {number} x_min
|
|
91
|
+
* @param {number} y_min
|
|
92
|
+
* @param {number} x_max
|
|
93
|
+
* @param {number} y_max
|
|
94
|
+
* @return {number[]}
|
|
95
|
+
* @method
|
|
96
|
+
* @protected
|
|
97
|
+
*/
|
|
98
|
+
export declare const $getBoundsArray: (x_min: number, y_min: number, x_max: number, y_max: number) => Float32Array;
|
|
99
|
+
/**
|
|
100
|
+
* @description 使用済みになったBoundsのArrayをプール
|
|
101
|
+
* Pool used Bounds Array.
|
|
102
|
+
*
|
|
103
|
+
* @param {Float32Array} array
|
|
104
|
+
* @method
|
|
105
|
+
* @protected
|
|
106
|
+
*/
|
|
107
|
+
export declare const $poolBoundsArray: (array: Float32Array) => void;
|
|
108
|
+
/**
|
|
109
|
+
* @description プールされたArrayがあればプールから、なければ新規作成して返却
|
|
110
|
+
* If there is a pooled Array, return it from the pool,
|
|
111
|
+
* otherwise create a new one and return it.
|
|
112
|
+
*
|
|
113
|
+
* @param {array} args
|
|
114
|
+
* @return {array}
|
|
115
|
+
* @method
|
|
116
|
+
* @protected
|
|
117
|
+
*/
|
|
118
|
+
export declare const $getArray: (...args: any[]) => any[];
|
|
119
|
+
/**
|
|
120
|
+
* @description 使用済みになったArrayをプール
|
|
121
|
+
* Pool used Array.
|
|
122
|
+
*
|
|
123
|
+
* @param {array} array
|
|
124
|
+
* @return {void}
|
|
125
|
+
* @method
|
|
126
|
+
* @protected
|
|
127
|
+
*/
|
|
128
|
+
export declare const $poolArray: (array: any[]) => void;
|
|
129
|
+
/**
|
|
130
|
+
* @param {number} color
|
|
131
|
+
* @param {number} [alpha=1]
|
|
132
|
+
* @returns {IRGBA}
|
|
133
|
+
* @method
|
|
134
|
+
* @static
|
|
135
|
+
*/
|
|
136
|
+
export declare const $intToRGBA: (color: number, alpha?: number) => IRGBA;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {number}
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export const $samples = 4;
|
|
6
|
+
/**
|
|
7
|
+
* @type {Context}
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export let $context;
|
|
11
|
+
/**
|
|
12
|
+
* @description Next2DのWebGLの描画コンテキストを設定
|
|
13
|
+
* Set the drawing context of Next2D's WebGL
|
|
14
|
+
*
|
|
15
|
+
* @param {number} context
|
|
16
|
+
* @return {void}
|
|
17
|
+
* @method
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export const $setContext = (context) => {
|
|
21
|
+
$context = context;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @type {CanvasToWebGLContext}
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export let $canvas;
|
|
28
|
+
/**
|
|
29
|
+
* @description OffscreenCanvasをutilの変数のセット
|
|
30
|
+
* Set OffscreenCanvas to util variable
|
|
31
|
+
*
|
|
32
|
+
* @param {OffscreenCanvas} canvas
|
|
33
|
+
* @return {void}
|
|
34
|
+
* @method
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export const $setCanvas = (canvas) => {
|
|
38
|
+
$canvas = canvas;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @type {number}
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
let $rendererWidth = 0;
|
|
45
|
+
/**
|
|
46
|
+
* @description 描画エリアの幅を返却
|
|
47
|
+
* Returns the width of the drawing area
|
|
48
|
+
*
|
|
49
|
+
* @return {number}
|
|
50
|
+
* @method
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
53
|
+
export const $getRendererWidth = () => {
|
|
54
|
+
return $rendererWidth;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @type {number}
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
let $rendererHeight = 0;
|
|
61
|
+
/**
|
|
62
|
+
* @description 描画エリアの高さを返却
|
|
63
|
+
* Returns the height of the drawing area
|
|
64
|
+
*
|
|
65
|
+
* @return {number}
|
|
66
|
+
* @method
|
|
67
|
+
* @protected
|
|
68
|
+
*/
|
|
69
|
+
export const $getRendererHeight = () => {
|
|
70
|
+
return $rendererHeight;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @type {boolean}
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
let $resizeState = false;
|
|
77
|
+
/**
|
|
78
|
+
* @description 描画エリアの幅を設定
|
|
79
|
+
* Set the width of the drawing area
|
|
80
|
+
*
|
|
81
|
+
* @param {number} width
|
|
82
|
+
* @param {number} height
|
|
83
|
+
* @return {void}
|
|
84
|
+
* @method
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export const $setRendererSize = (width, height) => {
|
|
88
|
+
$resizeState = true;
|
|
89
|
+
$rendererWidth = width;
|
|
90
|
+
$rendererHeight = height;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* @description リサイズ中かどうかを取得
|
|
94
|
+
* Get whether it is being resized
|
|
95
|
+
*
|
|
96
|
+
* @return {boolean}
|
|
97
|
+
* @method
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
export const $isResize = () => {
|
|
101
|
+
return $resizeState;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @description リサイズ処理完了
|
|
105
|
+
* Resize processing complete
|
|
106
|
+
*
|
|
107
|
+
* @return {void}
|
|
108
|
+
* @method
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export const $resizeComplete = () => {
|
|
112
|
+
$canvas.width = $rendererWidth;
|
|
113
|
+
$canvas.height = $rendererHeight;
|
|
114
|
+
$resizeState = false;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* @description 使用済みになったBoundsのArrayのプール配列
|
|
118
|
+
* Pool array of used Bounds Array.
|
|
119
|
+
*
|
|
120
|
+
* @type {Float32Array[]}
|
|
121
|
+
* @const
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
const $boundsArrays = [];
|
|
125
|
+
/**
|
|
126
|
+
* @description プールされたArrayがあればプールから、なければ新規作成して返却
|
|
127
|
+
* If there is a pooled Array, return it from the pool,
|
|
128
|
+
* otherwise create a new one and return it.
|
|
129
|
+
*
|
|
130
|
+
* @param {number} x_min
|
|
131
|
+
* @param {number} y_min
|
|
132
|
+
* @param {number} x_max
|
|
133
|
+
* @param {number} y_max
|
|
134
|
+
* @return {number[]}
|
|
135
|
+
* @method
|
|
136
|
+
* @protected
|
|
137
|
+
*/
|
|
138
|
+
export const $getBoundsArray = (x_min, y_min, x_max, y_max) => {
|
|
139
|
+
const array = $boundsArrays.length
|
|
140
|
+
? $boundsArrays.pop()
|
|
141
|
+
: new Float32Array(4);
|
|
142
|
+
array[0] = x_min;
|
|
143
|
+
array[1] = y_min;
|
|
144
|
+
array[2] = x_max;
|
|
145
|
+
array[3] = y_max;
|
|
146
|
+
return array;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* @description 使用済みになったBoundsのArrayをプール
|
|
150
|
+
* Pool used Bounds Array.
|
|
151
|
+
*
|
|
152
|
+
* @param {Float32Array} array
|
|
153
|
+
* @method
|
|
154
|
+
* @protected
|
|
155
|
+
*/
|
|
156
|
+
export const $poolBoundsArray = (array) => {
|
|
157
|
+
$boundsArrays.push(array);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* @description 使用済みになったArrayのプール配列
|
|
161
|
+
* Pool array of used Array.
|
|
162
|
+
*
|
|
163
|
+
* @type {array[]}
|
|
164
|
+
* @const
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
const $arrays = [];
|
|
168
|
+
/**
|
|
169
|
+
* @description プールされたArrayがあればプールから、なければ新規作成して返却
|
|
170
|
+
* If there is a pooled Array, return it from the pool,
|
|
171
|
+
* otherwise create a new one and return it.
|
|
172
|
+
*
|
|
173
|
+
* @param {array} args
|
|
174
|
+
* @return {array}
|
|
175
|
+
* @method
|
|
176
|
+
* @protected
|
|
177
|
+
*/
|
|
178
|
+
export const $getArray = (...args) => {
|
|
179
|
+
const array = $arrays.pop() || [];
|
|
180
|
+
if (args.length) {
|
|
181
|
+
array.push(...args);
|
|
182
|
+
}
|
|
183
|
+
return array;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* @description 使用済みになったArrayをプール
|
|
187
|
+
* Pool used Array.
|
|
188
|
+
*
|
|
189
|
+
* @param {array} array
|
|
190
|
+
* @return {void}
|
|
191
|
+
* @method
|
|
192
|
+
* @protected
|
|
193
|
+
*/
|
|
194
|
+
export const $poolArray = (array) => {
|
|
195
|
+
if (array.length) {
|
|
196
|
+
array.length = 0;
|
|
197
|
+
}
|
|
198
|
+
$arrays.push(array);
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* @param {number} color
|
|
202
|
+
* @param {number} [alpha=1]
|
|
203
|
+
* @returns {IRGBA}
|
|
204
|
+
* @method
|
|
205
|
+
* @static
|
|
206
|
+
*/
|
|
207
|
+
export const $intToRGBA = (color, alpha = 1) => {
|
|
208
|
+
return {
|
|
209
|
+
"R": (color & 0xff0000) >> 16,
|
|
210
|
+
"G": (color & 0x00ff00) >> 8,
|
|
211
|
+
"B": color & 0x0000ff,
|
|
212
|
+
"A": alpha * 255
|
|
213
|
+
};
|
|
214
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Shapeのグラフィックコマンドを実行します。
|
|
3
|
+
* Execute the graphic commands of Shape.
|
|
4
|
+
*
|
|
5
|
+
* @param {Float32Array} commands
|
|
6
|
+
* @param {boolean} [is_clip=false]
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @method
|
|
9
|
+
* @protected
|
|
10
|
+
*/
|
|
11
|
+
export declare const execute: (commands: Float32Array, is_clip?: boolean) => void;
|