@swf2es/player 0.1.0 → 0.1.1
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 +7 -7
- package/dist/audio.d.ts +0 -22
- package/dist/audio.d.ts.map +0 -1
- package/dist/audio.js +0 -106
- package/dist/audio.js.map +0 -1
- package/dist/bitmap-filters.d.ts +0 -29
- package/dist/bitmap-filters.d.ts.map +0 -1
- package/dist/bitmap-filters.js +0 -906
- package/dist/bitmap-filters.js.map +0 -1
- package/dist/bitmap-ops.d.ts +0 -113
- package/dist/bitmap-ops.d.ts.map +0 -1
- package/dist/bitmap-ops.js +0 -725
- package/dist/bitmap-ops.js.map +0 -1
- package/dist/bitmap.d.ts +0 -98
- package/dist/bitmap.d.ts.map +0 -1
- package/dist/bitmap.js +0 -314
- package/dist/bitmap.js.map +0 -1
- package/dist/bounds.d.ts +0 -26
- package/dist/bounds.d.ts.map +0 -1
- package/dist/bounds.js +0 -300
- package/dist/bounds.js.map +0 -1
- package/dist/color.d.ts +0 -7
- package/dist/color.d.ts.map +0 -1
- package/dist/color.js +0 -42
- package/dist/color.js.map +0 -1
- package/dist/display.d.ts +0 -425
- package/dist/display.d.ts.map +0 -1
- package/dist/display.js +0 -1274
- package/dist/display.js.map +0 -1
- package/dist/drawing.d.ts +0 -52
- package/dist/drawing.d.ts.map +0 -1
- package/dist/drawing.js +0 -204
- package/dist/drawing.js.map +0 -1
- package/dist/filters.d.ts +0 -54
- package/dist/filters.d.ts.map +0 -1
- package/dist/filters.js +0 -155
- package/dist/filters.js.map +0 -1
- package/dist/fonts.d.ts +0 -23
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js +0 -91
- package/dist/fonts.js.map +0 -1
- package/dist/geometry.d.ts +0 -21
- package/dist/geometry.d.ts.map +0 -1
- package/dist/geometry.js +0 -76
- package/dist/geometry.js.map +0 -1
- package/dist/gradients.d.ts +0 -29
- package/dist/gradients.d.ts.map +0 -1
- package/dist/gradients.js +0 -116
- package/dist/gradients.js.map +0 -1
- package/dist/images.d.ts +0 -22
- package/dist/images.d.ts.map +0 -1
- package/dist/images.js +0 -147
- package/dist/images.js.map +0 -1
- package/dist/input.d.ts +0 -79
- package/dist/input.d.ts.map +0 -1
- package/dist/input.js +0 -366
- package/dist/input.js.map +0 -1
- package/dist/keyboard.d.ts +0 -97
- package/dist/keyboard.d.ts.map +0 -1
- package/dist/keyboard.js +0 -583
- package/dist/keyboard.js.map +0 -1
- package/dist/morph.d.ts +0 -17
- package/dist/morph.d.ts.map +0 -1
- package/dist/morph.js +0 -218
- package/dist/morph.js.map +0 -1
- package/dist/pixi-blend.d.ts +0 -7
- package/dist/pixi-blend.d.ts.map +0 -1
- package/dist/pixi-blend.js +0 -253
- package/dist/pixi-blend.js.map +0 -1
- package/dist/pixi-color.d.ts +0 -54
- package/dist/pixi-color.d.ts.map +0 -1
- package/dist/pixi-color.js +0 -336
- package/dist/pixi-color.js.map +0 -1
- package/dist/pixi-filters.d.ts +0 -40
- package/dist/pixi-filters.d.ts.map +0 -1
- package/dist/pixi-filters.js +0 -953
- package/dist/pixi-filters.js.map +0 -1
- package/dist/pixi-resolve.d.ts +0 -4
- package/dist/pixi-resolve.d.ts.map +0 -1
- package/dist/pixi-resolve.js +0 -76
- package/dist/pixi-resolve.js.map +0 -1
- package/dist/pixi.d.ts +0 -219
- package/dist/pixi.d.ts.map +0 -1
- package/dist/pixi.js +0 -2169
- package/dist/pixi.js.map +0 -1
- package/dist/playerglobal/flash/filters/filters.d.ts +0 -26
- package/dist/playerglobal/flash/filters/filters.d.ts.map +0 -1
- package/dist/playerglobal/flash/filters/filters.js +0 -287
- package/dist/playerglobal/flash/filters/filters.js.map +0 -1
- package/dist/playerglobal/flash/system/FSCommand.d.ts +0 -4
- package/dist/playerglobal/flash/system/FSCommand.d.ts.map +0 -1
- package/dist/playerglobal/flash/system/FSCommand.js +0 -18
- package/dist/playerglobal/flash/system/FSCommand.js.map +0 -1
- package/dist/playerglobal/natives.d.ts +0 -10
- package/dist/playerglobal/natives.d.ts.map +0 -1
- package/dist/playerglobal/natives.js +0 -53
- package/dist/playerglobal/natives.js.map +0 -1
- package/dist/png.d.ts +0 -4
- package/dist/png.d.ts.map +0 -1
- package/dist/png.js +0 -140
- package/dist/png.js.map +0 -1
- package/dist/render/art.d.ts +0 -148
- package/dist/render/art.d.ts.map +0 -1
- package/dist/render/art.js +0 -575
- package/dist/render/art.js.map +0 -1
- package/dist/render/batchers.d.ts +0 -23
- package/dist/render/batchers.d.ts.map +0 -1
- package/dist/render/batchers.js +0 -52
- package/dist/render/batchers.js.map +0 -1
- package/dist/render/bitmaps.d.ts +0 -117
- package/dist/render/bitmaps.d.ts.map +0 -1
- package/dist/render/bitmaps.js +0 -422
- package/dist/render/bitmaps.js.map +0 -1
- package/dist/render/blend.d.ts +0 -37
- package/dist/render/blend.d.ts.map +0 -1
- package/dist/render/blend.js +0 -195
- package/dist/render/blend.js.map +0 -1
- package/dist/render/color.d.ts +0 -111
- package/dist/render/color.d.ts.map +0 -1
- package/dist/render/color.js +0 -533
- package/dist/render/color.js.map +0 -1
- package/dist/render/compositing.d.ts +0 -77
- package/dist/render/compositing.d.ts.map +0 -1
- package/dist/render/compositing.js +0 -188
- package/dist/render/compositing.js.map +0 -1
- package/dist/render/filters.d.ts +0 -98
- package/dist/render/filters.d.ts.map +0 -1
- package/dist/render/filters.js +0 -1326
- package/dist/render/filters.js.map +0 -1
- package/dist/render/hooks.d.ts +0 -4
- package/dist/render/hooks.d.ts.map +0 -1
- package/dist/render/hooks.js +0 -48
- package/dist/render/hooks.js.map +0 -1
- package/dist/render/node.d.ts +0 -139
- package/dist/render/node.d.ts.map +0 -1
- package/dist/render/node.js +0 -59
- package/dist/render/node.js.map +0 -1
- package/dist/render/patches.d.ts +0 -54
- package/dist/render/patches.d.ts.map +0 -1
- package/dist/render/patches.js +0 -154
- package/dist/render/patches.js.map +0 -1
- package/dist/render/planes.d.ts +0 -74
- package/dist/render/planes.d.ts.map +0 -1
- package/dist/render/planes.js +0 -267
- package/dist/render/planes.js.map +0 -1
- package/dist/render/pointer.d.ts +0 -5
- package/dist/render/pointer.d.ts.map +0 -1
- package/dist/render/pointer.js +0 -279
- package/dist/render/pointer.js.map +0 -1
- package/dist/render/pools.d.ts +0 -122
- package/dist/render/pools.d.ts.map +0 -1
- package/dist/render/pools.js +0 -238
- package/dist/render/pools.js.map +0 -1
- package/dist/render/resolve.d.ts +0 -4
- package/dist/render/resolve.d.ts.map +0 -1
- package/dist/render/resolve.js +0 -76
- package/dist/render/resolve.js.map +0 -1
- package/dist/render/saffron.d.ts +0 -135
- package/dist/render/saffron.d.ts.map +0 -1
- package/dist/render/saffron.js +0 -725
- package/dist/render/saffron.js.map +0 -1
- package/dist/render/settle.d.ts +0 -60
- package/dist/render/settle.d.ts.map +0 -1
- package/dist/render/settle.js +0 -128
- package/dist/render/settle.js.map +0 -1
- package/dist/render/shared.d.ts +0 -25
- package/dist/render/shared.d.ts.map +0 -1
- package/dist/render/shared.js +0 -33
- package/dist/render/shared.js.map +0 -1
- package/dist/render/snapshot.d.ts +0 -21
- package/dist/render/snapshot.d.ts.map +0 -1
- package/dist/render/snapshot.js +0 -91
- package/dist/render/snapshot.js.map +0 -1
- package/dist/render/spares.d.ts +0 -56
- package/dist/render/spares.d.ts.map +0 -1
- package/dist/render/spares.js +0 -160
- package/dist/render/spares.js.map +0 -1
- package/dist/render/strokes.d.ts +0 -107
- package/dist/render/strokes.d.ts.map +0 -1
- package/dist/render/strokes.js +0 -448
- package/dist/render/strokes.js.map +0 -1
- package/dist/render/table.d.ts +0 -213
- package/dist/render/table.d.ts.map +0 -1
- package/dist/render/table.js +0 -795
- package/dist/render/table.js.map +0 -1
- package/dist/render/tessellate.d.ts +0 -89
- package/dist/render/tessellate.d.ts.map +0 -1
- package/dist/render/tessellate.js +0 -386
- package/dist/render/tessellate.js.map +0 -1
- package/dist/render/text.d.ts +0 -40
- package/dist/render/text.d.ts.map +0 -1
- package/dist/render/text.js +0 -309
- package/dist/render/text.js.map +0 -1
- package/dist/render/three.d.ts +0 -83
- package/dist/render/three.d.ts.map +0 -1
- package/dist/render/three.js +0 -511
- package/dist/render/three.js.map +0 -1
- package/dist/render/triangles.d.ts +0 -28
- package/dist/render/triangles.d.ts.map +0 -1
- package/dist/render/triangles.js +0 -189
- package/dist/render/triangles.js.map +0 -1
- package/dist/render/view.d.ts +0 -238
- package/dist/render/view.d.ts.map +0 -1
- package/dist/render/view.js +0 -1173
- package/dist/render/view.js.map +0 -1
- package/dist/render/worker/bitmaps.d.ts +0 -43
- package/dist/render/worker/bitmaps.d.ts.map +0 -1
- package/dist/render/worker/bitmaps.js +0 -151
- package/dist/render/worker/bitmaps.js.map +0 -1
- package/dist/render/worker/drawing.d.ts +0 -21
- package/dist/render/worker/drawing.d.ts.map +0 -1
- package/dist/render/worker/drawing.js +0 -356
- package/dist/render/worker/drawing.js.map +0 -1
- package/dist/render/worker/filters.d.ts +0 -7
- package/dist/render/worker/filters.d.ts.map +0 -1
- package/dist/render/worker/filters.js +0 -125
- package/dist/render/worker/filters.js.map +0 -1
- package/dist/render/worker/frames.d.ts +0 -32
- package/dist/render/worker/frames.d.ts.map +0 -1
- package/dist/render/worker/frames.js +0 -124
- package/dist/render/worker/frames.js.map +0 -1
- package/dist/render/worker/host.d.ts +0 -60
- package/dist/render/worker/host.d.ts.map +0 -1
- package/dist/render/worker/host.js +0 -297
- package/dist/render/worker/host.js.map +0 -1
- package/dist/render/worker/libraries.d.ts +0 -36
- package/dist/render/worker/libraries.d.ts.map +0 -1
- package/dist/render/worker/libraries.js +0 -153
- package/dist/render/worker/libraries.js.map +0 -1
- package/dist/render/worker/presentation.d.ts +0 -18
- package/dist/render/worker/presentation.d.ts.map +0 -1
- package/dist/render/worker/presentation.js +0 -47
- package/dist/render/worker/presentation.js.map +0 -1
- package/dist/render/worker/renderer.d.ts +0 -4
- package/dist/render/worker/renderer.d.ts.map +0 -1
- package/dist/render/worker/renderer.js +0 -21
- package/dist/render/worker/renderer.js.map +0 -1
- package/dist/render/worker/scene.d.ts +0 -32
- package/dist/render/worker/scene.d.ts.map +0 -1
- package/dist/render/worker/scene.js +0 -611
- package/dist/render/worker/scene.js.map +0 -1
- package/dist/render/worker/text.d.ts +0 -47
- package/dist/render/worker/text.d.ts.map +0 -1
- package/dist/render/worker/text.js +0 -261
- package/dist/render/worker/text.js.map +0 -1
- package/dist/render/worker/thread.d.ts +0 -23
- package/dist/render/worker/thread.d.ts.map +0 -1
- package/dist/render/worker/thread.js +0 -107
- package/dist/render/worker/thread.js.map +0 -1
- package/dist/render/worker/values.d.ts +0 -18
- package/dist/render/worker/values.d.ts.map +0 -1
- package/dist/render/worker/values.js +0 -64
- package/dist/render/worker/values.js.map +0 -1
- package/dist/sha256.d.ts +0 -5
- package/dist/sha256.d.ts.map +0 -1
- package/dist/sha256.js +0 -96
- package/dist/sha256.js.map +0 -1
- package/dist/shapes.d.ts +0 -71
- package/dist/shapes.d.ts.map +0 -1
- package/dist/shapes.js +0 -340
- package/dist/shapes.js.map +0 -1
- package/dist/static-text.d.ts +0 -33
- package/dist/static-text.d.ts.map +0 -1
- package/dist/static-text.js +0 -105
- package/dist/static-text.js.map +0 -1
- package/dist/text-layout.d.ts +0 -66
- package/dist/text-layout.d.ts.map +0 -1
- package/dist/text-layout.js +0 -315
- package/dist/text-layout.js.map +0 -1
- package/dist/text.d.ts +0 -67
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -383
- package/dist/text.js.map +0 -1
- package/dist/timeline.d.ts +0 -150
- package/dist/timeline.d.ts.map +0 -1
- package/dist/timeline.js +0 -266
- package/dist/timeline.js.map +0 -1
package/dist/render/batchers.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** Retired groups' batchers kept, at most this many groups', for new groups to build with. */
|
|
2
|
-
const SPARE_BATCHERS_MOST = 16;
|
|
3
|
-
const spareBatchersOf = new WeakMap();
|
|
4
|
-
/**
|
|
5
|
-
* The instruction sets of groups a view made, the only ones given spare batchers: a root rendered
|
|
6
|
-
* once, as BitmapData.draw's, is destroyed with whatever it was given.
|
|
7
|
-
*/
|
|
8
|
-
export const viewGroups = new WeakSet();
|
|
9
|
-
/** The batch pipe of `renderer`, which keeps batchers by instruction set. */
|
|
10
|
-
function batchPipeOf(renderer) {
|
|
11
|
-
return renderer.renderPipes?.batch;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The batchers a group's new instruction set builds with (render/hooks.ts): a retired group's,
|
|
15
|
-
* for a set a view made, or none, for Pixi to make new ones.
|
|
16
|
-
*/
|
|
17
|
-
export function spareBatchersFor(pipe, set) {
|
|
18
|
-
const spare = spareBatchersOf.get(pipe);
|
|
19
|
-
return spare && spare.length > 0 && viewGroups.has(set) ? spare.pop() : undefined;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Take a retired instruction set's batchers from Pixi, which keeps them by ID even after its group
|
|
23
|
-
* is gone. A branch made anew each frame would otherwise allocate a group's buffers as an older
|
|
24
|
-
* one's are freed, which costs more than keeping them all; a new group takes them over instead.
|
|
25
|
-
*/
|
|
26
|
-
export function retireBatchers(renderer, uid) {
|
|
27
|
-
const pipe = batchPipeOf(renderer);
|
|
28
|
-
const batchers = pipe?.takeBatchers?.(uid);
|
|
29
|
-
if (!pipe || !batchers) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
let spare = spareBatchersOf.get(pipe);
|
|
33
|
-
if (!spare) {
|
|
34
|
-
spare = [];
|
|
35
|
-
spareBatchersOf.set(pipe, spare);
|
|
36
|
-
}
|
|
37
|
-
if (spare.length < SPARE_BATCHERS_MOST) {
|
|
38
|
-
spare.push(batchers);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
for (const batcher of Object.values(batchers)) {
|
|
42
|
-
batcher.destroy();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Cut back the buffers of the batchers of `renderer`'s groups that have long used little of them
|
|
47
|
-
* (Pixi's BatcherPipe.trim).
|
|
48
|
-
*/
|
|
49
|
-
export function trimBatchers(renderer, now) {
|
|
50
|
-
batchPipeOf(renderer)?.trim?.(now);
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=batchers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchers.js","sourceRoot":"","sources":["../../src/render/batchers.ts"],"names":[],"mappings":"AAGA,8FAA8F;AAC9F,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,IAAI,OAAO,EAA0C,CAAC;AAC9E;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,EAAkB,CAAC;AAExD,6EAA6E;AAC7E,SAAS,WAAW,CAAC,QAAkB;IACrC,OAAO,QAAQ,CAAC,WAAW,EAAE,KAAgC,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAiB,EACjB,GAAmB;IAEnB,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,QAAkB,EAAE,GAAW;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,IAAI,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG,EAAE,CAAC;QACX,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9C,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAkB,EAAE,GAAW;IAC1D,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/render/bitmaps.d.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { BufferImageSource, Matrix, type Renderer, Texture, type TextureSource } from "pixi.js";
|
|
2
|
-
import { BitmapStore, type GpuCopy, type PixelRect } from "../bitmap/bitmap.js";
|
|
3
|
-
import { type Region as Area } from "../display/gradients.js";
|
|
4
|
-
import type { GradientFill } from "../display/shapes.js";
|
|
5
|
-
import type { BitmapCharacter } from "../display/timeline.js";
|
|
6
|
-
/**
|
|
7
|
-
* The store a SWF bitmap's fills draw from, one for all its shapes and for
|
|
8
|
-
* every SWF that defines it alike, so one texture; null until its image is
|
|
9
|
-
* decoded. Nothing writes it.
|
|
10
|
-
*/
|
|
11
|
-
export declare function characterStore(character: BitmapCharacter): BitmapStore | null;
|
|
12
|
-
/** RGBA bytes read from a texture as premultiplied ARGB. */
|
|
13
|
-
export declare function argbOf(bytes: Uint8Array | Uint8ClampedArray): Uint32Array;
|
|
14
|
-
/**
|
|
15
|
-
* A store's texture: its premultiplied ARGB exactly, uploaded as it is and
|
|
16
|
-
* rendered into by draws. Pixi's collector never unloads it, as content a
|
|
17
|
-
* draw left there could not be uploaded again.
|
|
18
|
-
*/
|
|
19
|
-
declare class StoreTexture implements GpuCopy {
|
|
20
|
-
private readonly renderer;
|
|
21
|
-
private readonly bitmaps;
|
|
22
|
-
/** Held weakly: the store's collection is what frees its copies. */
|
|
23
|
-
private readonly store;
|
|
24
|
-
readonly source: BufferImageSource;
|
|
25
|
-
readonly texture: Texture;
|
|
26
|
-
/** The store's version the texture holds. */
|
|
27
|
-
version: number;
|
|
28
|
-
/**
|
|
29
|
-
* The same pixels sampled otherwise, copied on the GPU as the texture
|
|
30
|
-
* changes: linearly for a smoothed Bitmap, and repeating or clamped,
|
|
31
|
-
* either way, for bitmap fills; by "linear repeat".
|
|
32
|
-
*/
|
|
33
|
-
private readonly variants;
|
|
34
|
-
constructor(renderer: Renderer, bitmaps: GpuBitmaps,
|
|
35
|
-
/** Held weakly: the store's collection is what frees its copies. */
|
|
36
|
-
store: WeakRef<BitmapStore>, width: number, height: number);
|
|
37
|
-
/**
|
|
38
|
-
* The texture after a lost context was given back, which lost it: the
|
|
39
|
-
* store's pixels uploaded again, as Pixi no longer keeps them, and the
|
|
40
|
-
* sampled copies made again from it. A draw only the texture held is gone.
|
|
41
|
-
*/
|
|
42
|
-
restore(): void;
|
|
43
|
-
read(): Uint32Array;
|
|
44
|
-
/** The store's pixels on the GPU: cleared to their colour where they are all one, as a new bitmap's are, else uploaded. */
|
|
45
|
-
upload(pixels: Uint32Array): void;
|
|
46
|
-
/** `target` cleared to `pixel`: already premultiplied, as the texture holds it; a byte divided by 255 comes back exactly. */
|
|
47
|
-
private clear;
|
|
48
|
-
copy(source: BitmapStore, rect: PixelRect, dx: number, dy: number): boolean;
|
|
49
|
-
fill(rect: PixelRect, pixel: number): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* The texture sampled linearly or not, repeating or clamped: a
|
|
52
|
-
* texture's sampling is its source's in Pixi, so each way is a copy.
|
|
53
|
-
*/
|
|
54
|
-
sampled(linear: boolean, repeat: boolean): Texture;
|
|
55
|
-
destroy(): void;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* The textures of a renderer's stores, one a store, made as a Bitmap shows
|
|
59
|
-
* one or a draw renders into it. Each renderer keeps its own: a store
|
|
60
|
-
* shown by two has a copy in each, and one a draw wrote is read back
|
|
61
|
-
* through the renderer that drew it before another uploads it.
|
|
62
|
-
*/
|
|
63
|
-
declare class GpuBitmaps {
|
|
64
|
-
private readonly renderer;
|
|
65
|
-
private readonly limit;
|
|
66
|
-
private readonly copies;
|
|
67
|
-
private readonly collected;
|
|
68
|
-
/** The sources of the copies sampled linearly where bitmaps are smoothed. */
|
|
69
|
-
readonly smoothed: Set<TextureSource<any>>;
|
|
70
|
-
private smooth;
|
|
71
|
-
/** The copies not yet destroyed, which a context given back has upload again. */
|
|
72
|
-
private readonly live;
|
|
73
|
-
constructor(renderer: Renderer);
|
|
74
|
-
/** Whether a Bitmap or a fill asking to be smoothed is: not at Flash's low quality. */
|
|
75
|
-
get smoothing(): boolean;
|
|
76
|
-
set smoothing(smooth: boolean);
|
|
77
|
-
/**
|
|
78
|
-
* The store's texture, made if it has none and uploaded if the CPU
|
|
79
|
-
* changed the store since; null for one disposed, of 0 by 0, or larger
|
|
80
|
-
* than a texture may be. Smoothed, it is a linearly sampled copy.
|
|
81
|
-
*/
|
|
82
|
-
texture(store: BitmapStore, smoothing?: boolean): Texture | null;
|
|
83
|
-
/** The store's texture for a bitmap fill: repeating or clamped, smoothed or not, up to date. */
|
|
84
|
-
fillTexture(store: BitmapStore, repeat: boolean, smooth: boolean): Texture | null;
|
|
85
|
-
/** A draw rendered into this renderer's copy of the store, which now holds the store as it is. */
|
|
86
|
-
drawn(store: BitmapStore): void;
|
|
87
|
-
forget(copy: StoreTexture): void;
|
|
88
|
-
/**
|
|
89
|
-
* Each gradient's textures by region: one for a linear gradient, one for
|
|
90
|
-
* each region a radial one fills, which `drawPath` and `copyFrom` can make
|
|
91
|
-
* several of, each held by the contexts that draw with it.
|
|
92
|
-
*/
|
|
93
|
-
private readonly gradients;
|
|
94
|
-
/**
|
|
95
|
-
* A gradient's texture and the matrix from its texels to the shape, made
|
|
96
|
-
* once for each region and held: given back with `release` by each
|
|
97
|
-
* context that took it, and freed when the last does: not when the fill
|
|
98
|
-
* is collected, as a drawing cleared may drop it while a view still draws
|
|
99
|
-
* the texture (`graphics.clear()` empties the layers the view holds too).
|
|
100
|
-
* A linear one is its ramp of 256 colours, sampled nearest and
|
|
101
|
-
* spread as the texture wraps, moved half a pixel so that a pixel's
|
|
102
|
-
* centre reads what Flash reads at its corner. A radial one is computed
|
|
103
|
-
* over the region it fills, a texel a pixel (up to RADIAL_MAX a side),
|
|
104
|
-
* sampled linearly.
|
|
105
|
-
*/
|
|
106
|
-
gradientTexture(fill: GradientFill, area: Area | null): GradientTexture;
|
|
107
|
-
}
|
|
108
|
-
/** A gradient's texture for a region, and how many contexts hold it. */
|
|
109
|
-
interface GradientTexture {
|
|
110
|
-
texture: Texture;
|
|
111
|
-
matrix: Matrix;
|
|
112
|
-
uses: number;
|
|
113
|
-
release: () => void;
|
|
114
|
-
}
|
|
115
|
-
export declare function gpuBitmaps(renderer: Renderer): GpuBitmaps;
|
|
116
|
-
export {};
|
|
117
|
-
//# sourceMappingURL=bitmaps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bitmaps.d.ts","sourceRoot":"","sources":["../../src/render/bitmaps.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,MAAM,EAEN,KAAK,QAAQ,EAGb,OAAO,EACP,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,KAAK,MAAM,IAAI,IAAI,EAAkC,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;A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,CAAC;CACrB;AAMD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAQzD"}
|
package/dist/render/bitmaps.js
DELETED
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
// Bitmaps on the GPU: each renderer's textures of the bitmap stores it
|
|
2
|
-
// shows or draws into, and of the gradients its fills paint with.
|
|
3
|
-
import { BufferImageSource, Matrix, Container as PixiContainer, RenderTexture, Sprite, Texture, } from "pixi.js";
|
|
4
|
-
import { BitmapStore } from "../bitmap/bitmap.js";
|
|
5
|
-
import { RADIAL_MAX, radialPixels, ramp } from "../display/gradients.js";
|
|
6
|
-
import { rgbaOf } from "./filters.js";
|
|
7
|
-
import { drawTarget, releaseDrawTarget } from "./pools.js";
|
|
8
|
-
/**
|
|
9
|
-
* Make a texture source report "clamp" for addressMode: Pixi turns a
|
|
10
|
-
* fill's texture that says clamp-to-edge to repeating, while WebGL reads
|
|
11
|
-
* each axis's mode, which stays clamped.
|
|
12
|
-
*/
|
|
13
|
-
function keepClamped(source) {
|
|
14
|
-
Object.defineProperty(source.style, "addressMode", { get: () => "clamp", set: () => { } });
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Destroy a texture a fill may have drawn with. Pixi keeps the bind group
|
|
18
|
-
* of each unbatched Graphics' textures in a cache it never clears, and each
|
|
19
|
-
* group that holds a texture warns as it is destroyed; nothing else listens
|
|
20
|
-
* for the change. That cache keeps the source too, and a destroyed source
|
|
21
|
-
* still keeps the options it was made with, the bytes it was uploaded from
|
|
22
|
-
* among them: they go, so the cache holds a source's shell, not its pixels.
|
|
23
|
-
*/
|
|
24
|
-
function destroyTexture(texture) {
|
|
25
|
-
const source = texture.source;
|
|
26
|
-
source.removeAllListeners("change");
|
|
27
|
-
source.style.removeAllListeners("change");
|
|
28
|
-
texture.destroy(true);
|
|
29
|
-
source.options.resource = undefined;
|
|
30
|
-
}
|
|
31
|
-
/** Each bitmap's fill store, by its pixels, which the SWFs that define the bitmap alike share. */
|
|
32
|
-
const fillStores = new WeakMap();
|
|
33
|
-
/**
|
|
34
|
-
* The store a SWF bitmap's fills draw from, one for all its shapes and for
|
|
35
|
-
* every SWF that defines it alike, so one texture; null until its image is
|
|
36
|
-
* decoded. Nothing writes it.
|
|
37
|
-
*/
|
|
38
|
-
export function characterStore(character) {
|
|
39
|
-
const pixels = character.pixels;
|
|
40
|
-
if (!pixels) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
if (!character.store) {
|
|
44
|
-
let store = fillStores.get(pixels);
|
|
45
|
-
if (!store) {
|
|
46
|
-
store = BitmapStore.of(pixels);
|
|
47
|
-
fillStores.set(pixels, store);
|
|
48
|
-
}
|
|
49
|
-
character.store = store;
|
|
50
|
-
}
|
|
51
|
-
return character.store;
|
|
52
|
-
}
|
|
53
|
-
/** RGBA bytes read from a texture as premultiplied ARGB. */
|
|
54
|
-
export function argbOf(bytes) {
|
|
55
|
-
const out = new Uint32Array(bytes.length / 4);
|
|
56
|
-
for (let i = 0; i < out.length; i++) {
|
|
57
|
-
const j = i * 4;
|
|
58
|
-
out[i] = ((bytes[j + 3] << 24) | (bytes[j] << 16) | (bytes[j + 1] << 8) | bytes[j + 2]) >>> 0;
|
|
59
|
-
}
|
|
60
|
-
return out;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* A store's texture: its premultiplied ARGB exactly, uploaded as it is and
|
|
64
|
-
* rendered into by draws. Pixi's collector never unloads it, as content a
|
|
65
|
-
* draw left there could not be uploaded again.
|
|
66
|
-
*/
|
|
67
|
-
class StoreTexture {
|
|
68
|
-
renderer;
|
|
69
|
-
bitmaps;
|
|
70
|
-
store;
|
|
71
|
-
source;
|
|
72
|
-
texture;
|
|
73
|
-
/** The store's version the texture holds. */
|
|
74
|
-
version = -1;
|
|
75
|
-
/**
|
|
76
|
-
* The same pixels sampled otherwise, copied on the GPU as the texture
|
|
77
|
-
* changes: linearly for a smoothed Bitmap, and repeating or clamped,
|
|
78
|
-
* either way, for bitmap fills; by "linear repeat".
|
|
79
|
-
*/
|
|
80
|
-
variants = new Map();
|
|
81
|
-
constructor(renderer, bitmaps,
|
|
82
|
-
/** Held weakly: the store's collection is what frees its copies. */
|
|
83
|
-
store, width, height) {
|
|
84
|
-
this.renderer = renderer;
|
|
85
|
-
this.bitmaps = bitmaps;
|
|
86
|
-
this.store = store;
|
|
87
|
-
this.source = new BufferImageSource({
|
|
88
|
-
// Bytes decide the format, 8 bits a channel; none allocate a float buffer.
|
|
89
|
-
resource: new Uint8Array(0),
|
|
90
|
-
width,
|
|
91
|
-
height,
|
|
92
|
-
alphaMode: "premultiplied-alpha",
|
|
93
|
-
scaleMode: "nearest",
|
|
94
|
-
autoGarbageCollect: false,
|
|
95
|
-
});
|
|
96
|
-
// No bytes until the CPU's are uploaded: the first use allocates the
|
|
97
|
-
// texture without an upload, and a store of one colour is cleared to it.
|
|
98
|
-
this.source.resource = null;
|
|
99
|
-
this.texture = new Texture({ source: this.source });
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* The texture after a lost context was given back, which lost it: the
|
|
103
|
-
* store's pixels uploaded again, as Pixi no longer keeps them, and the
|
|
104
|
-
* sampled copies made again from it. A draw only the texture held is gone.
|
|
105
|
-
*/
|
|
106
|
-
restore() {
|
|
107
|
-
const store = this.store.deref();
|
|
108
|
-
if (!store || store.disposed) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
this.upload(store.lostOnGpu(this));
|
|
112
|
-
// Drawn again now: a fill or a Bitmap that does not change asks for none.
|
|
113
|
-
for (const [key, variant] of this.variants) {
|
|
114
|
-
variant.version = -1;
|
|
115
|
-
const [linear, repeat] = key.split(" ");
|
|
116
|
-
this.sampled(linear === "true", repeat === "true");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
read() {
|
|
120
|
-
return argbOf(this.renderer.extract.pixels(this.texture).pixels);
|
|
121
|
-
}
|
|
122
|
-
/** The store's pixels on the GPU: cleared to their colour where they are all one, as a new bitmap's are, else uploaded. */
|
|
123
|
-
upload(pixels) {
|
|
124
|
-
const first = pixels[0];
|
|
125
|
-
let uniform = true;
|
|
126
|
-
for (let i = 1; i < pixels.length; i++) {
|
|
127
|
-
if (pixels[i] !== first) {
|
|
128
|
-
uniform = false;
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (!uniform) {
|
|
133
|
-
// Uploaded now, the texture made first if it has none, and the bytes let go
|
|
134
|
-
// of: Pixi would keep a copy of every bitmap's pixels beside the store's.
|
|
135
|
-
// A context lost and given back has each copy upload again (restore).
|
|
136
|
-
this.source.resource = rgbaOf(pixels);
|
|
137
|
-
this.source.update();
|
|
138
|
-
this.renderer.texture.initSource(this.source);
|
|
139
|
-
this.source.resource = null;
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
this.clear(this.texture, first);
|
|
143
|
-
}
|
|
144
|
-
/** `target` cleared to `pixel`: already premultiplied, as the texture holds it; a byte divided by 255 comes back exactly. */
|
|
145
|
-
clear(target, pixel) {
|
|
146
|
-
this.renderer.render({
|
|
147
|
-
container: EMPTY,
|
|
148
|
-
target,
|
|
149
|
-
clear: true,
|
|
150
|
-
clearColor: [
|
|
151
|
-
((pixel >>> 16) & 0xff) / 255,
|
|
152
|
-
((pixel >>> 8) & 0xff) / 255,
|
|
153
|
-
(pixel & 0xff) / 255,
|
|
154
|
-
(pixel >>> 24) / 255,
|
|
155
|
-
],
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
copy(source, rect, dx, dy) {
|
|
159
|
-
const from = this.bitmaps.texture(source);
|
|
160
|
-
if (!from) {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
// Pixi clips the objects it is given in place: each copy has its own.
|
|
164
|
-
const { x, y, width, height } = rect;
|
|
165
|
-
const targets = this.renderer.renderTarget;
|
|
166
|
-
if (from !== this.texture) {
|
|
167
|
-
targets.copyToTexture(from, this.texture, { x, y }, { width, height }, { x: dx, y: dy });
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
// Through a texture of its own: a texture copied into itself is GL's feedback loop.
|
|
171
|
-
const between = drawTarget(width, height);
|
|
172
|
-
targets.copyToTexture(from, between, { x, y }, { width, height }, { x: 0, y: 0 });
|
|
173
|
-
targets.copyToTexture(between, this.texture, { x: 0, y: 0 }, { width, height }, { x: dx, y: dy });
|
|
174
|
-
releaseDrawTarget(between);
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
fill(rect, pixel) {
|
|
178
|
-
if (rect.width === this.source.width && rect.height === this.source.height) {
|
|
179
|
-
this.clear(this.texture, pixel);
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
// A clear covers its whole target: the rect's is a texture of its size, copied in.
|
|
183
|
-
const filled = drawTarget(rect.width, rect.height);
|
|
184
|
-
this.clear(filled, pixel);
|
|
185
|
-
this.renderer.renderTarget.copyToTexture(filled, this.texture, { x: 0, y: 0 }, { width: rect.width, height: rect.height }, { x: rect.x, y: rect.y });
|
|
186
|
-
releaseDrawTarget(filled);
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* The texture sampled linearly or not, repeating or clamped: a
|
|
191
|
-
* texture's sampling is its source's in Pixi, so each way is a copy.
|
|
192
|
-
*/
|
|
193
|
-
sampled(linear, repeat) {
|
|
194
|
-
const key = `${linear} ${repeat}`;
|
|
195
|
-
let variant = this.variants.get(key);
|
|
196
|
-
if (!variant) {
|
|
197
|
-
const texture = RenderTexture.create({
|
|
198
|
-
width: this.source.width,
|
|
199
|
-
height: this.source.height,
|
|
200
|
-
scaleMode: linear && this.bitmaps.smoothing ? "linear" : "nearest",
|
|
201
|
-
addressMode: repeat ? "repeat" : "clamp-to-edge",
|
|
202
|
-
autoGarbageCollect: false,
|
|
203
|
-
});
|
|
204
|
-
if (!repeat) {
|
|
205
|
-
keepClamped(texture.source);
|
|
206
|
-
}
|
|
207
|
-
if (linear) {
|
|
208
|
-
this.bitmaps.smoothed.add(texture.source);
|
|
209
|
-
}
|
|
210
|
-
variant = { texture, version: -1 };
|
|
211
|
-
this.variants.set(key, variant);
|
|
212
|
-
}
|
|
213
|
-
if (variant.version !== this.version) {
|
|
214
|
-
const sprite = new Sprite(this.texture);
|
|
215
|
-
this.renderer.render({ container: sprite, target: variant.texture, clear: true });
|
|
216
|
-
sprite.destroy();
|
|
217
|
-
variant.version = this.version;
|
|
218
|
-
}
|
|
219
|
-
return variant.texture;
|
|
220
|
-
}
|
|
221
|
-
destroy() {
|
|
222
|
-
// Out of the store, which other SWFs' fills may share, so that it does not hold this renderer.
|
|
223
|
-
const store = this.store.deref();
|
|
224
|
-
if (store) {
|
|
225
|
-
store.copies.delete(this);
|
|
226
|
-
if (store.gpu === this) {
|
|
227
|
-
store.lostOnGpu(this);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
this.bitmaps.forget(this);
|
|
231
|
-
destroyTexture(this.texture);
|
|
232
|
-
for (const { texture } of this.variants.values()) {
|
|
233
|
-
this.bitmaps.smoothed.delete(texture.source);
|
|
234
|
-
destroyTexture(texture);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* The textures of a renderer's stores, one a store, made as a Bitmap shows
|
|
240
|
-
* one or a draw renders into it. Each renderer keeps its own: a store
|
|
241
|
-
* shown by two has a copy in each, and one a draw wrote is read back
|
|
242
|
-
* through the renderer that drew it before another uploads it.
|
|
243
|
-
*/
|
|
244
|
-
class GpuBitmaps {
|
|
245
|
-
renderer;
|
|
246
|
-
limit;
|
|
247
|
-
copies = new WeakMap();
|
|
248
|
-
collected = new FinalizationRegistry((copy) => copy.destroy());
|
|
249
|
-
/** The sources of the copies sampled linearly where bitmaps are smoothed. */
|
|
250
|
-
smoothed = new Set();
|
|
251
|
-
smooth = true;
|
|
252
|
-
/** The copies not yet destroyed, which a context given back has upload again. */
|
|
253
|
-
live = new Set();
|
|
254
|
-
constructor(renderer) {
|
|
255
|
-
this.renderer = renderer;
|
|
256
|
-
const gl = renderer.gl;
|
|
257
|
-
this.limit = gl ? gl.getParameter(gl.MAX_TEXTURE_SIZE) : 8192;
|
|
258
|
-
// Each copy restored once Pixi's systems have their new context, not
|
|
259
|
-
// within their change, as an upload of one colour renders. A renderer the
|
|
260
|
-
// tests stand in for has no runners, nor a context to lose.
|
|
261
|
-
renderer.runners?.contextChange?.add({
|
|
262
|
-
contextChange: () => queueMicrotask(() => {
|
|
263
|
-
for (const copy of this.live) {
|
|
264
|
-
copy.restore();
|
|
265
|
-
}
|
|
266
|
-
}),
|
|
267
|
-
});
|
|
268
|
-
// A renderer destroyed lets go of its copies, which stores that outlive it would hold.
|
|
269
|
-
renderer.runners?.destroy?.add({
|
|
270
|
-
destroy: () => {
|
|
271
|
-
for (const copy of [...this.live]) {
|
|
272
|
-
copy.destroy();
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/** Whether a Bitmap or a fill asking to be smoothed is: not at Flash's low quality. */
|
|
278
|
-
get smoothing() {
|
|
279
|
-
return this.smooth;
|
|
280
|
-
}
|
|
281
|
-
set smoothing(smooth) {
|
|
282
|
-
if (smooth === this.smooth) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
// Sampled otherwise in place: the fills and sprites that draw with the copies keep them.
|
|
286
|
-
this.smooth = smooth;
|
|
287
|
-
for (const source of this.smoothed) {
|
|
288
|
-
source.scaleMode = smooth ? "linear" : "nearest";
|
|
289
|
-
source.style.update();
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* The store's texture, made if it has none and uploaded if the CPU
|
|
294
|
-
* changed the store since; null for one disposed, of 0 by 0, or larger
|
|
295
|
-
* than a texture may be. Smoothed, it is a linearly sampled copy.
|
|
296
|
-
*/
|
|
297
|
-
texture(store, smoothing) {
|
|
298
|
-
if (store.disposed ||
|
|
299
|
-
store.width === 0 ||
|
|
300
|
-
store.width > this.limit ||
|
|
301
|
-
store.height > this.limit) {
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
let copy = this.copies.get(store);
|
|
305
|
-
if (!copy) {
|
|
306
|
-
copy = new StoreTexture(this.renderer, this, new WeakRef(store), store.width, store.height);
|
|
307
|
-
this.copies.set(store, copy);
|
|
308
|
-
this.live.add(copy);
|
|
309
|
-
store.copies.add(copy);
|
|
310
|
-
// Unregistered by the copy itself, on dispose.
|
|
311
|
-
this.collected.register(store, copy, copy);
|
|
312
|
-
}
|
|
313
|
-
// Behind the store: its pixels, read back first if another renderer's draw wrote them.
|
|
314
|
-
if (copy.version !== store.version) {
|
|
315
|
-
copy.upload(store.readable);
|
|
316
|
-
copy.version = store.version;
|
|
317
|
-
}
|
|
318
|
-
return smoothing ? copy.sampled(true, false) : copy.texture;
|
|
319
|
-
}
|
|
320
|
-
/** The store's texture for a bitmap fill: repeating or clamped, smoothed or not, up to date. */
|
|
321
|
-
fillTexture(store, repeat, smooth) {
|
|
322
|
-
if (!this.texture(store)) {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
return this.copies.get(store).sampled(smooth, repeat);
|
|
326
|
-
}
|
|
327
|
-
/** A draw rendered into this renderer's copy of the store, which now holds the store as it is. */
|
|
328
|
-
drawn(store) {
|
|
329
|
-
const copy = this.copies.get(store);
|
|
330
|
-
if (copy) {
|
|
331
|
-
store.drawnOnGpu(copy);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
forget(copy) {
|
|
335
|
-
this.collected.unregister(copy);
|
|
336
|
-
this.live.delete(copy);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Each gradient's textures by region: one for a linear gradient, one for
|
|
340
|
-
* each region a radial one fills, which `drawPath` and `copyFrom` can make
|
|
341
|
-
* several of, each held by the contexts that draw with it.
|
|
342
|
-
*/
|
|
343
|
-
gradients = new WeakMap();
|
|
344
|
-
/**
|
|
345
|
-
* A gradient's texture and the matrix from its texels to the shape, made
|
|
346
|
-
* once for each region and held: given back with `release` by each
|
|
347
|
-
* context that took it, and freed when the last does: not when the fill
|
|
348
|
-
* is collected, as a drawing cleared may drop it while a view still draws
|
|
349
|
-
* the texture (`graphics.clear()` empties the layers the view holds too).
|
|
350
|
-
* A linear one is its ramp of 256 colours, sampled nearest and
|
|
351
|
-
* spread as the texture wraps, moved half a pixel so that a pixel's
|
|
352
|
-
* centre reads what Flash reads at its corner. A radial one is computed
|
|
353
|
-
* over the region it fills, a texel a pixel (up to RADIAL_MAX a side),
|
|
354
|
-
* sampled linearly.
|
|
355
|
-
*/
|
|
356
|
-
gradientTexture(fill, area) {
|
|
357
|
-
const region = area ?? { x: 0, y: 0, width: 1, height: 1 };
|
|
358
|
-
const key = area ? `${area.x} ${area.y} ${area.width} ${area.height}` : "";
|
|
359
|
-
let made = this.gradients.get(fill);
|
|
360
|
-
if (!made) {
|
|
361
|
-
made = new Map();
|
|
362
|
-
this.gradients.set(fill, made);
|
|
363
|
-
}
|
|
364
|
-
const known = made.get(key);
|
|
365
|
-
if (known) {
|
|
366
|
-
known.uses++;
|
|
367
|
-
return known;
|
|
368
|
-
}
|
|
369
|
-
const colors = ramp(fill.stops, fill.linearRgb);
|
|
370
|
-
const m = fill.matrix;
|
|
371
|
-
const columns = Math.min(RADIAL_MAX, region.width);
|
|
372
|
-
const rows = Math.min(RADIAL_MAX, region.height);
|
|
373
|
-
const clamped = fill.radial || fill.spread === 0;
|
|
374
|
-
const source = new BufferImageSource({
|
|
375
|
-
resource: rgbaOf(fill.radial
|
|
376
|
-
? radialPixels(colors, m, fill.focal, fill.spread, region, columns, rows)
|
|
377
|
-
: colors),
|
|
378
|
-
width: fill.radial ? columns : 256,
|
|
379
|
-
height: fill.radial ? rows : 1,
|
|
380
|
-
alphaMode: "premultiplied-alpha",
|
|
381
|
-
scaleMode: fill.radial ? "linear" : "nearest",
|
|
382
|
-
addressMode: clamped ? "clamp-to-edge" : fill.spread === 1 ? "mirror-repeat" : "repeat",
|
|
383
|
-
autoGarbageCollect: false,
|
|
384
|
-
});
|
|
385
|
-
if (clamped) {
|
|
386
|
-
keepClamped(source);
|
|
387
|
-
}
|
|
388
|
-
const texture = new Texture({ source });
|
|
389
|
-
const matrix = fill.radial
|
|
390
|
-
? new Matrix(region.width / columns, 0, 0, region.height / rows, region.x, region.y)
|
|
391
|
-
: new Matrix(1, 0, 0, 1, 0.5, 0.5)
|
|
392
|
-
.append(new Matrix(m.a, m.b, m.c, m.d, m.tx, m.ty))
|
|
393
|
-
// Texels to the gradient square, -819.2 to 819.2 a side.
|
|
394
|
-
.append(new Matrix(1638.4 / 256, 0, 0, 1638.4, -819.2, -819.2));
|
|
395
|
-
const byRegion = made;
|
|
396
|
-
const entry = {
|
|
397
|
-
texture,
|
|
398
|
-
matrix,
|
|
399
|
-
uses: 1,
|
|
400
|
-
release: () => {
|
|
401
|
-
if (--entry.uses === 0) {
|
|
402
|
-
byRegion.delete(key);
|
|
403
|
-
destroyTexture(texture);
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
};
|
|
407
|
-
made.set(key, entry);
|
|
408
|
-
return entry;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
const gpuBitmapsOf = new WeakMap();
|
|
412
|
-
/** Nothing, rendered to clear a texture. */
|
|
413
|
-
const EMPTY = new PixiContainer();
|
|
414
|
-
export function gpuBitmaps(renderer) {
|
|
415
|
-
let bitmaps = gpuBitmapsOf.get(renderer);
|
|
416
|
-
if (!bitmaps) {
|
|
417
|
-
bitmaps = new GpuBitmaps(renderer);
|
|
418
|
-
gpuBitmapsOf.set(renderer, bitmaps);
|
|
419
|
-
}
|
|
420
|
-
return bitmaps;
|
|
421
|
-
}
|
|
422
|
-
//# sourceMappingURL=bitmaps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bitmaps.js","sourceRoot":"","sources":["../../src/render/bitmaps.ts"],"names":[],"mappings":"AAAA,uEA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GAAG,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;QACnC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/render/blend.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { type Bounds, Container, type Filter, type FilterInstruction, type FilterSystem } from "pixi.js";
|
|
2
|
-
/**
|
|
3
|
-
* A filter that keeps the area its object was last measured at, to give
|
|
4
|
-
* it again while nothing in the object changed but where it is
|
|
5
|
-
* (FilterChain): Pixi measured every filtered object, all of it, on every
|
|
6
|
-
* frame, a crowd's glows and their characters' every part.
|
|
7
|
-
*/
|
|
8
|
-
export interface AreaKeeper {
|
|
9
|
-
/** Into `bounds` the area kept, moved as `container` has moved since; false where none stands. */
|
|
10
|
-
keptArea(container: Container, bounds: Bounds): boolean;
|
|
11
|
-
/** Keep `bounds`, the area just measured of `container`. */
|
|
12
|
-
keepArea(container: Container, bounds: Bounds): void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A masked container Pixi's bounds walk measured (render/hooks.ts): a mask
|
|
16
|
-
* from outside the area watched may bound what is in it, and move as
|
|
17
|
-
* nothing in it changes, so that area is not kept.
|
|
18
|
-
*/
|
|
19
|
-
export declare function noteMask(container: Container): void;
|
|
20
|
-
/**
|
|
21
|
-
* The area a filter instruction is applied to, measured in place of Pixi's
|
|
22
|
-
* filter system (render/hooks.ts): a filter that keeps its object's area
|
|
23
|
-
* gives it again while the object has only moved, and keeps the area
|
|
24
|
-
* measured otherwise, unless a mask from outside bounds something in it.
|
|
25
|
-
*/
|
|
26
|
-
export declare function measureFilterArea(instruction: FilterInstruction, bounds: Bounds, system: FilterSystem): void;
|
|
27
|
-
/** A filter whose padding depends on the area it pads and on what the renderer can draw. */
|
|
28
|
-
export interface PaddingFitter {
|
|
29
|
-
/** Its padding for `bounds`, as the filter system will pad them. */
|
|
30
|
-
fitPadding(bounds: Bounds, system: FilterSystem): void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The filters that composite an object in `mode`: none for normal; for
|
|
34
|
-
* layer one that only makes it a layer; for any other the mode's blend.
|
|
35
|
-
*/
|
|
36
|
-
export declare function blendFilters(mode: string): Filter[] | null;
|
|
37
|
-
//# sourceMappingURL=blend.d.ts.map
|