@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
|
@@ -97,20 +97,19 @@ function cleanJpeg(data) {
|
|
|
97
97
|
if (data[at] !== 0xff) {
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return concatAll(out);
|
|
100
|
+
switch (data[at + 1]) {
|
|
101
|
+
case 0xd8:
|
|
102
|
+
case 0xd9:
|
|
103
|
+
at += 2;
|
|
104
|
+
continue;
|
|
105
|
+
case 0xff:
|
|
106
|
+
// Fill bytes before a marker.
|
|
107
|
+
at++;
|
|
108
|
+
continue;
|
|
109
|
+
case 0xda:
|
|
110
|
+
// The scan, and everything after it, as it is.
|
|
111
|
+
out.push(data.subarray(at));
|
|
112
|
+
return concatAll(out);
|
|
114
113
|
}
|
|
115
114
|
if (at + 3 >= data.length) {
|
|
116
115
|
return null;
|
|
@@ -20,7 +20,7 @@ export { glyphOf, readFont, readFont4, readFontAlignZones, readFontInfo, } from
|
|
|
20
20
|
export { PBJ_RULES, PBJ_STRING, PBJ_TYPE_SIZES, PBJ_TYPES, PbjError, PbjOp, pbjFloatType, readPbj, } from "./pbj.js";
|
|
21
21
|
export { IDENTITY, readColorTransform, readMatrix, readMorphShape, readShape, } from "./shape.js";
|
|
22
22
|
export { readButtonSound, readSound, readSoundInfo, readSoundStreamBlock, readSoundStreamHead, readStartSound, } from "./sound.js";
|
|
23
|
-
export { backgroundColor, fileAttributes, isAs3, readSwf, readSwfHeader, readTags, SwfReader, } from "./swf.js";
|
|
23
|
+
export { backgroundColor, definesInput, fileAttributes, isAs3, readSwf, readSwfHeader, readTags, SwfReader, } from "./swf.js";
|
|
24
24
|
export * as tags from "./tags.js";
|
|
25
25
|
export { readCsmTextSettings, readEditText, readFontName, readStaticText, } from "./text.js";
|
|
26
26
|
export { readZip, ZipError } from "./zip.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// decompression, the frame size as a RECT, the frame rate as 8.8 fixed
|
|
4
4
|
// point, the frame count, then tags to an End tag or the body's end.
|
|
5
5
|
import { decompressSwf, decompressSwfPrefix } from "./compression.js";
|
|
6
|
-
import { End, FileAttributes, SetBackgroundColor } from "./tags.js";
|
|
6
|
+
import { DefineButton, DefineButton2, DefineEditText, End, FileAttributes, SetBackgroundColor, } from "./tags.js";
|
|
7
7
|
const SIGNATURES = { FWS: "none", CWS: "zlib", ZWS: "lzma" };
|
|
8
8
|
/** Read the 8-byte header every SWF starts with. */
|
|
9
9
|
export function readSwfHeader(bytes) {
|
|
@@ -161,3 +161,13 @@ export function isAs3(swf) {
|
|
|
161
161
|
const tag = swf.tags.find((t) => t.code === FileAttributes);
|
|
162
162
|
return !!tag && tag.length >= 1 && (swf.bytes[tag.offset] & 0x08) !== 0;
|
|
163
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Whether the SWF defines what the pointer or the keys reach with no script
|
|
166
|
+
* of its own: a button, which shows its over and down states, or a text
|
|
167
|
+
* field, which may be selected or typed in. Flash plays such a SWF's
|
|
168
|
+
* buttons and fields as any other's, so a host gives it the VM that takes
|
|
169
|
+
* input even when it has no code to run.
|
|
170
|
+
*/
|
|
171
|
+
export function definesInput(swf) {
|
|
172
|
+
return swf.tags.some((t) => t.code === DefineButton || t.code === DefineButton2 || t.code === DefineEditText);
|
|
173
|
+
}
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
// -4 for a rectangle that is none.
|
|
10
10
|
import { avm1 } from "../../../runtime/index.js";
|
|
11
11
|
import { BitmapStore, pixelRect, spanRect } from "../../bitmap/bitmap.js";
|
|
12
|
+
import { drawBitmap } from "../../bitmap/composite.js";
|
|
12
13
|
import { drawDisplayObject } from "../../bitmap/draw.js";
|
|
13
14
|
import { applyFilter, filterRefusal, GLOWS, generatedRect } from "../../bitmap/filters.js";
|
|
14
|
-
import { alphaAt, colorBounds, colorTransform, comparePixels, copyChannel,
|
|
15
|
+
import { alphaAt, colorBounds, colorTransform, comparePixels, copyChannel, floodFill, isThresholdOperation, merge, noise, paletteMap, perlinNoise, pixelDissolve, scroll, threshold, } from "../../bitmap/ops.js";
|
|
15
16
|
import { BLEND_MODES } from "../../display/displayobject.js";
|
|
16
17
|
import { filterRecordOf } from "./filters.js";
|
|
17
18
|
import { colorValues, makeGeom } from "./geom.js";
|