@swf2es/player-hosts 0.1.4 → 0.1.6
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/thread/format/bitmap.js +13 -14
- package/dist/thread/format/index.js +1 -1
- package/dist/thread/format/swf.js +11 -1
- package/dist/thread/player/avm1/globals/BitmapData.js +2 -1
- package/dist/thread/player/bitmap/composite.js +767 -0
- package/dist/thread/player/bitmap/draw.js +3 -3
- package/dist/thread/player/bitmap/filters.js +32 -32
- package/dist/thread/player/bitmap/ops.js +2 -766
- package/dist/thread/player/bitmap/pixel-bender.js +4 -1
- package/dist/thread/player/display/bounds.js +105 -0
- package/dist/thread/player/display/displayobject.js +1 -1
- package/dist/thread/player/display/drawing.js +25 -10
- package/dist/thread/player/display/instantiate.js +28 -29
- package/dist/thread/player/display/shapes.js +72 -54
- package/dist/thread/player/display/textobjects.js +34 -1
- package/dist/thread/player/player.js +4 -3
- package/dist/thread/player/playerglobal/flash/desktop/NativeApplication.js +1 -1
- package/dist/thread/player/playerglobal/flash/display/BitmapData.js +3 -2
- package/dist/thread/player/playerglobal/flash/display/DisplayObject.js +2 -2
- package/dist/thread/player/playerglobal/flash/display/SimpleButton.js +12 -11
- package/dist/thread/player/playerglobal/flash/display/Stage.js +2 -8
- package/dist/thread/player/playerglobal/flash/display/shaders.js +1 -1
- package/dist/thread/player/playerglobal/flash/filesystem/paths.js +1 -1
- package/dist/thread/player/playerglobal/flash/filesystem/writes.js +1 -1
- package/dist/thread/player/playerglobal/flash/globalization/locale.js +1 -1
- package/dist/thread/player/scripting/events.js +2 -2
- package/dist/thread/player/scripting/lifecycle.js +39 -19
- package/dist/thread/player/scripting/symbols.js +24 -30
- package/dist/thread/player/scripting.js +5 -9
- package/dist/thread/runtime/avm1/errors.js +1 -1
- package/dist/thread/runtime/avm1/numbers.js +7 -8
- package/dist/thread/runtime/avm2/amf.js +2 -1
- package/dist/thread/runtime/avm2/names.js +0 -4
- package/dist/thread/runtime/avm2/natives/bytearray.js +6 -166
- package/dist/thread/runtime/avm2/natives/regexp.js +68 -64
- package/dist/thread/runtime/avm2/natives/shell-workers.js +1 -1
- package/dist/thread/runtime/avm2/natives/shell.js +2 -1
- package/dist/thread/runtime/avm2/natives/xml/parser.js +2 -2
- package/dist/thread/runtime/avm2/numbers.js +1 -1
- package/dist/thread/runtime/avm2/runtime.js +10 -8
- package/dist/thread/runtime/avm2/traits.js +1 -1
- package/dist/thread/runtime/avm2/utf8.js +167 -0
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// A display object drawn into a bitmap: rendered by the host's renderer
|
|
2
|
-
// over its own bounds alone, then composited as a bitmap is
|
|
3
|
-
//
|
|
2
|
+
// over its own bounds alone, then composited as a bitmap is
|
|
3
|
+
// (composite.ts). AS3's BitmapData.draw and AVM1's share it.
|
|
4
4
|
import { bounds } from "../display/bounds.js";
|
|
5
5
|
import { pickWork } from "../display/display.js";
|
|
6
6
|
import { transformRect } from "../display/geometry.js";
|
|
7
7
|
import { drawnAsStage } from "../display/perspective.js";
|
|
8
8
|
import { BitmapStore } from "./bitmap.js";
|
|
9
|
-
import { drawBitmap } from "./
|
|
9
|
+
import { drawBitmap } from "./composite.js";
|
|
10
10
|
/** `d` drawn into `store` through `m`, as drawInto draws a display object. */
|
|
11
11
|
function drawObject(drawer, store, d, m, c, blend, r, samples) {
|
|
12
12
|
// Only the part the object can reach: its bounds through the matrix, a
|
|
@@ -52,17 +52,16 @@ function spreadOf(blur, quality, kind) {
|
|
|
52
52
|
}
|
|
53
53
|
/** How far a filter's rect reaches past what it filters, each way, before any offset: [x, y], whole pixels. */
|
|
54
54
|
function reach(f) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
: [0, 0];
|
|
55
|
+
switch (f.kind) {
|
|
56
|
+
case "convolution":
|
|
57
|
+
return [f.matrixX >> 1, f.matrixY >> 1];
|
|
58
|
+
case "colorMatrix":
|
|
59
|
+
return [0, 0];
|
|
60
|
+
// A displacement map's reach, by its scale, as adl reckons it: a quarter of it, whole; none with no map.
|
|
61
|
+
case "displacementMap":
|
|
62
|
+
return f.mapBitmap
|
|
63
|
+
? [Math.floor(Math.abs(f.scaleX) / 4) || 0, Math.floor(Math.abs(f.scaleY) / 4) || 0]
|
|
64
|
+
: [0, 0];
|
|
66
65
|
}
|
|
67
66
|
return [spreadOf(f.blurX, f.quality, f.kind), spreadOf(f.blurY, f.quality, f.kind)];
|
|
68
67
|
}
|
|
@@ -291,29 +290,30 @@ export function applyFilter(dest, source, rect, dx, dy, given, map = null) {
|
|
|
291
290
|
write(dest, displace(source, rect, shown, f, map), shown, shown, mx, my);
|
|
292
291
|
return true;
|
|
293
292
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
293
|
+
switch (f.kind) {
|
|
294
|
+
case "convolution": {
|
|
295
|
+
if (f.matrixX === 0 || f.matrixY === 0) {
|
|
296
|
+
copyEmpty(dest, source, rect, out, shown, mx, my);
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
const pixels = convolve(source, shown, f, dest.transparent);
|
|
300
|
+
if (pixels) {
|
|
301
|
+
write(dest, pixels, shown, shown, mx, my);
|
|
302
|
+
}
|
|
303
|
+
return true;
|
|
302
304
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
write(dest, pixels, shown, shown, mx, my);
|
|
305
|
+
case "colorMatrix":
|
|
306
|
+
colorMatrix(dest, source, rect, dx, dy, f.matrix);
|
|
307
|
+
return true;
|
|
308
|
+
case "blur": {
|
|
309
|
+
// What is shown, blurred as far round it as the blur reaches into it, which may be past the
|
|
310
|
+
// rect, whose edge cuts what is written alone.
|
|
311
|
+
const pixels = bitmapKernel()?.blur(source, shown, f.blurX, f.blurY, f.quality);
|
|
312
|
+
if (pixels) {
|
|
313
|
+
write(dest, pixels, shown, shown, mx, my);
|
|
314
|
+
}
|
|
315
|
+
return true;
|
|
315
316
|
}
|
|
316
|
-
return true;
|
|
317
317
|
}
|
|
318
318
|
// The source's pixels where they are shown, and its alpha blurred and read
|
|
319
319
|
// from the offset, each over what is shown alone: however far the offset
|