public ExportAssetsTag(SwfReader r) { uint count = r.GetUI16(); for (int i = 0; i < count; i++) { uint index = r.GetUI16(); string name = r.GetString(); Exports.Add(index, name); } }
public DefineFunction2(SwfReader r, ConstantPool cp) { this.cp = cp; FunctionName = r.GetString(); uint paramCount = r.GetUI16(); RegisterCount = (uint)r.GetByte(); Preloads = PreloadFlags.Empty; if (r.GetBit()) { Preloads |= PreloadFlags.Parent; } if (r.GetBit()) { Preloads |= PreloadFlags.Root; } SuppressSuperFlag = r.GetBit(); if (r.GetBit()) { Preloads |= PreloadFlags.Super; } SuppressArgumentsFlag = r.GetBit(); if (r.GetBit()) { Preloads |= PreloadFlags.Arguments; } SuppressThisFlag = r.GetBit(); if (r.GetBit()) { Preloads |= PreloadFlags.This; } r.GetBits(7); // reserved if (r.GetBit()) { Preloads |= PreloadFlags.Global; } for (int i = 0; i < paramCount; i++) { uint reg = r.GetByte(); string name = r.GetString(); Parameters.Add(reg, name); } CodeSize = r.GetUI16(); }
public ExportAssetsTag(SwfReader r) { uint count = r.GetUI16(); for (int i = 0; i < count; i++) { uint index = r.GetUI16(); string name = r.GetString(); Exports.Add(index, name); } }
public PlaceObjectTag(SwfReader r, uint tagEnd) { Character = r.GetUI16(); Depth = r.GetUI16(); Matrix = new Matrix(r); if (tagEnd != r.Position) { HasColorTransform = true; ColorTransform = new ColorTransform(r, false); } }
public PlaceObjectTag(SwfReader r, uint tagEnd) { Character = r.GetUI16(); Depth = r.GetUI16(); Matrix = new Matrix(r); if (tagEnd != r.Position) { HasColorTransform = true; ColorTransform = new ColorTransform(r, false); } }
public DefineFunction(SwfReader r, ConstantPool cp) { this.cp = cp; FunctionName = r.GetString(); uint paramCount = r.GetUI16(); Params = new string[paramCount]; for (int i = 0; i < paramCount; i++) { Params[i] = r.GetString(); } CodeSize = r.GetUI16(); }
public DefineButtonSound(SwfReader r) { ButtonId = r.GetUI16(); ButtonSoundChar0 = r.GetUI16(); ButtonSoundInfo0 = new SoundInfo(r); ButtonSoundChar1 = r.GetUI16(); ButtonSoundInfo1 = new SoundInfo(r); ButtonSoundChar2 = r.GetUI16(); ButtonSoundInfo2 = new SoundInfo(r); ButtonSoundChar3 = r.GetUI16(); ButtonSoundInfo3 = new SoundInfo(r); }
public DefineButtonSound(SwfReader r) { ButtonId = r.GetUI16(); ButtonSoundChar0 = r.GetUI16(); ButtonSoundInfo0 = new SoundInfo(r); ButtonSoundChar1 = r.GetUI16(); ButtonSoundInfo1 = new SoundInfo(r); ButtonSoundChar2 = r.GetUI16(); ButtonSoundInfo2 = new SoundInfo(r); ButtonSoundChar3 = r.GetUI16(); ButtonSoundInfo3 = new SoundInfo(r); }
public DefineFunction(SwfReader r, ConstantPool cp) { this.cp = cp; FunctionName = r.GetString(); uint paramCount = r.GetUI16(); Params = new string[paramCount]; for (int i = 0; i < paramCount; i++) { Params[i] = r.GetString(); } CodeSize = r.GetUI16(); }
public SymbolClassTag(SwfReader r, uint tagEnd) { int symbolCount = r.GetUI16(); Ids = new uint[symbolCount]; Names = new string[symbolCount]; for (int i = 0; i < symbolCount; i++) { Ids[i] = r.GetUI16(); Names[i] = r.GetString(); } if (tagEnd != r.Position) { } }
public DefineSoundTag(SwfReader r, uint tagLen) { SoundId = r.GetUI16(); SoundFormat = (SoundCompressionType)r.GetBits(4); uint sr = r.GetBits(2); switch (sr) { case 0: SoundRate = 5512; // ? break; case 1: SoundRate = 11025; break; case 2: SoundRate = 22050; break; case 3: SoundRate = 44100; break; } SoundSize = r.GetBit() ? 16U : 8U; IsStereo = r.GetBit(); r.Align(); SoundSampleCount = r.GetUI32(); // todo: this needs to decompress if mp3 etc SoundData = r.GetBytes(tagLen - 7); }
public DefineShape3Tag(SwfReader r) { this.ShapeId = r.GetUI16(); this.ShapeBounds = new Rect(r); this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape3); r.Align(); }
public DefineShape3Tag(SwfReader r) { this.ShapeId = r.GetUI16(); this.ShapeBounds = new Rect(r); this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape3); r.Align(); }
public LineStyle2(SwfReader r, ShapeType shapeType) { this.Width = r.GetUI16(); this.StartCapStyle = (CapStyle)r.GetBits(2); this.JoinStyle = (JoinStyle)r.GetBits(2); this.HasFillFlag = r.GetBit(); this.NoHScaleFlag = r.GetBit(); this.NoVScaleFlag = r.GetBit(); this.PixelHintingFlag = r.GetBit(); r.GetBits(5); // skip this.NoClose = r.GetBit(); this.EndCapStyle = (CapStyle)r.GetBits(2); if (this.JoinStyle == JoinStyle.MiterJoin) { this.MiterLimitFactor = (float)((r.GetByte() / 0x100) + r.GetByte()); } if (this.HasFillFlag) { this.FillStyle = FillStyleArray.ParseFillStyle2(r, shapeType); } else { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } }
public LineStyle2(SwfReader r, ShapeType shapeType) { this.Width = r.GetUI16(); this.StartCapStyle = (CapStyle)r.GetBits(2); this.JoinStyle = (JoinStyle)r.GetBits(2); this.HasFillFlag = r.GetBit(); this.NoHScaleFlag = r.GetBit(); this.NoVScaleFlag = r.GetBit(); this.PixelHintingFlag = r.GetBit(); r.GetBits(5); // skip this.NoClose = r.GetBit(); this.EndCapStyle = (CapStyle)r.GetBits(2); if (this.JoinStyle == JoinStyle.MiterJoin) { this.MiterLimitFactor = (float)((r.GetByte() / 0x100) + r.GetByte()); } if (this.HasFillFlag) { this.FillStyle = FillStyleArray.ParseFillStyle2(r, shapeType); } else { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } }
public DefineSoundTag(SwfReader r, uint tagLen) { SoundId = r.GetUI16(); SoundFormat = (SoundCompressionType)r.GetBits(4); uint sr = r.GetBits(2); switch (sr) { case 0: SoundRate = 5512; // ? break; case 1: SoundRate = 11025; break; case 2: SoundRate = 22050; break; case 3: SoundRate = 44100; break; } SoundSize = r.GetBit() ? 16U : 8U; IsStereo = r.GetBit(); r.Align(); SoundSampleCount = r.GetUI32(); // todo: this needs to decompress if mp3 etc SoundData = r.GetBytes(tagLen - 7); }
public SymbolClassTag(SwfReader r, uint tagEnd) { int symbolCount = r.GetUI16(); Ids = new uint[symbolCount]; Names = new string[symbolCount]; for (int i = 0; i < symbolCount; i++) { Ids[i] = r.GetUI16(); Names[i] = r.GetString(); } if (tagEnd != r.Position) { } }
public GlyphEntry[] GlyphEntries; // GLYPHENTRY[GlyphCount] public TextRecord(SwfReader r, uint glyphBits, uint advanceBits, bool hasAlpha) { TextRecordType = r.GetBit(); StyleFlagsReserved = r.GetBits(3); StyleFlagsHasFont = r.GetBit(); StyleFlagsHasColor = r.GetBit(); StyleFlagsHasYOffset = r.GetBit(); StyleFlagsHasXOffset = r.GetBit(); if (StyleFlagsHasFont) { FontID = r.GetUI16(); } if (StyleFlagsHasColor) { TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte()); if (hasAlpha) { TextColor.A = r.GetByte(); } } if (StyleFlagsHasXOffset) { XOffset = r.GetInt16(); } if (StyleFlagsHasYOffset) { YOffset = r.GetInt16(); } if (StyleFlagsHasFont) { TextHeight = r.GetUI16(); } GlyphCount = (uint)r.GetByte(); GlyphEntries = new GlyphEntry[GlyphCount]; for (int i = 0; i < GlyphCount; i++) { uint index = r.GetBits(glyphBits); int advance = r.GetSignedNBits(advanceBits); GlyphEntries[i] = new GlyphEntry(index, advance); } r.Align();// }
public PlaceObject2Tag(SwfReader r, byte swfVersion) { tagType = TagType.PlaceObject2; HasClipActions = r.GetBit(); HasClipDepth = r.GetBit(); HasName = r.GetBit(); HasRatio = r.GetBit(); HasColorTransform = r.GetBit(); HasMatrix = r.GetBit(); HasCharacter = r.GetBit(); Move = r.GetBit(); Depth = r.GetUI16(); if (HasCharacter) { Character = r.GetUI16(); } if (HasMatrix) { Matrix = new Matrix(r); } if (HasColorTransform) { ColorTransform = new ColorTransform(r, true); } if (HasRatio) { Ratio = r.GetUI16(); } if (HasName) { Name = r.GetString(); } if (HasClipDepth) { ClipDepth = r.GetUI16(); } if (HasClipActions) { ClipActions = new ClipActions(r, (swfVersion > 5)); } }
private bool TextRecordType; // UB[1] #endregion Fields #region Constructors public TextRecord(SwfReader r, uint glyphBits, uint advanceBits, bool hasAlpha) { TextRecordType = r.GetBit(); StyleFlagsReserved = r.GetBits(3); StyleFlagsHasFont = r.GetBit(); StyleFlagsHasColor = r.GetBit(); StyleFlagsHasYOffset = r.GetBit(); StyleFlagsHasXOffset = r.GetBit(); if(StyleFlagsHasFont) { FontID = r.GetUI16(); } if(StyleFlagsHasColor) { TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte()); if(hasAlpha) { TextColor.A = r.GetByte(); } } if(StyleFlagsHasXOffset) { XOffset = r.GetInt16(); } if(StyleFlagsHasYOffset) { YOffset = r.GetInt16(); } if(StyleFlagsHasFont) { TextHeight = r.GetUI16(); } GlyphCount = (uint)r.GetByte(); GlyphEntries = new GlyphEntry[GlyphCount]; for (int i = 0; i < GlyphCount; i++) { uint index = r.GetBits(glyphBits); int advance = r.GetSignedNBits(advanceBits); GlyphEntries[i] = new GlyphEntry(index, advance); } r.Align();// }
public ConstantPool(SwfReader r) { uint len = r.GetUI16(); Constants = new string[len]; for (int i = 0; i < len; i++) { Constants[i] = r.GetString(); } }
public ConstantPool(SwfReader r) { uint len = r.GetUI16(); Constants = new string[len]; for (int i = 0; i < len; i++) { Constants[i] = r.GetString(); } }
public SoundStreamBlockTag(SwfReader r, uint tagLen) { SampleCount = r.GetUI16(); SoundData = r.GetBytes(tagLen - 2); // assume mp3 for now //SoundData = new Mp3SoundData[SampleCount]; //for (int i = 0; i < SampleCount; i++) //{ // SoundData[i] = new Mp3SoundData(r); //} }
public LineStyle(SwfReader r, bool useAlpha) { this.Width = r.GetUI16(); if (useAlpha) { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } else { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte()); } }
public DefineShape4Tag(SwfReader r) { this.ShapeId = r.GetUI16(); this.ShapeBounds = new Rect(r); this.EdgeBounds = new Rect(r); r.SkipBits(6); this.UsesNonScalingStrokes = r.GetBit(); this.UsesScalingStrokes = r.GetBit(); this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape4); r.Align(); }
public LineStyle(SwfReader r, bool useAlpha) { this.Width = r.GetUI16(); if (useAlpha) { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } else { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte()); } }
public DefineShape4Tag(SwfReader r) { this.ShapeId = r.GetUI16(); this.ShapeBounds = new Rect(r); this.EdgeBounds = new Rect(r); r.SkipBits(6); this.UsesNonScalingStrokes = r.GetBit(); this.UsesScalingStrokes = r.GetBit(); this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape4); r.Align(); }
public DefineFunction2(SwfReader r, ConstantPool cp) { this.cp = cp; FunctionName = r.GetString(); uint paramCount = r.GetUI16(); RegisterCount = (uint)r.GetByte(); Preloads = PreloadFlags.Empty; if (r.GetBit()) { Preloads |= PreloadFlags.Parent; } if (r.GetBit()) { Preloads |= PreloadFlags.Root; } SuppressSuperFlag = r.GetBit(); if (r.GetBit()) { Preloads |= PreloadFlags.Super; } SuppressArgumentsFlag = r.GetBit(); if (r.GetBit()) { Preloads |= PreloadFlags.Arguments; } SuppressThisFlag = r.GetBit(); if (r.GetBit()) { Preloads |= PreloadFlags.This; } r.GetBits(7); // reserved if (r.GetBit()) { Preloads |= PreloadFlags.Global; } for (int i = 0; i < paramCount; i++) { uint reg = r.GetByte(); string name = r.GetString(); Parameters.Add(reg, name); } CodeSize = r.GetUI16(); }
public SoundStreamBlockTag(SwfReader r, uint tagLen) { SampleCount = r.GetUI16(); SoundData = r.GetBytes(tagLen - 2); // assume mp3 for now //SoundData = new Mp3SoundData[SampleCount]; //for (int i = 0; i < SampleCount; i++) //{ // SoundData[i] = new Mp3SoundData(r); //} }
public SoundInfo(SwfReader r) { r.GetBits(2); // reserved IsSyncStop = r.GetBit(); IsSyncNoMultiple = r.GetBit(); HasEnvelope = r.GetBit(); HasLoops = r.GetBit(); HasOutPoint = r.GetBit(); r.Align(); if (HasInPoint) { InPoint = r.GetUI32(); } if (HasOutPoint) { OutPoint = r.GetUI32(); } if (HasLoops) { LoopCount = r.GetUI16(); } if (HasEnvelope) { uint count = (uint)r.GetByte(); uint pos; uint left; uint right; EnvelopeRecords = new SoundEnvelope[count]; for (int i = 0; i < count; i++) { pos = r.GetUI32(); left = r.GetUI16(); right = r.GetUI16(); EnvelopeRecords[i] = new SoundEnvelope(pos, left, right); } } }
public SoundInfo(SwfReader r) { r.GetBits(2); // reserved IsSyncStop = r.GetBit(); IsSyncNoMultiple = r.GetBit(); HasEnvelope = r.GetBit(); HasLoops = r.GetBit(); HasOutPoint = r.GetBit(); r.Align(); if(HasInPoint) { InPoint = r.GetUI32(); } if(HasOutPoint) { OutPoint = r.GetUI32(); } if(HasLoops) { LoopCount = r.GetUI16(); } if(HasEnvelope) { uint count = (uint)r.GetByte(); uint pos; uint left; uint right; EnvelopeRecords = new SoundEnvelope[count]; for (int i = 0; i < count; i++) { pos = r.GetUI32(); left = r.GetUI16(); right = r.GetUI16(); EnvelopeRecords[i] = new SoundEnvelope(pos, left, right); } } }
public CSMTextSettingsTag(SwfReader r) { TextId = r.GetUI16(); UseFlashType = r.GetBits(2); GridFit = r.GetBits(3); r.GetBits(3); // reserved r.Align(); Thickness = r.GetFixedNBits(32); Sharpness = r.GetFixedNBits(32); r.GetByte(); // reserved }
public LineStyleArray(SwfReader r, ShapeType shapeType) { int lineCount = (int)r.GetByte(); if (lineCount == 0xFF) { lineCount = (int)r.GetUI16(); } for (int i = 0; i < lineCount; i++) { ParseLineStyle(r, shapeType); } }
public CSMTextSettingsTag(SwfReader r) { TextId = r.GetUI16(); UseFlashType = r.GetBits(2); GridFit = r.GetBits(3); r.GetBits(3); // reserved r.Align(); Thickness = r.GetFixedNBits(32); Sharpness = r.GetFixedNBits(32); r.GetByte(); // reserved }
public FillStyleArray(SwfReader r, ShapeType shapeType) { int fillCount = (int)r.GetByte(); if (fillCount == 0xFF) { fillCount = (int)r.GetUI16(); } for (int i = 0; i < fillCount; i++) { FillStyles.Add(ParseFillStyle2(r, shapeType)); } }
public FillStyleArray(SwfReader r, ShapeType shapeType) { int fillCount = (int)r.GetByte(); if (fillCount == 0xFF) { fillCount = (int)r.GetUI16(); } for (int i = 0; i < fillCount; i++) { FillStyles.Add(ParseFillStyle2(r, shapeType)); } }
public DefineButton2(SwfReader r) { ButtonId = r.GetUI16(); r.GetBits(7); TrackAsMenu = r.GetBit(); ActionOffset = r.GetUI16(); while (r.PeekByte() != 0) { Characters.Add(new ButtonRecord(r, TagType.DefineButton2)); } r.GetByte();// 0, end ButtonRecords if (ActionOffset > 0) { ButtonCondAction bca; do { bca = new ButtonCondAction(r); ButtonCondActions.Add(bca); }while (bca.CondActionSize > 0); } }
public LineStyleArray(SwfReader r, ShapeType shapeType) { int lineCount = (int)r.GetByte(); if (lineCount == 0xFF) { lineCount = (int)r.GetUI16(); } for (int i = 0; i < lineCount; i++) { ParseLineStyle(r, shapeType); } }
public SwfHeader(SwfReader r) { this.Signature0 = r.GetByte(); if (this.Signature0 == 'C') { this.IsCompressed = true; r.DecompressSwf(); } else { this.IsCompressed = false; } this.Signature1 = r.GetByte(); this.Signature2 = r.GetByte(); this.IsSwf = (Signature2 == 'S') && (Signature1 == 'W') && ((Signature0 == 'C') || (Signature0 == 'F')); if (IsSwf) { this.Version = r.GetByte(); this.FileLength = r.GetUI32(); this.FrameSize = new Rect(r); UInt16 frate = r.GetUI16(); this.FrameRate = (frate >> 8) + ((frate & 0xFF) / 0xFF); this.FrameCount = r.GetUI16(); } else { this.Version = 0; this.FileLength = 0; this.FrameSize = new Rect(0, 0, 0, 0); this.FrameRate = 0; this.FrameCount = 0; } }
public SwfHeader(SwfReader r) { this.Signature0 = r.GetByte(); if (this.Signature0 == 'C') { this.IsCompressed = true; r.DecompressSwf(); } else { this.IsCompressed = false; } this.Signature1 = r.GetByte(); this.Signature2 = r.GetByte(); this.IsSwf = (Signature2 == 'S') && (Signature1 == 'W') && ((Signature0 == 'C') || (Signature0 == 'F')); if (IsSwf) { this.Version = r.GetByte(); this.FileLength = r.GetUI32(); this.FrameSize = new Rect(r); UInt16 frate = r.GetUI16(); this.FrameRate = (frate >> 8) + ((frate & 0xFF) / 0xFF); this.FrameCount = r.GetUI16(); } else { this.Version = 0; this.FileLength = 0; this.FrameSize = new Rect(0,0,0,0); this.FrameRate = 0; this.FrameCount = 0; } }
public DefineButton2(SwfReader r) { ButtonId = r.GetUI16(); r.GetBits(7); TrackAsMenu = r.GetBit(); ActionOffset = r.GetUI16(); while (r.PeekByte() != 0) { Characters.Add(new ButtonRecord(r, TagType.DefineButton2)); } r.GetByte();// 0, end ButtonRecords if (ActionOffset > 0) { ButtonCondAction bca; do { bca = new ButtonCondAction(r); ButtonCondActions.Add(bca); } while (bca.CondActionSize > 0); } }
public SoundStreamHeadTag(SwfReader r) { SoundId = soundIdCounter++; r.GetBits(4); // reserved PlaybackSoundRate = rates[r.GetBits(2)]; PlaybackSoundSize = r.GetBit() ? 16u : 0u; IsStereo = r.GetBit(); StreamSoundCompression = (SoundCompressionType)r.GetBits(4); // Mp3 == 2 StreamSoundRate = rates[r.GetBits(2)]; StreamSoundSize = r.GetBit() ? 16u : 8u; StreamIsStereo = r.GetBit(); r.Align(); StreamSoundSampleCount = r.GetUI16(); if (StreamSoundCompression == SoundCompressionType.MP3) { LatencySeek = r.GetUI16(); } }
public GotoFrame2(SwfReader r) { r.GetBits(6); // reserved SceneBiasFlag = r.GetBit(); PlayFlag = r.GetBit(); r.Align(); if (SceneBiasFlag) { SceneBias = r.GetUI16(); } else { SceneBias = 0; } }
public GotoFrame2(SwfReader r) { r.GetBits(6); // reserved SceneBiasFlag = r.GetBit(); PlayFlag = r.GetBit(); r.Align(); if (SceneBiasFlag) { SceneBias = r.GetUI16(); } else { SceneBias = 0; } }
public DefineEditTextTag(SwfReader r) { CharacterID = r.GetUI16(); Bounds = new Rect(r); HasText = r.GetBit(); WordWrap = r.GetBit(); Multiline = r.GetBit(); Password = r.GetBit(); ReadOnly = r.GetBit(); HasTextColor = r.GetBit(); HasMaxLength = r.GetBit(); HasFont = r.GetBit(); r.GetBit(); // resreved AutoSize = r.GetBit(); HasLayout = r.GetBit(); NoSelect = r.GetBit(); Border = r.GetBit(); r.GetBit(); // resreved HTML = r.GetBit(); UseOutlines = r.GetBit(); if (HasFont) { FontID = r.GetUI16(); FontHeight = r.GetUI16(); } if (HasTextColor) { TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } if (HasMaxLength) { MaxLength = r.GetUI16(); } if (HasLayout) { Align = (uint)r.GetByte(); LeftMargin = r.GetUI16(); RightMargin = r.GetUI16(); Indent = r.GetUI16(); Leading = r.GetInt16(); } VariableName = r.GetString(); if (HasText) { InitialText = r.GetString(); } }
public ClipActions(SwfReader r, bool isSwf6Plus) { r.GetUI16(); // reserved ClipEvents = (ClipEvents)r.GetBits(32); ClipActionRecords = new List<ClipActionRecord>(); bool hasMoreRecords = true; while (hasMoreRecords) { ClipActionRecord car = new ClipActionRecord(r, isSwf6Plus); ClipActionRecords.Add(car); if ((uint)car.ClipEvents == 0) { hasMoreRecords = false; } } }
public ClipActions(SwfReader r, bool isSwf6Plus) { r.GetUI16(); // reserved ClipEvents = (ClipEvents)r.GetBits(32); ClipActionRecords = new List <ClipActionRecord>(); bool hasMoreRecords = true; while (hasMoreRecords) { ClipActionRecord car = new ClipActionRecord(r, isSwf6Plus); ClipActionRecords.Add(car); if ((uint)car.ClipEvents == 0) { hasMoreRecords = false; } } }
public DefineFontAlignZonesTag(SwfReader r, Dictionary<uint, DefineFont2_3> fonts) { Fonts = fonts; FontId = r.GetUI16(); CSMTableHint = r.GetBits(2); r.SkipBits(6); r.Align(); DefineFont2_3 font = Fonts[FontId]; uint glyphCount = font.NumGlyphs; ZoneTable = new ZoneRecord[glyphCount]; for (int i = 0; i < glyphCount; i++) { ZoneTable[i] = new ZoneRecord(r); } }
public DefineTextTag(SwfReader r, bool useAlpha) { if (useAlpha) { tagType = TagType.DefineText2; } CharacterId = r.GetUI16(); TextBounds = new Rect(r); TextMatrix = new Matrix(r); glyphBits = (uint)r.GetByte(); advanceBits = (uint)r.GetByte(); while (r.PeekByte() != 0x00) { TextRecords.Add(new TextRecord(r, glyphBits, advanceBits, useAlpha)); } byte end = r.GetByte(); }
public DefineTextTag(SwfReader r, bool useAlpha) { if (useAlpha) { tagType = TagType.DefineText2; } CharacterId = r.GetUI16(); TextBounds = new Rect(r); TextMatrix = new Matrix(r); glyphBits = (uint)r.GetByte(); advanceBits = (uint)r.GetByte(); while (r.PeekByte() != 0x00) { TextRecords.Add(new TextRecord(r, glyphBits, advanceBits, useAlpha)); } byte end = r.GetByte(); }
public ButtonCondAction(SwfReader r) { CondActionSize = r.GetUI16(); CondIdleToOverDown = r.GetBit(); CondOutDownToIdle = r.GetBit(); CondOutDownToOverDown = r.GetBit(); CondOverDownToOutDown = r.GetBit(); CondOverDownToOverUp = r.GetBit(); CondOverUpToOverDown = r.GetBit(); CondOverUpToIdle = r.GetBit(); CondIdleToOverUp = r.GetBit(); CondKeyPress = r.GetBits(7); CondOverDownToIdle = r.GetBit(); uint start = r.Position; ActionRecords = new ActionRecords(r, int.MaxValue); ActionRecords.CodeSize = r.Position - start; }
public DefineFontAlignZonesTag(SwfReader r, Dictionary <uint, DefineFont2_3> fonts) { Fonts = fonts; FontId = r.GetUI16(); CSMTableHint = r.GetBits(2); r.SkipBits(6); r.Align(); DefineFont2_3 font = Fonts[FontId]; uint glyphCount = font.NumGlyphs; ZoneTable = new ZoneRecord[glyphCount]; for (int i = 0; i < glyphCount; i++) { ZoneTable[i] = new ZoneRecord(r); } }
public PlaceObject2Tag(SwfReader r, byte swfVersion) { tagType = TagType.PlaceObject2; HasClipActions = r.GetBit(); HasClipDepth = r.GetBit(); HasName = r.GetBit(); HasRatio = r.GetBit(); HasColorTransform = r.GetBit(); HasMatrix = r.GetBit(); HasCharacter = r.GetBit(); Move = r.GetBit(); Depth = r.GetUI16(); if (HasCharacter) { Character = r.GetUI16(); } if (HasMatrix) { Matrix = new Matrix(r); } if (HasColorTransform) { ColorTransform = new ColorTransform(r, true); } if (HasRatio) { Ratio = r.GetUI16(); } if (HasName) { Name = r.GetString(); } if (HasClipDepth) { ClipDepth = r.GetUI16(); } if (HasClipActions) { ClipActions = new ClipActions(r, (swfVersion > 5)); } }
public ButtonCondAction(SwfReader r) { CondActionSize = r.GetUI16(); CondIdleToOverDown = r.GetBit(); CondOutDownToIdle = r.GetBit(); CondOutDownToOverDown = r.GetBit(); CondOverDownToOutDown = r.GetBit(); CondOverDownToOverUp = r.GetBit(); CondOverUpToOverDown = r.GetBit(); CondOverUpToIdle = r.GetBit(); CondIdleToOverUp = r.GetBit(); CondKeyPress = r.GetBits(7); CondOverDownToIdle = r.GetBit(); uint start = r.Position; ActionRecords = new ActionRecords(r, int.MaxValue); ActionRecords.CodeSize = r.Position - start; }
// this needs to combine with the jpegTables in the swfCompilationUnit to make an image public DefineBitsTag(SwfReader r, uint curTagLen, bool hasOwnTable, bool hasAlphaData) { this.HasOwnTable = hasOwnTable; this.HasAlphaData = hasAlphaData; if (hasOwnTable && !hasAlphaData) { tagType = TagType.DefineBitsJPEG2; } else if (hasOwnTable && hasAlphaData) { tagType = TagType.DefineBitsJPEG3; } CharacterId = r.GetUI16(); if (!hasAlphaData) { if (!hasOwnTable) { r.GetBytes(2); // SOI JpegData = r.GetBytes(curTagLen - 6); r.GetBytes(2); // EOI } else { JpegData = r.GetBytes(curTagLen - 2); CleanData(); } } else { uint jpgDataSize = r.GetUI32(); JpegData = r.GetBytes(jpgDataSize); // ignore alpha for now CompressedAlphaData = r.GetBytes(curTagLen - 6 - jpgDataSize); CleanData(); } }
// this needs to combine with the jpegTables in the swfCompilationUnit to make an image public DefineBitsTag(SwfReader r, uint curTagLen, bool hasOwnTable, bool hasAlphaData) { this.HasOwnTable = hasOwnTable; this.HasAlphaData = hasAlphaData; if (hasOwnTable && !hasAlphaData) { tagType = TagType.DefineBitsJPEG2; } else if(hasOwnTable && hasAlphaData) { tagType = TagType.DefineBitsJPEG3; } CharacterId = r.GetUI16(); if (!hasAlphaData) { if(!hasOwnTable) { r.GetBytes(2); // SOI JpegData = r.GetBytes(curTagLen - 6); r.GetBytes(2); // EOI } else { JpegData = r.GetBytes(curTagLen - 2); CleanData(); } } else { uint jpgDataSize = r.GetUI32(); JpegData = r.GetBytes(jpgDataSize); // ignore alpha for now CompressedAlphaData = r.GetBytes(curTagLen - 6 - jpgDataSize); CleanData(); } }
public static IFillStyle ParseFillStyle2(SwfReader r, ShapeType shapeType) { IFillStyle result = null; FillType fsType = (FillType)r.GetByte(); bool useAlpha = shapeType > ShapeType.DefineShape2; switch (fsType) { case FillType.Solid: result = new SolidFill(r, useAlpha); break; case FillType.Linear: result = new Gradient(r, fsType, useAlpha); break; case FillType.Radial: result = new Gradient(r, fsType, useAlpha); break; case FillType.Focal: result = null; //throw new NotSupportedException("Currently FillType.Focal is not supported"); break; case FillType.RepeatingBitmap: case FillType.ClippedBitmap: case FillType.NSRepeatingBitmap: case FillType.NSClippedBitmap: uint charId = r.GetUI16(); Matrix bmpMatrix = new Matrix(r); result = new BitmapFill(charId, bmpMatrix, fsType); break; } return(result); }
public static IFillStyle ParseFillStyle2(SwfReader r, ShapeType shapeType) { IFillStyle result = null; FillType fsType = (FillType)r.GetByte(); bool useAlpha = shapeType > ShapeType.DefineShape2; switch (fsType) { case FillType.Solid: result = new SolidFill(r, useAlpha); break; case FillType.Linear: result = new Gradient(r, fsType, useAlpha); break; case FillType.Radial: result = new Gradient(r, fsType, useAlpha); break; case FillType.Focal: result = null; //throw new NotSupportedException("Currently FillType.Focal is not supported"); break; case FillType.RepeatingBitmap: case FillType.ClippedBitmap: case FillType.NSRepeatingBitmap: case FillType.NSClippedBitmap: uint charId = r.GetUI16(); Matrix bmpMatrix = new Matrix(r); result = new BitmapFill(charId, bmpMatrix, fsType); break; } return result; }
public RemoveObjectTag(SwfReader r) { this.Character = r.GetUI16(); this.Depth = r.GetUI16(); }
public DefineBitsLosslessTag(SwfReader r, uint curTagLen, bool hasAlpha) { HasAlpha = hasAlpha; if (hasAlpha) { tagType = TagType.DefineBitsLossless2; } CharacterId = r.GetUI16(); BitmapFormat = (BitmapFormat)r.GetByte(); this.Width = r.GetUI16(); this.Height = r.GetUI16(); if (BitmapFormat == BitmapFormat.Colormapped8Bit) // 8-bit colormapped image { this.ColorCount = (uint)r.GetByte() + 1; this.isIndexedColors = true; uint colorBytes = hasAlpha ? (uint)4 : (uint)3; uint padWidth = this.Width + (4 - (this.Width % 4)); // temp for debugging uint pos = r.Position; OrgBitmapData = r.GetBytes(curTagLen - 8); r.Position = pos; // end temp uint unzippedSize = (this.ColorCount * colorBytes) + (padWidth * this.Height); byte[] mapData = r.Decompress(curTagLen - 8, unzippedSize); uint index = 0; this.ColorTable = new RGBA[this.ColorCount]; for (int i = 0; i < this.ColorCount; i++) { if (hasAlpha) { this.ColorTable[i] = new RGBA(mapData[index], mapData[index + 1], mapData[index + 2], mapData[index + 3]); } else { this.ColorTable[i] = new RGBA(mapData[index], mapData[index + 1], mapData[index + 2]); } index += colorBytes; } this.ColorData = new uint[this.Width * this.Height]; index = 0; int offset = (int)(this.ColorCount * colorBytes); for (int i = 0; i < padWidth * this.Height; i++) { if ((i % padWidth) < this.Width)// exclude padding { this.ColorData[index++] = mapData[i + offset]; } } } else if (BitmapFormat == BitmapFormat.RGB15Bit) // RGBx555 { // todo: find a test file for rgb555 uint colorBytes = 2; uint padWidth = this.Width * colorBytes; padWidth += (4 - padWidth) % 4; // temp for debugging uint pos = r.Position; OrgBitmapData = r.GetBytes(curTagLen - 7); r.Position = pos; // end temp uint unzippedSize = (padWidth * this.Height) * colorBytes; byte[] mapData = r.Decompress(curTagLen - 7, unzippedSize); int index = 0; this.BitmapData = new RGBA[this.Width * this.Height]; for (uint i = 0; i < unzippedSize; i += colorBytes) { if ((i % padWidth) < (this.Width * colorBytes)) // exclude padding { byte b0 = mapData[i]; byte b1 = mapData[i + 1]; byte rd = (byte)((b0 & 0x7C) << 1); byte gr = (byte)(((b0 & 0x03) << 6) | ((b1 & 0xE0) >> 2)); byte bl = (byte)((b1 & 0x1F) << 3); this.BitmapData[index++] = new RGBA(rd, gr, bl); } } } else if (BitmapFormat == BitmapFormat.RGB24Bit) // RGB 24 { // temp for debugging uint pos = r.Position; OrgBitmapData = r.GetBytes(curTagLen - 7); r.Position = pos; // end temp uint colorBytes = 4; // 4 bytes will always be byte aligned uint unzippedSize = (this.Width * this.Height) * colorBytes; byte[] mapData = r.Decompress(curTagLen - 7, unzippedSize); int index = 0; this.BitmapData = new RGBA[this.Width * this.Height]; for (uint i = 0; i < unzippedSize; i += colorBytes) { if (hasAlpha) { this.BitmapData[index++] = new RGBA(mapData[i + 1], mapData[i + 2], mapData[i + 3], mapData[i]); } else { this.BitmapData[index++] = new RGBA(mapData[i + 1], mapData[i + 2], mapData[i + 3]); } } } }