@next2d/player 1.14.9 → 1.14.13
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/dist/player/index.js +5 -3
- package/dist/player/next2d/display/GraphicsGradientFill.d.ts +1 -1
- package/dist/player/next2d/display/GraphicsGradientFill.js +6 -2
- package/dist/player/next2d/display/Loader.d.ts +1 -1
- package/dist/player/player/Next2D.d.ts +1 -2
- package/dist/player/player/Next2D.js +7 -11
- package/package.json +1 -1
- package/dist/interface/ClassNameMap.d.ts +0 -4
- package/dist/interface/ClassNameMap.js +0 -1
- package/dist/interface/RenderDisplayObjectImpl.d.ts +0 -2
- package/dist/interface/RenderDisplayObjectImpl.js +0 -1
- package/dist/interface/TextFormatImpl.d.ts +0 -16
- package/dist/interface/TextFormatImpl.js +0 -1
- package/dist/interface/TextModeImpl.d.ts +0 -1
- package/dist/interface/TextModeImpl.js +0 -1
- package/dist/renderer/RenderDisplayObject.d.ts +0 -129
- package/dist/renderer/RenderDisplayObject.js +0 -567
- package/dist/renderer/RenderDisplayObjectContainer.d.ts +0 -70
- package/dist/renderer/RenderDisplayObjectContainer.js +0 -670
- package/dist/renderer/RenderGlobal.d.ts +0 -76
- package/dist/renderer/RenderGlobal.js +0 -88
- package/dist/renderer/RenderGraphics.d.ts +0 -90
- package/dist/renderer/RenderGraphics.js +0 -597
- package/dist/renderer/RenderPlayer.d.ts +0 -164
- package/dist/renderer/RenderPlayer.js +0 -421
- package/dist/renderer/RenderShape.d.ts +0 -32
- package/dist/renderer/RenderShape.js +0 -104
- package/dist/renderer/RenderTextField.d.ts +0 -119
- package/dist/renderer/RenderTextField.js +0 -709
- package/dist/renderer/RenderVideo.d.ts +0 -59
- package/dist/renderer/RenderVideo.js +0 -272
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { RenderDisplayObject } from "./RenderDisplayObject";
|
|
2
|
-
import type { CanvasToWebGLContext } from "../webgl/CanvasToWebGLContext";
|
|
3
|
-
import type { PropertyVideoMessageImpl } from "../interface/PropertyVideoMessageImpl";
|
|
4
|
-
/**
|
|
5
|
-
* @class
|
|
6
|
-
*/
|
|
7
|
-
export declare class RenderVideo extends RenderDisplayObject {
|
|
8
|
-
private _$imageBitmap;
|
|
9
|
-
private _$context;
|
|
10
|
-
private _$smoothing;
|
|
11
|
-
/**
|
|
12
|
-
* @constructor
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
constructor();
|
|
16
|
-
/**
|
|
17
|
-
* @param {CanvasToWebGLContext} context
|
|
18
|
-
* @param {Float32Array} matrix
|
|
19
|
-
* @return {void}
|
|
20
|
-
* @method
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
_$clip(context: CanvasToWebGLContext, matrix: Float32Array): void;
|
|
24
|
-
/**
|
|
25
|
-
* @param {CanvasToWebGLContext} context
|
|
26
|
-
* @param {Float32Array} matrix
|
|
27
|
-
* @param {Float32Array} color_transform
|
|
28
|
-
* @return {void}
|
|
29
|
-
* @method
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
_$draw(context: CanvasToWebGLContext, matrix: Float32Array, color_transform: Float32Array): void;
|
|
33
|
-
/**
|
|
34
|
-
* @description Playerから登録を削除
|
|
35
|
-
*
|
|
36
|
-
* @return {void}
|
|
37
|
-
* @method
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
_$remove(): void;
|
|
41
|
-
/**
|
|
42
|
-
* @description 情報を更新
|
|
43
|
-
*
|
|
44
|
-
* @param {object} object
|
|
45
|
-
* @return {void}
|
|
46
|
-
* @method
|
|
47
|
-
* @private
|
|
48
|
-
*/
|
|
49
|
-
_$updateProperty(object: PropertyVideoMessageImpl): void;
|
|
50
|
-
/**
|
|
51
|
-
* @description 描画情報を更新
|
|
52
|
-
*
|
|
53
|
-
* @param {object} object
|
|
54
|
-
* @return {void}
|
|
55
|
-
* @method
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
_$update(object: PropertyVideoMessageImpl): void;
|
|
59
|
-
}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { RenderDisplayObject } from "./RenderDisplayObject";
|
|
2
|
-
import { Rectangle } from "../player/next2d/geom/Rectangle";
|
|
3
|
-
import { $boundsMatrix, $clamp, $Infinity, $Math, $multiplicationColor, $multiplicationMatrix, $poolBoundsObject, $poolFloat32Array6, $poolFloat32Array8, $OffscreenCanvas, $getFloat32Array6 } from "../player/util/RenderUtil";
|
|
4
|
-
import { $videos } from "./RenderGlobal";
|
|
5
|
-
/**
|
|
6
|
-
* @class
|
|
7
|
-
*/
|
|
8
|
-
export class RenderVideo extends RenderDisplayObject {
|
|
9
|
-
_$imageBitmap;
|
|
10
|
-
_$context;
|
|
11
|
-
_$smoothing;
|
|
12
|
-
/**
|
|
13
|
-
* @constructor
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
/**
|
|
19
|
-
* @type {ImageBitmap}
|
|
20
|
-
* @default null
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
this._$imageBitmap = null;
|
|
24
|
-
/**
|
|
25
|
-
* @type {OffscreenCanvasRenderingContext2D}
|
|
26
|
-
* @default null
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
this._$context = null;
|
|
30
|
-
/**
|
|
31
|
-
* @type {boolean}
|
|
32
|
-
* @default true
|
|
33
|
-
* @private
|
|
34
|
-
*/
|
|
35
|
-
this._$smoothing = true;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @param {CanvasToWebGLContext} context
|
|
39
|
-
* @param {Float32Array} matrix
|
|
40
|
-
* @return {void}
|
|
41
|
-
* @method
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
_$clip(context, matrix) {
|
|
45
|
-
const width = this._$xMax;
|
|
46
|
-
const height = this._$yMax;
|
|
47
|
-
if (!width || !height) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let multiMatrix = matrix;
|
|
51
|
-
const rawMatrix = this._$matrix;
|
|
52
|
-
if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
|
|
53
|
-
|| rawMatrix[2] !== 0 || rawMatrix[3] !== 1
|
|
54
|
-
|| rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
|
|
55
|
-
multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
|
|
56
|
-
}
|
|
57
|
-
context.reset();
|
|
58
|
-
context.setTransform(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], multiMatrix[4], multiMatrix[5]);
|
|
59
|
-
context.beginPath();
|
|
60
|
-
context.moveTo(0, 0);
|
|
61
|
-
context.lineTo(width, 0);
|
|
62
|
-
context.lineTo(width, height);
|
|
63
|
-
context.lineTo(0, height);
|
|
64
|
-
context.lineTo(0, 0);
|
|
65
|
-
context.clip();
|
|
66
|
-
if (multiMatrix !== matrix) {
|
|
67
|
-
$poolFloat32Array6(multiMatrix);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @param {CanvasToWebGLContext} context
|
|
72
|
-
* @param {Float32Array} matrix
|
|
73
|
-
* @param {Float32Array} color_transform
|
|
74
|
-
* @return {void}
|
|
75
|
-
* @method
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
_$draw(context, matrix, color_transform) {
|
|
79
|
-
if (!this._$visible
|
|
80
|
-
|| !this._$imageBitmap
|
|
81
|
-
|| !this._$context) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
let multiColor = color_transform;
|
|
85
|
-
const rawColor = this._$colorTransform;
|
|
86
|
-
if (rawColor[0] !== 1 || rawColor[1] !== 1
|
|
87
|
-
|| rawColor[2] !== 1 || rawColor[3] !== 1
|
|
88
|
-
|| rawColor[4] !== 0 || rawColor[5] !== 0
|
|
89
|
-
|| rawColor[6] !== 0 || rawColor[7] !== 0) {
|
|
90
|
-
multiColor = $multiplicationColor(color_transform, rawColor);
|
|
91
|
-
}
|
|
92
|
-
const alpha = $clamp(multiColor[3] + multiColor[7] / 255, 0, 1, 0);
|
|
93
|
-
if (!alpha) {
|
|
94
|
-
if (multiColor !== color_transform) {
|
|
95
|
-
$poolFloat32Array8(multiColor);
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
let multiMatrix = matrix;
|
|
100
|
-
const rawMatrix = this._$matrix;
|
|
101
|
-
if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
|
|
102
|
-
|| rawMatrix[2] !== 0 || rawMatrix[3] !== 1
|
|
103
|
-
|| rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
|
|
104
|
-
multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
|
|
105
|
-
}
|
|
106
|
-
// default bounds
|
|
107
|
-
const baseBounds = this._$getBounds();
|
|
108
|
-
$poolBoundsObject(baseBounds);
|
|
109
|
-
const bounds = $boundsMatrix(baseBounds, multiMatrix);
|
|
110
|
-
const xMax = +bounds.xMax;
|
|
111
|
-
const xMin = +bounds.xMin;
|
|
112
|
-
const yMax = +bounds.yMax;
|
|
113
|
-
const yMin = +bounds.yMin;
|
|
114
|
-
$poolBoundsObject(bounds);
|
|
115
|
-
const width = $Math.ceil($Math.abs(xMax - xMin));
|
|
116
|
-
const height = $Math.ceil($Math.abs(yMax - yMin));
|
|
117
|
-
switch (true) {
|
|
118
|
-
case width === 0:
|
|
119
|
-
case height === 0:
|
|
120
|
-
case width === 0 - $Infinity:
|
|
121
|
-
case height === 0 - $Infinity:
|
|
122
|
-
case width === $Infinity:
|
|
123
|
-
case height === $Infinity:
|
|
124
|
-
return;
|
|
125
|
-
default:
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
// cache current buffer
|
|
129
|
-
const manager = context.frameBuffer;
|
|
130
|
-
const currentAttachment = manager.currentAttachment;
|
|
131
|
-
if (!currentAttachment
|
|
132
|
-
|| xMin > currentAttachment.width
|
|
133
|
-
|| yMin > currentAttachment.height) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (0 > xMin + width || 0 > yMin + height) {
|
|
137
|
-
if (this._$filters
|
|
138
|
-
&& this._$filters.length
|
|
139
|
-
&& this._$canApply(this._$filters)) {
|
|
140
|
-
const xScale = +$Math.sqrt(multiMatrix[0] * multiMatrix[0]
|
|
141
|
-
+ multiMatrix[1] * multiMatrix[1]);
|
|
142
|
-
const yScale = +$Math.sqrt(multiMatrix[2] * multiMatrix[2]
|
|
143
|
-
+ multiMatrix[3] * multiMatrix[3]);
|
|
144
|
-
let rect = new Rectangle(0, 0, width, height);
|
|
145
|
-
for (let idx = 0; idx < this._$filters.length; ++idx) {
|
|
146
|
-
rect = this._$filters[idx]
|
|
147
|
-
._$generateFilterRect(rect, xScale, yScale);
|
|
148
|
-
}
|
|
149
|
-
if (0 > rect.x + rect.width || 0 > rect.y + rect.height) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
this._$context.drawImage(this._$imageBitmap, 0, 0);
|
|
158
|
-
let texture = manager
|
|
159
|
-
.textureManager
|
|
160
|
-
._$createFromElement(this._$imageBitmap.width, this._$imageBitmap.height, this._$context.canvas, this._$smoothing);
|
|
161
|
-
if (this._$filters
|
|
162
|
-
&& this._$filters.length
|
|
163
|
-
&& this._$canApply(this._$filters)) {
|
|
164
|
-
const xScale = +$Math.sqrt(multiMatrix[0] * multiMatrix[0]
|
|
165
|
-
+ multiMatrix[1] * multiMatrix[1]);
|
|
166
|
-
const yScale = +$Math.sqrt(multiMatrix[2] * multiMatrix[2]
|
|
167
|
-
+ multiMatrix[3] * multiMatrix[3]);
|
|
168
|
-
if (xScale !== 1 || yScale !== 1) {
|
|
169
|
-
const currentAttachment = manager.currentAttachment;
|
|
170
|
-
// create cache buffer
|
|
171
|
-
const attachment = manager
|
|
172
|
-
.createCacheAttachment(width, height, false);
|
|
173
|
-
context._$bind(attachment);
|
|
174
|
-
const parentMatrix = $getFloat32Array6(xScale, 0, 0, yScale, width / 2, height / 2);
|
|
175
|
-
const baseMatrix = $getFloat32Array6(1, 0, 0, 1, 0 - texture.width / 2, 0 - texture.height / 2);
|
|
176
|
-
const scaleMatrix = $multiplicationMatrix(parentMatrix, baseMatrix);
|
|
177
|
-
$poolFloat32Array6(parentMatrix);
|
|
178
|
-
$poolFloat32Array6(baseMatrix);
|
|
179
|
-
context.reset();
|
|
180
|
-
context.setTransform(scaleMatrix[0], scaleMatrix[1], scaleMatrix[2], scaleMatrix[3], scaleMatrix[4], scaleMatrix[5]);
|
|
181
|
-
context.drawImage(texture, 0, 0, texture.width, texture.height);
|
|
182
|
-
manager.releaseTexture(texture);
|
|
183
|
-
$poolFloat32Array6(scaleMatrix);
|
|
184
|
-
texture = manager.getTextureFromCurrentAttachment();
|
|
185
|
-
// release buffer
|
|
186
|
-
manager.releaseAttachment(attachment, false);
|
|
187
|
-
// end draw and reset current buffer
|
|
188
|
-
context._$bind(currentAttachment);
|
|
189
|
-
}
|
|
190
|
-
// draw filter
|
|
191
|
-
texture = this._$drawFilter(context, texture, multiMatrix, this._$filters, width, height);
|
|
192
|
-
// draw
|
|
193
|
-
context.reset();
|
|
194
|
-
context.globalAlpha = alpha;
|
|
195
|
-
context.imageSmoothingEnabled = this._$smoothing;
|
|
196
|
-
context.globalCompositeOperation = this._$blendMode;
|
|
197
|
-
// size
|
|
198
|
-
const baseBounds = this._$getBounds();
|
|
199
|
-
const bounds = $boundsMatrix(baseBounds, multiMatrix);
|
|
200
|
-
$poolBoundsObject(baseBounds);
|
|
201
|
-
context.setTransform(1, 0, 0, 1, bounds.xMin - texture._$offsetX, bounds.yMin - texture._$offsetY);
|
|
202
|
-
$poolBoundsObject(bounds);
|
|
203
|
-
context.drawImage(texture, 0, 0, texture.width, texture.height, color_transform);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
// draw
|
|
207
|
-
context.reset();
|
|
208
|
-
context.globalAlpha = alpha;
|
|
209
|
-
context.imageSmoothingEnabled = this._$smoothing;
|
|
210
|
-
context.globalCompositeOperation = this._$blendMode;
|
|
211
|
-
context.setTransform(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], multiMatrix[4], multiMatrix[5]);
|
|
212
|
-
context.drawImage(texture, 0, 0, texture.width, texture.height, color_transform);
|
|
213
|
-
manager.releaseTexture(texture);
|
|
214
|
-
}
|
|
215
|
-
if (multiMatrix !== matrix) {
|
|
216
|
-
$poolFloat32Array6(multiMatrix);
|
|
217
|
-
}
|
|
218
|
-
if (multiColor !== color_transform) {
|
|
219
|
-
$poolFloat32Array8(multiColor);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @description Playerから登録を削除
|
|
224
|
-
*
|
|
225
|
-
* @return {void}
|
|
226
|
-
* @method
|
|
227
|
-
* @private
|
|
228
|
-
*/
|
|
229
|
-
_$remove() {
|
|
230
|
-
this._$xMin = 0;
|
|
231
|
-
this._$yMin = 0;
|
|
232
|
-
this._$xMax = 0;
|
|
233
|
-
this._$yMax = 0;
|
|
234
|
-
this._$context = null;
|
|
235
|
-
this._$imageBitmap = null;
|
|
236
|
-
this._$smoothing = true;
|
|
237
|
-
super._$remove();
|
|
238
|
-
$videos.push(this);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* @description 情報を更新
|
|
242
|
-
*
|
|
243
|
-
* @param {object} object
|
|
244
|
-
* @return {void}
|
|
245
|
-
* @method
|
|
246
|
-
* @private
|
|
247
|
-
*/
|
|
248
|
-
_$updateProperty(object) {
|
|
249
|
-
this._$xMin = object.xMin;
|
|
250
|
-
this._$yMin = object.yMin;
|
|
251
|
-
this._$xMax = object.xMax;
|
|
252
|
-
this._$yMax = object.yMax;
|
|
253
|
-
this._$imageBitmap = object.imageBitmap;
|
|
254
|
-
this._$smoothing = object.smoothing;
|
|
255
|
-
if (!this._$context && this._$imageBitmap) {
|
|
256
|
-
const canvas = new $OffscreenCanvas(this._$imageBitmap.width, this._$imageBitmap.height);
|
|
257
|
-
this._$context = canvas.getContext("2d");
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* @description 描画情報を更新
|
|
262
|
-
*
|
|
263
|
-
* @param {object} object
|
|
264
|
-
* @return {void}
|
|
265
|
-
* @method
|
|
266
|
-
* @private
|
|
267
|
-
*/
|
|
268
|
-
_$update(object) {
|
|
269
|
-
super._$update(object);
|
|
270
|
-
this._$updateProperty(object);
|
|
271
|
-
}
|
|
272
|
-
}
|