@next2d/display 1.15.0 → 1.16.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/dist/BitmapData.d.ts +10 -1
- package/dist/BitmapData.js +55 -25
- package/dist/DisplayObject.d.ts +10 -11
- package/dist/DisplayObject.js +164 -125
- package/dist/DisplayObjectContainer.d.ts +2 -2
- package/dist/DisplayObjectContainer.js +158 -249
- package/dist/Graphics.d.ts +18 -1
- package/dist/Graphics.js +233 -107
- package/dist/Loader.js +8 -18
- package/dist/MovieClip.js +1 -1
- package/dist/Shape.d.ts +0 -2
- package/dist/Shape.js +15 -13
- package/dist/Stage.js +1 -2
- package/package.json +10 -10
package/dist/BitmapData.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class BitmapData {
|
|
|
19
19
|
_$buffer: Uint8Array | null;
|
|
20
20
|
private _$image;
|
|
21
21
|
private _$canvas;
|
|
22
|
-
private _$
|
|
22
|
+
private _$texture;
|
|
23
23
|
/**
|
|
24
24
|
* @param {number} [width=0]
|
|
25
25
|
* @param {number} [height=0]
|
|
@@ -67,6 +67,15 @@ export declare class BitmapData {
|
|
|
67
67
|
* @public
|
|
68
68
|
*/
|
|
69
69
|
get namespace(): string;
|
|
70
|
+
/**
|
|
71
|
+
* @description ビットマップイメージのID
|
|
72
|
+
* Bitmap image ID.
|
|
73
|
+
*
|
|
74
|
+
* @return {number}
|
|
75
|
+
* @readonly
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
get instanceId(): number;
|
|
70
79
|
/**
|
|
71
80
|
* @description ビットマップイメージの高さ(ピクセル単位)です。
|
|
72
81
|
* The height of the bitmap image in pixels.
|
package/dist/BitmapData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DisplayObjectContainer } from "./DisplayObjectContainer";
|
|
2
|
-
import { $COLOR_ARRAY_IDENTITY, $getArray, $MATRIX_ARRAY_IDENTITY, $multiplicationMatrix, $poolArray } from "@next2d/share";
|
|
2
|
+
import { $COLOR_ARRAY_IDENTITY, $getArray, $MATRIX_ARRAY_IDENTITY, $multiplicationMatrix, $poolArray, $cacheStore } from "@next2d/share";
|
|
3
3
|
import { $getInstanceId, $bitmapDrawMap, $currentPlayer, $poolColorTransform, $poolMatrix, $postContainerWorker, $rendererWorker } from "@next2d/util";
|
|
4
4
|
/**
|
|
5
5
|
* BitmapData クラスを使用すると、Bitmap オブジェクトのデータ (ピクセル) を処理できます。
|
|
@@ -57,11 +57,11 @@ export class BitmapData {
|
|
|
57
57
|
*/
|
|
58
58
|
this._$canvas = null;
|
|
59
59
|
/**
|
|
60
|
-
* @type {
|
|
60
|
+
* @type {WebGLTexture}
|
|
61
61
|
* @type {null}
|
|
62
62
|
* @private
|
|
63
63
|
*/
|
|
64
|
-
this._$
|
|
64
|
+
this._$texture = null;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* @description 指定されたクラスのストリングを返します。
|
|
@@ -111,6 +111,17 @@ export class BitmapData {
|
|
|
111
111
|
get namespace() {
|
|
112
112
|
return "next2d.display.BitmapData";
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* @description ビットマップイメージのID
|
|
116
|
+
* Bitmap image ID.
|
|
117
|
+
*
|
|
118
|
+
* @return {number}
|
|
119
|
+
* @readonly
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
get instanceId() {
|
|
123
|
+
return this._$instanceId;
|
|
124
|
+
}
|
|
114
125
|
/**
|
|
115
126
|
* @description ビットマップイメージの高さ(ピクセル単位)です。
|
|
116
127
|
* The height of the bitmap image in pixels.
|
|
@@ -133,7 +144,17 @@ export class BitmapData {
|
|
|
133
144
|
return this._$buffer;
|
|
134
145
|
}
|
|
135
146
|
set buffer(buffer) {
|
|
147
|
+
this._$canvas = null;
|
|
148
|
+
this._$image = null;
|
|
136
149
|
this._$buffer = buffer;
|
|
150
|
+
if (this._$texture) {
|
|
151
|
+
const player = $currentPlayer();
|
|
152
|
+
const context = player.context;
|
|
153
|
+
if (context) {
|
|
154
|
+
context.frameBuffer.releaseTexture(this._$texture);
|
|
155
|
+
}
|
|
156
|
+
this._$texture = null;
|
|
157
|
+
}
|
|
137
158
|
}
|
|
138
159
|
/**
|
|
139
160
|
* @description Imageクラスを利用して BitmapData を生成します。
|
|
@@ -147,7 +168,16 @@ export class BitmapData {
|
|
|
147
168
|
}
|
|
148
169
|
set image(image) {
|
|
149
170
|
this._$canvas = null;
|
|
171
|
+
this._$buffer = null;
|
|
150
172
|
this._$image = image;
|
|
173
|
+
if (this._$texture) {
|
|
174
|
+
const player = $currentPlayer();
|
|
175
|
+
const context = player.context;
|
|
176
|
+
if (context) {
|
|
177
|
+
context.frameBuffer.releaseTexture(this._$texture);
|
|
178
|
+
}
|
|
179
|
+
this._$texture = null;
|
|
180
|
+
}
|
|
151
181
|
if (!image) {
|
|
152
182
|
return;
|
|
153
183
|
}
|
|
@@ -166,7 +196,16 @@ export class BitmapData {
|
|
|
166
196
|
}
|
|
167
197
|
set canvas(canvas) {
|
|
168
198
|
this._$image = null;
|
|
199
|
+
this._$buffer = null;
|
|
169
200
|
this._$canvas = canvas;
|
|
201
|
+
if (this._$texture) {
|
|
202
|
+
const player = $currentPlayer();
|
|
203
|
+
const context = player.context;
|
|
204
|
+
if (context) {
|
|
205
|
+
context.frameBuffer.releaseTexture(this._$texture);
|
|
206
|
+
}
|
|
207
|
+
this._$texture = null;
|
|
208
|
+
}
|
|
170
209
|
if (!canvas) {
|
|
171
210
|
return;
|
|
172
211
|
}
|
|
@@ -197,9 +236,7 @@ export class BitmapData {
|
|
|
197
236
|
clone() {
|
|
198
237
|
const bitmapData = new BitmapData(this.width, this.height);
|
|
199
238
|
if (this._$image !== null || this._$canvas !== null) {
|
|
200
|
-
const
|
|
201
|
-
const cacheStore = player.cacheStore;
|
|
202
|
-
const canvas = cacheStore.getCanvas();
|
|
239
|
+
const canvas = $cacheStore.getCanvas();
|
|
203
240
|
canvas.width = this.width;
|
|
204
241
|
canvas.height = this.height;
|
|
205
242
|
const context = canvas.getContext("2d");
|
|
@@ -234,22 +271,25 @@ export class BitmapData {
|
|
|
234
271
|
if (!context) {
|
|
235
272
|
throw new Error("the context is null.");
|
|
236
273
|
}
|
|
274
|
+
if (this._$texture !== null) {
|
|
275
|
+
return this._$texture;
|
|
276
|
+
}
|
|
237
277
|
if (this._$image !== null) {
|
|
238
|
-
|
|
278
|
+
this._$texture = context
|
|
239
279
|
.frameBuffer
|
|
240
280
|
.createTextureFromImage(this._$image);
|
|
241
281
|
}
|
|
242
282
|
if (this._$canvas !== null) {
|
|
243
|
-
|
|
283
|
+
this._$texture = context
|
|
244
284
|
.frameBuffer
|
|
245
285
|
.createTextureFromCanvas(this._$canvas);
|
|
246
286
|
}
|
|
247
287
|
if (this._$buffer !== null) {
|
|
248
|
-
|
|
288
|
+
this._$texture = context
|
|
249
289
|
.frameBuffer
|
|
250
290
|
.createTextureFromPixels(width, height, this._$buffer, true);
|
|
251
291
|
}
|
|
252
|
-
return
|
|
292
|
+
return this._$texture;
|
|
253
293
|
}
|
|
254
294
|
/**
|
|
255
295
|
* @param {DisplayObject} source
|
|
@@ -287,7 +327,7 @@ export class BitmapData {
|
|
|
287
327
|
$poolMatrix(matrix);
|
|
288
328
|
}
|
|
289
329
|
if (!canvas) {
|
|
290
|
-
canvas =
|
|
330
|
+
canvas = $cacheStore.getCanvas();
|
|
291
331
|
}
|
|
292
332
|
if ($rendererWorker) {
|
|
293
333
|
if (!source._$stage) {
|
|
@@ -343,23 +383,16 @@ export class BitmapData {
|
|
|
343
383
|
if (!context) {
|
|
344
384
|
throw new Error("the context is null.");
|
|
345
385
|
}
|
|
346
|
-
const manager = context.frameBuffer;
|
|
347
|
-
const currentAttachment = manager.currentAttachment;
|
|
348
|
-
context._$bind(player._$attachment);
|
|
349
386
|
// reset
|
|
350
387
|
context.reset();
|
|
351
388
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
352
389
|
context.clearRect(0, 0, player._$width, player._$height);
|
|
353
390
|
context.beginPath();
|
|
354
391
|
source._$draw(context, tMatrix, colorTransform);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
context.reset();
|
|
360
|
-
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
361
|
-
context.clearRect(0, 0, texture.width + 1, texture.height + 1);
|
|
362
|
-
context.drawImage(texture, 0, 0, texture.width, texture.height);
|
|
392
|
+
context.drawInstacedArray();
|
|
393
|
+
context
|
|
394
|
+
.frameBuffer
|
|
395
|
+
.transferToMainTexture();
|
|
363
396
|
canvas.width = width;
|
|
364
397
|
canvas.height = height;
|
|
365
398
|
const ctx = canvas.getContext("2d");
|
|
@@ -369,9 +402,6 @@ export class BitmapData {
|
|
|
369
402
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
370
403
|
ctx.clearRect(0, 0, width, height);
|
|
371
404
|
ctx.drawImage(player.canvas, 0, 0);
|
|
372
|
-
if (currentAttachment) {
|
|
373
|
-
context._$bind(currentAttachment);
|
|
374
|
-
}
|
|
375
405
|
if (callback) {
|
|
376
406
|
callback(canvas);
|
|
377
407
|
}
|
package/dist/DisplayObject.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { LoaderInfo } from "./LoaderInfo";
|
|
|
3
3
|
import type { Sprite } from "./Sprite";
|
|
4
4
|
import { EventDispatcher } from "@next2d/events";
|
|
5
5
|
import { Transform, Rectangle, Point } from "@next2d/geom";
|
|
6
|
-
import type { FilterArrayImpl, BlendModeImpl, ParentImpl, PlaceObjectImpl, BoundsImpl, DictionaryTagImpl, PropertyMessageMapImpl, DisplayObjectImpl } from "@next2d/interface";
|
|
6
|
+
import type { FilterArrayImpl, BlendModeImpl, ParentImpl, PlaceObjectImpl, BoundsImpl, DictionaryTagImpl, PropertyMessageMapImpl, DisplayObjectImpl, CachePositionImpl } from "@next2d/interface";
|
|
7
7
|
import type { CanvasToWebGLContext } from "@next2d/webgl";
|
|
8
8
|
/**
|
|
9
9
|
* DisplayObject クラスは、表示リストに含めることのできるすべてのオブジェクトに関する基本クラスです。
|
|
@@ -57,6 +57,7 @@ export declare class DisplayObject extends EventDispatcher {
|
|
|
57
57
|
protected _$placeId: number;
|
|
58
58
|
protected _$startFrame: number;
|
|
59
59
|
protected _$endFrame: number;
|
|
60
|
+
protected _$postArray: Float32Array | null;
|
|
60
61
|
/**
|
|
61
62
|
* @constructor
|
|
62
63
|
* @public
|
|
@@ -463,22 +464,22 @@ export declare class DisplayObject extends EventDispatcher {
|
|
|
463
464
|
_$doChanged(): void;
|
|
464
465
|
/**
|
|
465
466
|
* @param {CanvasToWebGLContext} context
|
|
466
|
-
* @param {WebGLTexture} target_texture
|
|
467
467
|
* @param {Float32Array} matrix
|
|
468
468
|
* @param {array} filters
|
|
469
469
|
* @param {number} width
|
|
470
470
|
* @param {number} height
|
|
471
|
-
* @
|
|
471
|
+
* @param {WebGLTexture} [target_texture = null]
|
|
472
|
+
* @return {object}
|
|
472
473
|
* @method
|
|
473
474
|
* @private
|
|
474
475
|
*/
|
|
475
|
-
_$drawFilter(context: CanvasToWebGLContext,
|
|
476
|
+
_$drawFilter(context: CanvasToWebGLContext, matrix: Float32Array, filters: FilterArrayImpl, width: number, height: number, target_texture?: WebGLTexture | null): CachePositionImpl;
|
|
476
477
|
/**
|
|
477
|
-
* @param {
|
|
478
|
+
* @param {Float32Array} multi_matrix
|
|
478
479
|
* @returns {object}
|
|
479
480
|
* @private
|
|
480
481
|
*/
|
|
481
|
-
_$getLayerBounds(
|
|
482
|
+
_$getLayerBounds(multi_matrix: Float32Array): BoundsImpl;
|
|
482
483
|
/**
|
|
483
484
|
* @return {void}
|
|
484
485
|
* @method
|
|
@@ -504,8 +505,6 @@ export declare class DisplayObject extends EventDispatcher {
|
|
|
504
505
|
*/
|
|
505
506
|
_$canApply(filters?: FilterArrayImpl | null): boolean;
|
|
506
507
|
/**
|
|
507
|
-
* @param {number} width
|
|
508
|
-
* @param {number} height
|
|
509
508
|
* @param {Float32Array} matrix
|
|
510
509
|
* @param {array} [filters=null]
|
|
511
510
|
* @param {boolean} [can_apply=false]
|
|
@@ -514,7 +513,7 @@ export declare class DisplayObject extends EventDispatcher {
|
|
|
514
513
|
* @return {boolean}
|
|
515
514
|
* @private
|
|
516
515
|
*/
|
|
517
|
-
_$isFilterUpdated(
|
|
516
|
+
_$isFilterUpdated(matrix: Float32Array, filters?: FilterArrayImpl | null, can_apply?: boolean): boolean;
|
|
518
517
|
/**
|
|
519
518
|
* @param {CanvasToWebGLContext} context
|
|
520
519
|
* @param {array} filters
|
|
@@ -536,11 +535,11 @@ export declare class DisplayObject extends EventDispatcher {
|
|
|
536
535
|
/**
|
|
537
536
|
* @param {CanvasToWebGLContext} context
|
|
538
537
|
* @param {Float32Array} matrix
|
|
539
|
-
* @return {
|
|
538
|
+
* @return {boolean}
|
|
540
539
|
* @method
|
|
541
540
|
* @private
|
|
542
541
|
*/
|
|
543
|
-
_$startClip(context: CanvasToWebGLContext, matrix: Float32Array):
|
|
542
|
+
_$startClip(context: CanvasToWebGLContext, matrix: Float32Array): boolean;
|
|
544
543
|
/**
|
|
545
544
|
* @return {void}
|
|
546
545
|
* @method
|