@swf2es/format 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/LICENSE.third-party +35 -0
- package/README.md +22 -2
- package/dist/abc-names.d.ts +3 -0
- package/dist/abc-names.d.ts.map +1 -0
- package/dist/abc-names.js +127 -0
- package/dist/abc-names.js.map +1 -0
- package/dist/actions.d.ts +106 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +223 -0
- package/dist/actions.js.map +1 -0
- package/dist/air-descriptor.d.ts +11 -0
- package/dist/air-descriptor.d.ts.map +1 -0
- package/dist/air-descriptor.js +64 -0
- package/dist/air-descriptor.js.map +1 -0
- package/dist/api-versions.d.ts +12 -0
- package/dist/api-versions.d.ts.map +1 -0
- package/dist/api-versions.js +23 -0
- package/dist/api-versions.js.map +1 -0
- package/dist/bitmap.d.ts +34 -0
- package/dist/bitmap.d.ts.map +1 -0
- package/dist/bitmap.js +200 -0
- package/dist/bitmap.js.map +1 -0
- package/dist/button.d.ts +39 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +61 -0
- package/dist/button.js.map +1 -0
- package/dist/compression.d.ts +47 -0
- package/dist/compression.d.ts.map +1 -0
- package/dist/compression.js +201 -0
- package/dist/compression.js.map +1 -0
- package/dist/display.d.ts +106 -0
- package/dist/display.d.ts.map +1 -0
- package/dist/display.js +306 -0
- package/dist/display.js.map +1 -0
- package/dist/filters.d.ts +66 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +137 -0
- package/dist/filters.js.map +1 -0
- package/dist/font.d.ts +60 -0
- package/dist/font.d.ts.map +1 -0
- package/dist/font.js +169 -0
- package/dist/font.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/lzma.d.ts +33 -0
- package/dist/lzma.d.ts.map +1 -0
- package/dist/lzma.js +279 -0
- package/dist/lzma.js.map +1 -0
- package/dist/pbj.d.ts +178 -0
- package/dist/pbj.d.ts.map +1 -0
- package/dist/pbj.js +485 -0
- package/dist/pbj.js.map +1 -0
- package/dist/shape.d.ts +152 -0
- package/dist/shape.d.ts.map +1 -0
- package/dist/shape.js +412 -0
- package/dist/shape.js.map +1 -0
- package/dist/sound.d.ts +71 -0
- package/dist/sound.d.ts.map +1 -0
- package/dist/sound.js +92 -0
- package/dist/sound.js.map +1 -0
- package/dist/swf.d.ts +77 -0
- package/dist/swf.d.ts.map +1 -0
- package/dist/swf.js +164 -0
- package/dist/swf.js.map +1 -0
- package/dist/tags.d.ts +57 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +59 -0
- package/dist/tags.js.map +1 -0
- package/dist/text.d.ts +75 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +136 -0
- package/dist/text.js.map +1 -0
- package/dist/zip.d.ts +17 -0
- package/dist/zip.d.ts.map +1 -0
- package/dist/zip.js +92 -0
- package/dist/zip.js.map +1 -0
- package/package.json +33 -3
- package/src/abc-names.ts +138 -0
- package/src/actions.ts +319 -0
- package/src/air-descriptor.ts +84 -0
- package/src/api-versions.ts +27 -0
- package/src/bitmap.ts +259 -0
- package/src/button.ts +99 -0
- package/src/compression.ts +243 -0
- package/src/display.ts +419 -0
- package/src/filters.ts +206 -0
- package/src/font.ts +238 -0
- package/src/index.ts +151 -0
- package/src/pbj.ts +651 -0
- package/src/shape.ts +618 -0
- package/src/sound.ts +173 -0
- package/src/swf.ts +234 -0
- package/src/tags.ts +58 -0
- package/src/text.ts +213 -0
- package/src/zip.ts +135 -0
package/dist/sound.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { SwfReader, type Tag } from "./swf.js";
|
|
2
|
+
export interface Sound {
|
|
3
|
+
id: number;
|
|
4
|
+
format: number;
|
|
5
|
+
sampleRate: number;
|
|
6
|
+
sampleSize: 8 | 16;
|
|
7
|
+
channels: 1 | 2;
|
|
8
|
+
sampleCount: number;
|
|
9
|
+
/** For MP3, the signed sample offset at the front of SoundData. */
|
|
10
|
+
seekSamples: number;
|
|
11
|
+
data: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export declare function readSound(bytes: Uint8Array, tag: Tag): Sound;
|
|
14
|
+
/** A point of SOUNDINFO's envelope: its sample at 44.1 kHz from the start, and each channel's level, 0 to 1. */
|
|
15
|
+
export interface SoundEnvelopePoint {
|
|
16
|
+
sample: number;
|
|
17
|
+
left: number;
|
|
18
|
+
right: number;
|
|
19
|
+
}
|
|
20
|
+
/** SOUNDINFO: how StartSound, StartSound2 and DefineButtonSound play a sound. */
|
|
21
|
+
export interface SoundInfo {
|
|
22
|
+
/** SyncStop: stop the sound wherever it plays, and start none. */
|
|
23
|
+
stop: boolean;
|
|
24
|
+
/** SyncNoMultiple: start none while the sound plays. */
|
|
25
|
+
noMultiple: boolean;
|
|
26
|
+
/** Where each loop starts and ends, in samples at 44.1 kHz; null for the sound's own. */
|
|
27
|
+
inPoint: number | null;
|
|
28
|
+
outPoint: number | null;
|
|
29
|
+
/** 1 without HasLoops. */
|
|
30
|
+
loops: number;
|
|
31
|
+
envelope: SoundEnvelopePoint[] | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function readSoundInfo(r: SwfReader): SoundInfo;
|
|
34
|
+
/** StartSound names its sound by id, StartSound2 by the class bound to it. */
|
|
35
|
+
export interface StartSound {
|
|
36
|
+
id: number | null;
|
|
37
|
+
className: string | null;
|
|
38
|
+
info: SoundInfo;
|
|
39
|
+
}
|
|
40
|
+
export declare function readStartSound(bytes: Uint8Array, tag: Tag): StartSound;
|
|
41
|
+
/** SoundStreamHead or SoundStreamHead2: the format of a timeline's SoundStreamBlocks. */
|
|
42
|
+
export interface SoundStreamHead {
|
|
43
|
+
format: number;
|
|
44
|
+
sampleRate: number;
|
|
45
|
+
sampleSize: 8 | 16;
|
|
46
|
+
channels: 1 | 2;
|
|
47
|
+
/** The samples each frame's block holds, on average. */
|
|
48
|
+
samplesPerBlock: number;
|
|
49
|
+
}
|
|
50
|
+
export declare function readSoundStreamHead(bytes: Uint8Array, tag: Tag): SoundStreamHead;
|
|
51
|
+
/** A SoundStreamBlock's samples: for MP3, the frames after its sample count and seek. */
|
|
52
|
+
export interface SoundStreamBlock {
|
|
53
|
+
/** MP3's own count; null for the other formats, whose bytes tell it. */
|
|
54
|
+
sampleCount: number | null;
|
|
55
|
+
data: Uint8Array;
|
|
56
|
+
}
|
|
57
|
+
export declare function readSoundStreamBlock(bytes: Uint8Array, tag: Tag, format: number): SoundStreamBlock;
|
|
58
|
+
/**
|
|
59
|
+
* DefineButtonSound: the sounds a button plays as its state changes, in
|
|
60
|
+
* the tag's order: over to up, up to over, over to down, down to over.
|
|
61
|
+
* Some tools write fewer than four, as Ruffle notes; the missing are none.
|
|
62
|
+
*/
|
|
63
|
+
export interface ButtonSounds {
|
|
64
|
+
id: number;
|
|
65
|
+
sounds: ({
|
|
66
|
+
id: number;
|
|
67
|
+
info: SoundInfo;
|
|
68
|
+
} | null)[];
|
|
69
|
+
}
|
|
70
|
+
export declare function readButtonSound(bytes: Uint8Array, tag: Tag): ButtonSounds;
|
|
71
|
+
//# sourceMappingURL=sound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["../src/sound.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE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AgB;IAC/B,wEAAwE;IACxE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,GACb,gBAAgB,CASlB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC,EAAE,CAAC;CACpD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,YAAY,CAUzE"}
|
package/dist/sound.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// DefineSound's header and encoded samples, and the tags that play sounds
|
|
2
|
+
// from a timeline: StartSound and StartSound2, the stream of
|
|
3
|
+
// SoundStreamHead and SoundStreamBlock, and DefineButtonSound. Decoding
|
|
4
|
+
// belongs to the player, where a host can supply an audio device.
|
|
5
|
+
import { readString } from "./display.js";
|
|
6
|
+
import { SwfReader } from "./swf.js";
|
|
7
|
+
import { StartSound2 } from "./tags.js";
|
|
8
|
+
const RATES = [5512.5, 11025, 22050, 44100];
|
|
9
|
+
export function readSound(bytes, tag) {
|
|
10
|
+
const r = new SwfReader(bytes, tag.offset, tag.offset + tag.length);
|
|
11
|
+
const id = r.u16();
|
|
12
|
+
const flags = r.u8();
|
|
13
|
+
const format = flags >> 4;
|
|
14
|
+
const sampleRate = RATES[(flags >> 2) & 3];
|
|
15
|
+
const sampleSize = (flags & 2) === 0 ? 8 : 16;
|
|
16
|
+
const channels = (flags & 1) === 0 ? 1 : 2;
|
|
17
|
+
const sampleCount = r.u32();
|
|
18
|
+
const seekSamples = format === 2 ? r.s16() : 0;
|
|
19
|
+
return {
|
|
20
|
+
id,
|
|
21
|
+
format,
|
|
22
|
+
sampleRate,
|
|
23
|
+
sampleSize,
|
|
24
|
+
channels,
|
|
25
|
+
sampleCount,
|
|
26
|
+
seekSamples,
|
|
27
|
+
data: bytes.subarray(r.pos, tag.offset + tag.length),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function readSoundInfo(r) {
|
|
31
|
+
const flags = r.u8();
|
|
32
|
+
const inPoint = flags & 0x01 ? r.u32() : null;
|
|
33
|
+
const outPoint = flags & 0x02 ? r.u32() : null;
|
|
34
|
+
const loops = flags & 0x04 ? r.u16() : 1;
|
|
35
|
+
let envelope = null;
|
|
36
|
+
if (flags & 0x08) {
|
|
37
|
+
envelope = [];
|
|
38
|
+
for (let n = r.u8(); n > 0 && !r.overrun; n--) {
|
|
39
|
+
envelope.push({ sample: r.u32(), left: r.u16() / 32768, right: r.u16() / 32768 });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
stop: (flags & 0x20) !== 0,
|
|
44
|
+
noMultiple: (flags & 0x10) !== 0,
|
|
45
|
+
inPoint,
|
|
46
|
+
outPoint,
|
|
47
|
+
loops,
|
|
48
|
+
envelope,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function readStartSound(bytes, tag) {
|
|
52
|
+
const r = new SwfReader(bytes, tag.offset, tag.offset + tag.length);
|
|
53
|
+
if (tag.code === StartSound2) {
|
|
54
|
+
const className = readString(r);
|
|
55
|
+
return { id: null, className, info: readSoundInfo(r) };
|
|
56
|
+
}
|
|
57
|
+
const id = r.u16();
|
|
58
|
+
return { id, className: null, info: readSoundInfo(r) };
|
|
59
|
+
}
|
|
60
|
+
export function readSoundStreamHead(bytes, tag) {
|
|
61
|
+
const r = new SwfReader(bytes, tag.offset, tag.offset + tag.length);
|
|
62
|
+
// The playback format is only a hint; the stream's own follows it.
|
|
63
|
+
r.u8();
|
|
64
|
+
const flags = r.u8();
|
|
65
|
+
return {
|
|
66
|
+
format: flags >> 4,
|
|
67
|
+
sampleRate: RATES[(flags >> 2) & 3],
|
|
68
|
+
sampleSize: (flags & 2) === 0 ? 8 : 16,
|
|
69
|
+
channels: (flags & 1) === 0 ? 1 : 2,
|
|
70
|
+
samplesPerBlock: r.u16(),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function readSoundStreamBlock(bytes, tag, format) {
|
|
74
|
+
const end = tag.offset + tag.length;
|
|
75
|
+
if (format !== 2) {
|
|
76
|
+
return { sampleCount: null, data: bytes.subarray(tag.offset, end) };
|
|
77
|
+
}
|
|
78
|
+
const r = new SwfReader(bytes, tag.offset, end);
|
|
79
|
+
const sampleCount = r.u16();
|
|
80
|
+
return { sampleCount, data: bytes.subarray(Math.min(end, tag.offset + 4), end) };
|
|
81
|
+
}
|
|
82
|
+
export function readButtonSound(bytes, tag) {
|
|
83
|
+
const r = new SwfReader(bytes, tag.offset, tag.offset + tag.length);
|
|
84
|
+
const id = r.u16();
|
|
85
|
+
const sounds = [];
|
|
86
|
+
for (let i = 0; i < 4; i++) {
|
|
87
|
+
const sound = r.pos + 2 <= r.end ? r.u16() : 0;
|
|
88
|
+
sounds.push(sound === 0 ? null : { id: sound, info: readSoundInfo(r) });
|
|
89
|
+
}
|
|
90
|
+
return { id, sounds };
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=sound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sound.js","sourceRoot":"","sources":["../src/sound.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6DAA6D;AAC7D,wEAAwE;AACxE,kEAAkE;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAY,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAcxC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAE5C,MAAM,U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ompression = "none" | "zlib" | "lzma";
|
|
2
|
+
export interface SwfHeader {
|
|
3
|
+
compression: SwfCompression;
|
|
4
|
+
/** SWF version byte (e.g. 10 for Flash Player 10). */
|
|
5
|
+
version: number;
|
|
6
|
+
/** Uncompressed length of the whole file, header included. */
|
|
7
|
+
fileLength: number;
|
|
8
|
+
}
|
|
9
|
+
/** A rectangle in twips (1/20 pixel), as a RECT holds one. */
|
|
10
|
+
export interface Rect {
|
|
11
|
+
xMin: number;
|
|
12
|
+
xMax: number;
|
|
13
|
+
yMin: number;
|
|
14
|
+
yMax: number;
|
|
15
|
+
}
|
|
16
|
+
/** A tag: its code, and where its body is in the decompressed file. */
|
|
17
|
+
export interface Tag {
|
|
18
|
+
code: number;
|
|
19
|
+
/** Offset of the body in the decompressed file, after the tag's header. */
|
|
20
|
+
offset: number;
|
|
21
|
+
length: number;
|
|
22
|
+
/** Whether the header was the long form, which Flash requires of a bitmap tag. */
|
|
23
|
+
long: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface Swf {
|
|
26
|
+
header: SwfHeader;
|
|
27
|
+
/** The whole file, decompressed, header included; tags' offsets are into it. */
|
|
28
|
+
bytes: Uint8Array;
|
|
29
|
+
frameSize: Rect;
|
|
30
|
+
/** Frames per second: the 8.8 fixed-point value as a number. */
|
|
31
|
+
frameRate: number;
|
|
32
|
+
frameCount: number;
|
|
33
|
+
tags: Tag[];
|
|
34
|
+
/** Whether the tags ran past the end of the file, and were cut there. */
|
|
35
|
+
truncated: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Read the 8-byte header every SWF starts with. */
|
|
38
|
+
export declare function readSwfHeader(bytes: Uint8Array): SwfHeader;
|
|
39
|
+
/** Reads bits and bytes of a SWF body, bits most significant first, as the format packs them. */
|
|
40
|
+
export declare class SwfReader {
|
|
41
|
+
readonly bytes: Uint8Array;
|
|
42
|
+
pos: number;
|
|
43
|
+
readonly end: number;
|
|
44
|
+
private bit;
|
|
45
|
+
private byte;
|
|
46
|
+
constructor(bytes: Uint8Array, pos?: number, end?: number);
|
|
47
|
+
/** Past the end: every read after it gives 0. */
|
|
48
|
+
get overrun(): boolean;
|
|
49
|
+
align(): void;
|
|
50
|
+
ub(n: number): number;
|
|
51
|
+
sb(n: number): number;
|
|
52
|
+
u8(): number;
|
|
53
|
+
u16(): number;
|
|
54
|
+
u32(): number;
|
|
55
|
+
s16(): number;
|
|
56
|
+
rect(): Rect;
|
|
57
|
+
}
|
|
58
|
+
/** A SWF's header and tags, its body decompressed. */
|
|
59
|
+
export declare function readSwf(file: Uint8Array): Swf;
|
|
60
|
+
/** The tags from `start` to an End tag or `end`, as a sprite's or the file's. */
|
|
61
|
+
export declare function readTags(bytes: Uint8Array, start: number, end: number): {
|
|
62
|
+
tags: Tag[];
|
|
63
|
+
truncated: boolean;
|
|
64
|
+
};
|
|
65
|
+
/** The background colour SetBackgroundColor sets, 0xRRGGBB, or white without one. */
|
|
66
|
+
export declare function backgroundColor(swf: Swf): number;
|
|
67
|
+
/**
|
|
68
|
+
* The flags of a SWF file's FileAttributes, from the start of the file
|
|
69
|
+
* alone, as Flash Player reads them, FileAttributes being the first tag:
|
|
70
|
+
* 0 for a SWF whose first tag is another. For a host that must not
|
|
71
|
+
* decompress the whole of a SWF it does not trust, as a desktop shell
|
|
72
|
+
* choosing a local SWF's sandbox; ActionScript3 is 0x08, UseNetwork 0x01.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fileAttributes(file: Uint8Array): number;
|
|
75
|
+
/** Whether FileAttributes marks the SWF as ActionScript 3; without the bit it is an AVM1 movie. */
|
|
76
|
+
export declare function isAs3(swf: Swf): boolean;
|
|
77
|
+
//# sourceMappingURL=swf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swf.d.ts","sourceRoot":"","sources":["../src/swf.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,SAAS;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CAAC,EAAE,MAAM,GAAG,MAAM,CAYpB;IAED,EAAE,IAAI,MAAM,CAKX;IAED,GAAG,IAAI,MAAM,CAEZ;IAED,GAAG,IAAI,MAAM,CAEZ;IAED,GAAG,IAAI,MAAM,CAEZ;IAED,IAAI,IAAI,IAAI,CAMX;CACF;AAED,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,GAAG,CAS7C;AAED,iFAAiF;AACjF,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV;IAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAyBrC;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAQhD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAqBvD;AAED,mGAAmG;AACnG,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGvC"}
|
package/dist/swf.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// A SWF's movie header and its tags, as the SWF file format specification
|
|
2
|
+
// (version 19) lays them out: after the 8-byte file header and the body's
|
|
3
|
+
// decompression, the frame size as a RECT, the frame rate as 8.8 fixed
|
|
4
|
+
// point, the frame count, then tags to an End tag or the body's end.
|
|
5
|
+
import { decompressSwf, decompressSwfPrefix } from "./compression.js";
|
|
6
|
+
import { End, FileAttributes, SetBackgroundColor } from "./tags.js";
|
|
7
|
+
const SIGNATURES = { FWS: "none", CWS: "zlib", ZWS: "lzma" };
|
|
8
|
+
/** Read the 8-byte header every SWF starts with. */
|
|
9
|
+
export function readSwfHeader(bytes) {
|
|
10
|
+
if (bytes.length < 8) {
|
|
11
|
+
throw new RangeError(`SWF header needs 8 bytes, got ${bytes.length}`);
|
|
12
|
+
}
|
|
13
|
+
const signature = String.fromCharCode(bytes[0], bytes[1], bytes[2]);
|
|
14
|
+
const compression = SIGNATURES[signature];
|
|
15
|
+
if (!compression) {
|
|
16
|
+
throw new TypeError(`Not a SWF file (signature ${JSON.stringify(signature)})`);
|
|
17
|
+
}
|
|
18
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19
|
+
return { compression, version: bytes[3], fileLength: view.getUint32(4, true) };
|
|
20
|
+
}
|
|
21
|
+
/** Reads bits and bytes of a SWF body, bits most significant first, as the format packs them. */
|
|
22
|
+
export class SwfReader {
|
|
23
|
+
bytes;
|
|
24
|
+
pos;
|
|
25
|
+
end;
|
|
26
|
+
bit = 0;
|
|
27
|
+
byte = 0;
|
|
28
|
+
constructor(bytes, pos = 0, end = bytes.length) {
|
|
29
|
+
this.bytes = bytes;
|
|
30
|
+
this.pos = pos;
|
|
31
|
+
this.end = end;
|
|
32
|
+
}
|
|
33
|
+
/** Past the end: every read after it gives 0. */
|
|
34
|
+
get overrun() {
|
|
35
|
+
return this.pos > this.end;
|
|
36
|
+
}
|
|
37
|
+
align() {
|
|
38
|
+
this.bit = 0;
|
|
39
|
+
}
|
|
40
|
+
ub(n) {
|
|
41
|
+
let v = 0;
|
|
42
|
+
for (let i = 0; i < n; i++) {
|
|
43
|
+
if (this.bit === 0) {
|
|
44
|
+
this.byte = this.pos < this.end ? this.bytes[this.pos] : 0;
|
|
45
|
+
this.pos++;
|
|
46
|
+
this.bit = 8;
|
|
47
|
+
}
|
|
48
|
+
this.bit--;
|
|
49
|
+
v = v * 2 + ((this.byte >> this.bit) & 1);
|
|
50
|
+
}
|
|
51
|
+
return v;
|
|
52
|
+
}
|
|
53
|
+
sb(n) {
|
|
54
|
+
if (n > 0 && n <= 32 && n === (n | 0)) {
|
|
55
|
+
const shift = 32 - n;
|
|
56
|
+
return (this.ub(n) << shift) >> shift;
|
|
57
|
+
}
|
|
58
|
+
if (n === 0) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
const v = this.ub(n);
|
|
62
|
+
return v >= 2 ** (n - 1) ? v - 2 ** n : v;
|
|
63
|
+
}
|
|
64
|
+
u8() {
|
|
65
|
+
this.align();
|
|
66
|
+
const v = this.pos < this.end ? this.bytes[this.pos] : 0;
|
|
67
|
+
this.pos++;
|
|
68
|
+
return v;
|
|
69
|
+
}
|
|
70
|
+
u16() {
|
|
71
|
+
return this.u8() | (this.u8() << 8);
|
|
72
|
+
}
|
|
73
|
+
u32() {
|
|
74
|
+
return (this.u16() | (this.u16() << 16)) >>> 0;
|
|
75
|
+
}
|
|
76
|
+
s16() {
|
|
77
|
+
return (this.u16() << 16) >> 16;
|
|
78
|
+
}
|
|
79
|
+
rect() {
|
|
80
|
+
this.align();
|
|
81
|
+
const n = this.ub(5);
|
|
82
|
+
const rect = { xMin: this.sb(n), xMax: this.sb(n), yMin: this.sb(n), yMax: this.sb(n) };
|
|
83
|
+
this.align();
|
|
84
|
+
return rect;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** A SWF's header and tags, its body decompressed. */
|
|
88
|
+
export function readSwf(file) {
|
|
89
|
+
const header = readSwfHeader(file);
|
|
90
|
+
const bytes = decompressSwf(file);
|
|
91
|
+
const r = new SwfReader(bytes, 8);
|
|
92
|
+
const frameSize = r.rect();
|
|
93
|
+
const frameRate = r.u16() / 256;
|
|
94
|
+
const frameCount = r.u16();
|
|
95
|
+
const { tags, truncated } = readTags(bytes, r.pos, bytes.length);
|
|
96
|
+
return { header, bytes, frameSize, frameRate, frameCount, tags, truncated };
|
|
97
|
+
}
|
|
98
|
+
/** The tags from `start` to an End tag or `end`, as a sprite's or the file's. */
|
|
99
|
+
export function readTags(bytes, start, end) {
|
|
100
|
+
const tags = [];
|
|
101
|
+
const r = new SwfReader(bytes, start, end);
|
|
102
|
+
while (r.pos + 2 <= end) {
|
|
103
|
+
const codeAndLength = r.u16();
|
|
104
|
+
const code = codeAndLength >> 6;
|
|
105
|
+
let length = codeAndLength & 0x3f;
|
|
106
|
+
const long = length === 0x3f;
|
|
107
|
+
if (long) {
|
|
108
|
+
length = r.u32();
|
|
109
|
+
}
|
|
110
|
+
if (r.pos + length > end) {
|
|
111
|
+
tags.push({ code, offset: r.pos, length: Math.max(0, end - r.pos), long });
|
|
112
|
+
return { tags, truncated: true };
|
|
113
|
+
}
|
|
114
|
+
tags.push({ code, offset: r.pos, length, long });
|
|
115
|
+
r.pos += length;
|
|
116
|
+
if (code === End) {
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return { tags, truncated: false };
|
|
121
|
+
}
|
|
122
|
+
/** The background colour SetBackgroundColor sets, 0xRRGGBB, or white without one. */
|
|
123
|
+
export function backgroundColor(swf) {
|
|
124
|
+
const tag = swf.tags.find((t) => t.code === SetBackgroundColor);
|
|
125
|
+
if (!tag || tag.length < 3) {
|
|
126
|
+
return 0xffffff;
|
|
127
|
+
}
|
|
128
|
+
const b = swf.bytes;
|
|
129
|
+
return (b[tag.offset] << 16) | (b[tag.offset + 1] << 8) | b[tag.offset + 2];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The flags of a SWF file's FileAttributes, from the start of the file
|
|
133
|
+
* alone, as Flash Player reads them, FileAttributes being the first tag:
|
|
134
|
+
* 0 for a SWF whose first tag is another. For a host that must not
|
|
135
|
+
* decompress the whole of a SWF it does not trust, as a desktop shell
|
|
136
|
+
* choosing a local SWF's sandbox; ActionScript3 is 0x08, UseNetwork 0x01.
|
|
137
|
+
*/
|
|
138
|
+
export function fileAttributes(file) {
|
|
139
|
+
// The header's rect is 17 bytes at most, then the rate, count, and a long tag header.
|
|
140
|
+
const bytes = decompressSwfPrefix(file, 64);
|
|
141
|
+
try {
|
|
142
|
+
const r = new SwfReader(bytes, 8);
|
|
143
|
+
r.rect();
|
|
144
|
+
r.u16();
|
|
145
|
+
r.u16();
|
|
146
|
+
const head = r.u16();
|
|
147
|
+
if (head >> 6 !== FileAttributes) {
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
if ((head & 0x3f) === 0x3f) {
|
|
151
|
+
r.u32();
|
|
152
|
+
}
|
|
153
|
+
return r.u8();
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Whether FileAttributes marks the SWF as ActionScript 3; without the bit it is an AVM1 movie. */
|
|
160
|
+
export function isAs3(swf) {
|
|
161
|
+
const tag = swf.tags.find((t) => t.code === FileAttributes);
|
|
162
|
+
return !!tag && tag.length >= 1 && (swf.bytes[tag.offset] & 0x08) !== 0;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=swf.js.map
|
package/dist/swf.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swf.js","sourceRoot":"","sources":["../src/swf.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,qEAAqE;AACrE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AA2CpE,MAAM,UAAU,GAAmC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAE7F,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,UAAU,CAAC,iCAAiC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,WAAW,GAA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,CAAC;YAC3B,CAAC,CAAC,GAAG,EAAE,CAAC;QACV,CAAC;QAED,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,KAAK,CAAC,GAAQ;IAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;IAC5D,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/tags.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const End = 0;
|
|
2
|
+
export declare const ShowFrame = 1;
|
|
3
|
+
export declare const DefineShape = 2;
|
|
4
|
+
export declare const PlaceObject = 4;
|
|
5
|
+
export declare const RemoveObject = 5;
|
|
6
|
+
export declare const DefineBits = 6;
|
|
7
|
+
export declare const DefineButton = 7;
|
|
8
|
+
export declare const JPEGTables = 8;
|
|
9
|
+
export declare const SetBackgroundColor = 9;
|
|
10
|
+
export declare const DefineFont = 10;
|
|
11
|
+
export declare const DefineText = 11;
|
|
12
|
+
export declare const DoAction = 12;
|
|
13
|
+
export declare const DefineFontInfo = 13;
|
|
14
|
+
export declare const DefineSound = 14;
|
|
15
|
+
export declare const StartSound = 15;
|
|
16
|
+
export declare const DefineButtonSound = 17;
|
|
17
|
+
export declare const SoundStreamHead = 18;
|
|
18
|
+
export declare const SoundStreamBlock = 19;
|
|
19
|
+
export declare const DefineBitsLossless = 20;
|
|
20
|
+
export declare const DefineBitsJPEG2 = 21;
|
|
21
|
+
export declare const DefineShape2 = 22;
|
|
22
|
+
export declare const DefineButtonCxform = 23;
|
|
23
|
+
export declare const PlaceObject2 = 26;
|
|
24
|
+
export declare const RemoveObject2 = 28;
|
|
25
|
+
export declare const DefineShape3 = 32;
|
|
26
|
+
export declare const DefineText2 = 33;
|
|
27
|
+
export declare const DefineButton2 = 34;
|
|
28
|
+
export declare const DefineBitsJPEG3 = 35;
|
|
29
|
+
export declare const DefineBitsLossless2 = 36;
|
|
30
|
+
export declare const DefineEditText = 37;
|
|
31
|
+
export declare const DefineSprite = 39;
|
|
32
|
+
export declare const FrameLabel = 43;
|
|
33
|
+
export declare const SoundStreamHead2 = 45;
|
|
34
|
+
export declare const DefineMorphShape = 46;
|
|
35
|
+
export declare const DefineFont2 = 48;
|
|
36
|
+
export declare const ExportAssets = 56;
|
|
37
|
+
export declare const ScriptLimits = 65;
|
|
38
|
+
export declare const DoInitAction = 59;
|
|
39
|
+
export declare const DefineFontInfo2 = 62;
|
|
40
|
+
export declare const FileAttributes = 69;
|
|
41
|
+
export declare const PlaceObject3 = 70;
|
|
42
|
+
export declare const DoABC = 72;
|
|
43
|
+
export declare const DefineFontAlignZones = 73;
|
|
44
|
+
export declare const CSMTextSettings = 74;
|
|
45
|
+
export declare const DefineFont3 = 75;
|
|
46
|
+
export declare const SymbolClass = 76;
|
|
47
|
+
export declare const DefineScalingGrid = 78;
|
|
48
|
+
export declare const DoABC2 = 82;
|
|
49
|
+
export declare const DefineShape4 = 83;
|
|
50
|
+
export declare const DefineMorphShape2 = 84;
|
|
51
|
+
export declare const DefineSceneAndFrameLabelData = 86;
|
|
52
|
+
export declare const DefineBinaryData = 87;
|
|
53
|
+
export declare const StartSound2 = 89;
|
|
54
|
+
export declare const DefineBitsJPEG4 = 90;
|
|
55
|
+
export declare const DefineFont4 = 91;
|
|
56
|
+
export declare const PlaceObject4 = 94;
|
|
57
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":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AAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAC/C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC"}
|
package/dist/tags.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// SWF tag codes, as the specification numbers them. The player reads these
|
|
2
|
+
// first; any other tag is kept by its code.
|
|
3
|
+
export const End = 0;
|
|
4
|
+
export const ShowFrame = 1;
|
|
5
|
+
export const DefineShape = 2;
|
|
6
|
+
export const PlaceObject = 4;
|
|
7
|
+
export const RemoveObject = 5;
|
|
8
|
+
export const DefineBits = 6;
|
|
9
|
+
export const DefineButton = 7;
|
|
10
|
+
export const JPEGTables = 8;
|
|
11
|
+
export const SetBackgroundColor = 9;
|
|
12
|
+
export const DefineFont = 10;
|
|
13
|
+
export const DefineText = 11;
|
|
14
|
+
export const DoAction = 12;
|
|
15
|
+
export const DefineFontInfo = 13;
|
|
16
|
+
export const DefineSound = 14;
|
|
17
|
+
export const StartSound = 15;
|
|
18
|
+
export const DefineButtonSound = 17;
|
|
19
|
+
export const SoundStreamHead = 18;
|
|
20
|
+
export const SoundStreamBlock = 19;
|
|
21
|
+
export const DefineBitsLossless = 20;
|
|
22
|
+
export const DefineBitsJPEG2 = 21;
|
|
23
|
+
export const DefineShape2 = 22;
|
|
24
|
+
export const DefineButtonCxform = 23;
|
|
25
|
+
export const PlaceObject2 = 26;
|
|
26
|
+
export const RemoveObject2 = 28;
|
|
27
|
+
export const DefineShape3 = 32;
|
|
28
|
+
export const DefineText2 = 33;
|
|
29
|
+
export const DefineButton2 = 34;
|
|
30
|
+
export const DefineBitsJPEG3 = 35;
|
|
31
|
+
export const DefineBitsLossless2 = 36;
|
|
32
|
+
export const DefineEditText = 37;
|
|
33
|
+
export const DefineSprite = 39;
|
|
34
|
+
export const FrameLabel = 43;
|
|
35
|
+
export const SoundStreamHead2 = 45;
|
|
36
|
+
export const DefineMorphShape = 46;
|
|
37
|
+
export const DefineFont2 = 48;
|
|
38
|
+
export const ExportAssets = 56;
|
|
39
|
+
export const ScriptLimits = 65;
|
|
40
|
+
export const DoInitAction = 59;
|
|
41
|
+
export const DefineFontInfo2 = 62;
|
|
42
|
+
export const FileAttributes = 69;
|
|
43
|
+
export const PlaceObject3 = 70;
|
|
44
|
+
export const DoABC = 72;
|
|
45
|
+
export const DefineFontAlignZones = 73;
|
|
46
|
+
export const CSMTextSettings = 74;
|
|
47
|
+
export const DefineFont3 = 75;
|
|
48
|
+
export const SymbolClass = 76;
|
|
49
|
+
export const DefineScalingGrid = 78;
|
|
50
|
+
export const DoABC2 = 82;
|
|
51
|
+
export const DefineShape4 = 83;
|
|
52
|
+
export const DefineMorphShape2 = 84;
|
|
53
|
+
export const DefineSceneAndFrameLabelData = 86;
|
|
54
|
+
export const DefineBinaryData = 87;
|
|
55
|
+
export const StartSound2 = 89;
|
|
56
|
+
export const DefineBitsJPEG4 = 90;
|
|
57
|
+
export const DefineFont4 = 91;
|
|
58
|
+
export const PlaceObject4 = 94;
|
|
59
|
+
//# sourceMappingURL=tags.js.map
|
package/dist/tags.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AACrB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAC3B,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAG,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AAE,CAAC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC;AACzB,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC"}
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type Matrix } from "./shape.js";
|
|
2
|
+
import { type Rect, type Tag } from "./swf.js";
|
|
3
|
+
export interface EditText {
|
|
4
|
+
id: number;
|
|
5
|
+
bounds: Rect;
|
|
6
|
+
variable: string;
|
|
7
|
+
text: string;
|
|
8
|
+
color: number | null;
|
|
9
|
+
fontId: number | null;
|
|
10
|
+
fontClass: string | null;
|
|
11
|
+
fontHeight: number | null;
|
|
12
|
+
align: number;
|
|
13
|
+
leftMargin: number;
|
|
14
|
+
rightMargin: number;
|
|
15
|
+
indent: number;
|
|
16
|
+
leading: number;
|
|
17
|
+
maxLength: number | null;
|
|
18
|
+
wordWrap: boolean;
|
|
19
|
+
multiline: boolean;
|
|
20
|
+
password: boolean;
|
|
21
|
+
readOnly: boolean;
|
|
22
|
+
autoSize: boolean;
|
|
23
|
+
selectable: boolean;
|
|
24
|
+
border: boolean;
|
|
25
|
+
html: boolean;
|
|
26
|
+
useOutlines: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** DefineEditText (tag 37), including every conditional field before its variable and text. */
|
|
29
|
+
export declare function readEditText(bytes: Uint8Array, tag: Tag): EditText;
|
|
30
|
+
/** A DefineFont2 or DefineFont3's name and style: what a field in it shows its text in, the glyphs left. */
|
|
31
|
+
export interface FontName {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
bold: boolean;
|
|
35
|
+
italic: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** DefineFont2 (48) or DefineFont3 (75): the id, flags, language, then the name, a length-prefixed string. */
|
|
38
|
+
export declare function readFontName(bytes: Uint8Array, tag: Tag): FontName;
|
|
39
|
+
/** A run of DefineText's glyphs: what its record sets, null where it keeps the run before's. */
|
|
40
|
+
export interface TextRecord {
|
|
41
|
+
font: number | null;
|
|
42
|
+
/** 0xAARRGGBB; DefineText's opaque. */
|
|
43
|
+
color: number | null;
|
|
44
|
+
/** The pen's place, in twips. */
|
|
45
|
+
x: number | null;
|
|
46
|
+
y: number | null;
|
|
47
|
+
/** The glyphs' height, in twips; set with the font. */
|
|
48
|
+
height: number | null;
|
|
49
|
+
/** Each glyph's index into the font's glyphs, and the pen's advance after it, in twips. */
|
|
50
|
+
glyphs: {
|
|
51
|
+
index: number;
|
|
52
|
+
advance: number;
|
|
53
|
+
}[];
|
|
54
|
+
}
|
|
55
|
+
/** DefineText or DefineText2: static text, glyphs of embedded fonts placed by the authoring tool. */
|
|
56
|
+
export interface StaticText {
|
|
57
|
+
id: number;
|
|
58
|
+
bounds: Rect;
|
|
59
|
+
matrix: Matrix;
|
|
60
|
+
records: TextRecord[];
|
|
61
|
+
}
|
|
62
|
+
/** DefineText (11) or DefineText2 (33, whose colours have alpha), up to its end record or the tag's end. */
|
|
63
|
+
export declare function readStaticText(bytes: Uint8Array, tag: Tag): StaticText;
|
|
64
|
+
/** CSMTextSettings (74): how a text character is anti-aliased, as TextField's settings of the same names. */
|
|
65
|
+
export interface CsmTextSettings {
|
|
66
|
+
id: number;
|
|
67
|
+
/** Advanced anti-aliasing (Saffron) rather than normal. */
|
|
68
|
+
useFlashType: boolean;
|
|
69
|
+
/** 0 none, 1 pixel, 2 subpixel. */
|
|
70
|
+
gridFit: number;
|
|
71
|
+
thickness: number;
|
|
72
|
+
sharpness: number;
|
|
73
|
+
}
|
|
74
|
+
export declare function readCsmTextSettings(bytes: Uint8Array, tag: Tag): CsmTextSettings;
|
|
75
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,IAAI,EAAa,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,IAAI,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,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