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()); } }
private void ParseShapeRecords(SwfReader r) { bool hasMoreRecords = true; while (hasMoreRecords) { bool typeFlag = r.GetBit(); if (typeFlag == false) // non edge record { uint followFlags = r.GetBits(5); if (followFlags == 0) { ShapeRecords.Add(new EndShapeRecord()); hasMoreRecords = false; } else { ShapeRecords.Add(new StyleChangedRecord(r, followFlags, ref fillBits, ref lineBits, shapeType)); } } else // edge record { bool isStraight = r.GetBit(); if (isStraight) { ShapeRecords.Add(new StraightEdgeRecord(r)); } else { ShapeRecords.Add(new CurvedEdgeRecord(r)); } } } }
public FilterGradientGlow(SwfReader r) { NumColors = (uint)r.GetByte(); GradientColors = new RGBA[NumColors]; for (int i = 0; i < NumColors; i++) { GradientColors[i] = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } GradientRatio = new uint[NumColors]; for (int i = 0; i < NumColors; i++) { GradientRatio[i] = (uint)r.GetByte(); } BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Angle = r.GetFixed16_16(); Distance = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerShadow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); OnTop = r.GetBit(); Passes = r.GetBits(4); r.Align(); }
public StraightEdgeRecord(SwfReader r) { this.DeltaX = 0; this.DeltaY = 0; uint nbits = r.GetBits(4) + 2; bool isGeneralLine = r.GetBit(); // not vertical or horizontal if (isGeneralLine) { DeltaX = r.GetSignedNBits(nbits); DeltaY = r.GetSignedNBits(nbits); } else { bool isHorz = r.GetBit(); if (isHorz) { DeltaY = r.GetSignedNBits(nbits); } else { DeltaX = r.GetSignedNBits(nbits); } } }
public StraightEdgeRecord(SwfReader r) { this.DeltaX = 0; this.DeltaY = 0; uint nbits = r.GetBits(4) + 2; bool isGeneralLine = r.GetBit(); // not vertical or horizontal if (isGeneralLine) { DeltaX = r.GetSignedNBits(nbits); DeltaY = r.GetSignedNBits(nbits); } else { bool isHorz = r.GetBit(); if (isHorz) { DeltaY = r.GetSignedNBits(nbits); } else { DeltaX = r.GetSignedNBits(nbits); } } }
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 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 FilterGradientGlow(SwfReader r) { NumColors = (uint)r.GetByte(); GradientColors = new RGBA[NumColors]; for (int i = 0; i < NumColors; i++) { GradientColors[i] = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } GradientRatio = new uint[NumColors]; for (int i = 0; i < NumColors; i++) { GradientRatio[i] = (uint)r.GetByte(); } BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Angle = r.GetFixed16_16(); Distance = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerShadow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); OnTop = r.GetBit(); Passes = r.GetBits(4); 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 GetURL2(SwfReader r) { SendVarsMethod = (SendVarsMethod)r.GetBits(2); r.GetBits(4); // reserved TargetIsSprite = r.GetBit(); LoadVariables = r.GetBit(); r.Align(); }
public bool TargetIsSprite; // or sprite #endregion Fields #region Constructors public GetURL2(SwfReader r) { SendVarsMethod = (SendVarsMethod)r.GetBits(2); r.GetBits(4); // reserved TargetIsSprite = r.GetBit(); LoadVariables = r.GetBit(); r.Align(); }
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 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 ZoneRecord(SwfReader r) { NumZoneData = r.GetByte(); AlignmentCoordinate1 = r.GetFixedNBits(16); Range1 = r.GetFixedNBits(16); AlignmentCoordinate2 = r.GetFixedNBits(16); Range2 = r.GetFixedNBits(16); r.GetBits(6); // reserved ZoneMaskX = r.GetBit(); ZoneMaskY = r.GetBit(); r.Align(); }
public ZoneRecord(SwfReader r) { NumZoneData = r.GetByte(); AlignmentCoordinate1 = r.GetFixedNBits(16); Range1 = r.GetFixedNBits(16); AlignmentCoordinate2 = r.GetFixedNBits(16); Range2 = r.GetFixedNBits(16); r.GetBits(6); // reserved ZoneMaskX = r.GetBit(); ZoneMaskY = r.GetBit(); 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 FilterGlow(SwfReader r) { GlowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerGlow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); Passes = r.GetBits(5); r.Align(); }
public FilterGlow(SwfReader r) { GlowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerGlow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); Passes = r.GetBits(5); r.Align(); }
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 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 FilterDropShadow(SwfReader r) { DropShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Angle = r.GetFixed16_16(); Distance = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerShadow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); Passes = (uint)r.GetBits(5); r.Align(); }
public FilterDropShadow(SwfReader r) { DropShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Angle = r.GetFixed16_16(); Distance = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerShadow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); Passes = (uint)r.GetBits(5); r.Align(); }
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 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 FilterBevel(SwfReader r) { ShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); HighlightColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Angle = r.GetFixed16_16(); Distance = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerShadow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); OnTop = r.GetBit(); Passes = r.GetBits(4); r.Align(); }
public FilterBevel(SwfReader r) { ShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); HighlightColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); BlurX = r.GetFixed16_16(); BlurY = r.GetFixed16_16(); Angle = r.GetFixed16_16(); Distance = r.GetFixed16_16(); Strength = r.GetFixed8_8(); InnerShadow = r.GetBit(); Knockout = r.GetBit(); CompositeSource = r.GetBit(); OnTop = r.GetBit(); Passes = r.GetBits(4); r.Align(); }
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 Matrix(SwfReader r) { float sx = 1.0F; float sy = 1.0F; float r0 = 0.0F; float r1 = 0.0F; float tx = 0.0F; float ty = 0.0F; r.Align(); bool hasScale = r.GetBit(); if (hasScale) { uint scaleBits = r.GetBits(5); sx = r.GetFixedNBits(scaleBits); sy = r.GetFixedNBits(scaleBits); } bool hasRotate = r.GetBit(); if (hasRotate) { uint nRotateBits = r.GetBits(5); r0 = r.GetFixedNBits(nRotateBits); r1 = r.GetFixedNBits(nRotateBits); } // always has translation uint nTranslateBits = r.GetBits(5); tx = r.GetSignedNBits(nTranslateBits); ty = r.GetSignedNBits(nTranslateBits); r.Align(); this.ScaleX = sx; this.Rotate0 = r0; this.Rotate1 = r1; this.ScaleY = sy; this.TranslateX = tx; this.TranslateY = ty; }
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 FilterConvolution(SwfReader r) { MatrixX = (uint)r.GetByte(); MatrixY = (uint)r.GetByte(); Divisor = r.GetFloat32(); Bias = r.GetFloat32(); uint mxCount = MatrixX * MatrixY; Matrix = new float[mxCount]; for (int i = 0; i < mxCount; i++) { Matrix[i] = r.GetFloat32(); } DefaultColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); r.GetBits(6); Clamp = r.GetBit(); PreserveAlpha = r.GetBit(); r.Align(); }
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 FilterConvolution(SwfReader r) { MatrixX = (uint)r.GetByte(); MatrixY = (uint)r.GetByte(); Divisor = r.GetFloat32(); Bias = r.GetFloat32(); uint mxCount = MatrixX * MatrixY; Matrix = new float[mxCount]; for (int i = 0; i < mxCount; i++) { Matrix[i] = r.GetFloat32(); } DefaultColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); r.GetBits(6); Clamp = r.GetBit(); PreserveAlpha = r.GetBit(); r.Align(); }
public void ParseShapeRecords(SwfReader r) { bool hasMoreRecords = true; while (hasMoreRecords) { bool typeFlag = r.GetBit(); if (typeFlag == false) // non edge record { uint followFlags = r.GetBits(5); if (followFlags == 0) { ShapeRecords.Add(new EndShapeRecord()); hasMoreRecords = false; } else { StyleChangedRecord scr = new StyleChangedRecord(r, followFlags, ref fillBits, ref lineBits, ShapeType.Glyph); ShapeRecords.Add(scr); } } else // edge record { bool isStraight = r.GetBit(); if (isStraight) { StraightEdgeRecord ser = new StraightEdgeRecord(r); ShapeRecords.Add(ser); } else { CurvedEdgeRecord cer = new CurvedEdgeRecord(r); ShapeRecords.Add(cer); } } } }
public Matrix(SwfReader r) { float sx = 1.0F; float sy = 1.0F; float r0 = 0.0F; float r1 = 0.0F; float tx = 0.0F; float ty = 0.0F; r.Align(); bool hasScale = r.GetBit(); if (hasScale) { uint scaleBits = r.GetBits(5); sx = r.GetFixedNBits(scaleBits); sy = r.GetFixedNBits(scaleBits); } bool hasRotate = r.GetBit(); if (hasRotate) { uint nRotateBits = r.GetBits(5); r0 = r.GetFixedNBits(nRotateBits); r1 = r.GetFixedNBits(nRotateBits); } // always has translation uint nTranslateBits = r.GetBits(5); tx = r.GetSignedNBits(nTranslateBits); ty = r.GetSignedNBits(nTranslateBits); r.Align(); this.ScaleX = sx; this.Rotate0 = r0; this.Rotate1 = r1; this.ScaleY = sy; this.TranslateX = tx; this.TranslateY = ty; }
public ColorTransform(SwfReader r, bool useAlpha) { this.HasAddTerms = r.GetBit(); this.HasMultTerms = r.GetBit(); uint nbits = r.GetBits(4); if (HasMultTerms) { RMultTerm = r.GetSignedNBits(nbits); GMultTerm = r.GetSignedNBits(nbits); BMultTerm = r.GetSignedNBits(nbits); AMultTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF; } else { RMultTerm = 0; GMultTerm = 0; BMultTerm = 0; AMultTerm = 0; } if (HasAddTerms) { RAddTerm = r.GetSignedNBits(nbits); GAddTerm = r.GetSignedNBits(nbits); BAddTerm = r.GetSignedNBits(nbits); AAddTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF; } else { RAddTerm = 0; GAddTerm = 0; BAddTerm = 0; AAddTerm = 0; } r.Align(); }
public ColorTransform(SwfReader r, bool useAlpha) { this.HasAddTerms = r.GetBit(); this.HasMultTerms = r.GetBit(); uint nbits = r.GetBits(4); if (HasMultTerms) { RMultTerm = r.GetSignedNBits(nbits); GMultTerm = r.GetSignedNBits(nbits); BMultTerm = r.GetSignedNBits(nbits); AMultTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF; } else { RMultTerm = 0; GMultTerm = 0; BMultTerm = 0; AMultTerm = 0; } if (HasAddTerms) { RAddTerm = r.GetSignedNBits(nbits); GAddTerm = r.GetSignedNBits(nbits); BAddTerm = r.GetSignedNBits(nbits); AAddTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF; } else { RAddTerm = 0; GAddTerm = 0; BAddTerm = 0; AAddTerm = 0; } r.Align(); }
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 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 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 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 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 ClipActions ClipActions; public PlaceObject3Tag(SwfReader r) { tagType = TagType.PlaceObject3; HasClipActions = r.GetBit(); HasClipDepth = r.GetBit(); HasName = r.GetBit(); HasRatio = r.GetBit(); HasColorTransform = r.GetBit(); HasMatrix = r.GetBit(); HasCharacter = r.GetBit(); Move = r.GetBit(); r.GetBits(5); // reserved PlaceFlagHasCacheAsBitmap = r.GetBit(); PlaceFlagHasBlendMode = r.GetBit(); PlaceFlagHasFilterList = 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 (PlaceFlagHasFilterList) { uint filterCount = (uint)r.GetByte(); FilterList = new List<IFilter>(); for (int i = 0; i < filterCount; i++) { FilterKind kind = (FilterKind)r.GetByte(); switch (kind) { case FilterKind.Bevel: FilterList.Add(new FilterBevel(r)); break; case FilterKind.Blur: FilterList.Add(new FilterBlur(r)); break; case FilterKind.ColorMatrix: FilterList.Add(new FilterColorMatrix(r)); break; case FilterKind.Convolution: FilterList.Add(new FilterConvolution(r)); break; case FilterKind.DropShadow: FilterList.Add(new FilterDropShadow(r)); break; case FilterKind.Glow: FilterList.Add(new FilterGlow(r)); break; case FilterKind.GradientBevel: FilterList.Add(new FilterGradientBevel(r)); break; case FilterKind.GradientGlow: FilterList.Add(new FilterGradientGlow(r)); break; default: // unsupported filter break; } } } if (PlaceFlagHasBlendMode) { BlendMode = (BlendMode)r.GetByte(); } if (HasClipActions) { //ClipActions = new ClipActions(); } }
private TagType tagType = TagType.DefineFont2; // may be 3 #endregion Fields #region Constructors public DefineFont2_3(SwfReader r, bool isHighRes) { this.IsHighRes = isHighRes; // true; if (isHighRes) { this.tagType = TagType.DefineFont3; } this.FontId = r.GetUI16(); this.FontFlagsHasLayout = r.GetBit(); this.FontFlagsShiftJIS = r.GetBit(); this.FontFlagsSmallText = r.GetBit(); this.FontFlagsANSI = r.GetBit(); this.FontFlagsWideOffsets = r.GetBit(); this.FontFlagsWideCodes = r.GetBit(); this.FontFlagsItalic = r.GetBit(); this.FontFlagsBold = r.GetBit(); r.Align(); this.LanguageCode = (uint)r.GetByte(); uint fontNameLen = (uint)r.GetByte(); this.FontName = r.GetString(fontNameLen); this.NumGlyphs = r.GetUI16(); this.OffsetTable = new uint[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.OffsetTable[i] = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16(); } this.CodeTableOffset = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16(); GlyphShapeTable = new List<Shape>(); for (int i = 0; i < this.NumGlyphs; i++) { Shape s = new Shape(r); GlyphShapeTable.Add(s); } this.CodeTable = new uint[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.CodeTable[i] = r.GetUI16(); } if (this.FontFlagsHasLayout) { this.FontAscent = r.GetInt16(); this.FontDescent = r.GetInt16(); this.FontLeading = r.GetInt16(); this.FontAdvanceTable = new int[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.FontAdvanceTable[i] = r.GetInt16(); } this.FontBoundsTable = new Rect[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.FontBoundsTable[i] = new Rect(r); } this.KerningCount = r.GetUI16(); this.FontKerningTable = new KerningRecord[this.KerningCount]; if(this.FontFlagsWideCodes) { for (int i = 0; i < this.KerningCount; i++) { this.FontKerningTable[i] = new KerningRecord(r.GetUI16(), r.GetUI16(), r.GetInt16()); } } else { for (int i = 0; i < this.KerningCount; i++) { this.FontKerningTable[i] = new KerningRecord((uint)r.GetByte(), (uint)r.GetByte(), r.GetInt16()); } } } }
public ButtonRecord(SwfReader r, TagType containerTag) { this.containerTag = containerTag; r.GetBits(2); ButtonHasBlendMode = r.GetBit(); ButtonHasFilterList = r.GetBit(); ButtonStateHitTest = r.GetBit(); ButtonStateDown = r.GetBit(); ButtonStateOver = r.GetBit(); ButtonStateUp = r.GetBit(); CharacterID = r.GetUI16(); PlaceDepth = r.GetUI16(); PlaceMatrix = new Matrix(r); if (containerTag == TagType.DefineButton2) { ColorTransform = new ColorTransform(r, true); if (ButtonHasFilterList) { // some dup code from placeObject3 : ( uint filterCount = (uint)r.GetByte(); FilterList = new List <IFilter>(); for (int i = 0; i < filterCount; i++) { FilterKind kind = (FilterKind)r.GetByte(); switch (kind) { case FilterKind.Bevel: FilterList.Add(new FilterBevel(r)); break; case FilterKind.Blur: FilterList.Add(new FilterBlur(r)); break; case FilterKind.ColorMatrix: FilterList.Add(new FilterColorMatrix(r)); break; case FilterKind.Convolution: FilterList.Add(new FilterConvolution(r)); break; case FilterKind.DropShadow: FilterList.Add(new FilterDropShadow(r)); break; case FilterKind.Glow: FilterList.Add(new FilterGlow(r)); break; case FilterKind.GradientBevel: FilterList.Add(new FilterGradientBevel(r)); break; case FilterKind.GradientGlow: FilterList.Add(new FilterGradientGlow(r)); break; default: // unsupported filter break; } } } if (ButtonHasBlendMode) { BlendMode = (BlendMode)r.GetByte(); } } }
public DefineFont2_3(SwfReader r, bool isHighRes) { this.IsHighRes = isHighRes; // true; if (isHighRes) { this.tagType = TagType.DefineFont3; } this.FontId = r.GetUI16(); this.FontFlagsHasLayout = r.GetBit(); this.FontFlagsShiftJIS = r.GetBit(); this.FontFlagsSmallText = r.GetBit(); this.FontFlagsANSI = r.GetBit(); this.FontFlagsWideOffsets = r.GetBit(); this.FontFlagsWideCodes = r.GetBit(); this.FontFlagsItalic = r.GetBit(); this.FontFlagsBold = r.GetBit(); r.Align(); this.LanguageCode = (uint)r.GetByte(); uint fontNameLen = (uint)r.GetByte(); this.FontName = r.GetString(fontNameLen); this.NumGlyphs = r.GetUI16(); this.OffsetTable = new uint[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.OffsetTable[i] = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16(); } this.CodeTableOffset = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16(); GlyphShapeTable = new List <Shape>(); for (int i = 0; i < this.NumGlyphs; i++) { Shape s = new Shape(r); GlyphShapeTable.Add(s); } this.CodeTable = new uint[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.CodeTable[i] = r.GetUI16(); } if (this.FontFlagsHasLayout) { this.FontAscent = r.GetInt16(); this.FontDescent = r.GetInt16(); this.FontLeading = r.GetInt16(); this.FontAdvanceTable = new int[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.FontAdvanceTable[i] = r.GetInt16(); } this.FontBoundsTable = new Rect[this.NumGlyphs]; for (int i = 0; i < this.NumGlyphs; i++) { this.FontBoundsTable[i] = new Rect(r); } this.KerningCount = r.GetUI16(); this.FontKerningTable = new KerningRecord[this.KerningCount]; if (this.FontFlagsWideCodes) { for (int i = 0; i < this.KerningCount; i++) { this.FontKerningTable[i] = new KerningRecord(r.GetUI16(), r.GetUI16(), r.GetInt16()); } } else { for (int i = 0; i < this.KerningCount; i++) { this.FontKerningTable[i] = new KerningRecord((uint)r.GetByte(), (uint)r.GetByte(), r.GetInt16()); } } } }
//public ClipActions ClipActions; public PlaceObject3Tag(SwfReader r) { tagType = TagType.PlaceObject3; HasClipActions = r.GetBit(); HasClipDepth = r.GetBit(); HasName = r.GetBit(); HasRatio = r.GetBit(); HasColorTransform = r.GetBit(); HasMatrix = r.GetBit(); HasCharacter = r.GetBit(); Move = r.GetBit(); r.GetBits(5); // reserved PlaceFlagHasCacheAsBitmap = r.GetBit(); PlaceFlagHasBlendMode = r.GetBit(); PlaceFlagHasFilterList = 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 (PlaceFlagHasFilterList) { uint filterCount = (uint)r.GetByte(); FilterList = new List <IFilter>(); for (int i = 0; i < filterCount; i++) { FilterKind kind = (FilterKind)r.GetByte(); switch (kind) { case FilterKind.Bevel: FilterList.Add(new FilterBevel(r)); break; case FilterKind.Blur: FilterList.Add(new FilterBlur(r)); break; case FilterKind.ColorMatrix: FilterList.Add(new FilterColorMatrix(r)); break; case FilterKind.Convolution: FilterList.Add(new FilterConvolution(r)); break; case FilterKind.DropShadow: FilterList.Add(new FilterDropShadow(r)); break; case FilterKind.Glow: FilterList.Add(new FilterGlow(r)); break; case FilterKind.GradientBevel: FilterList.Add(new FilterGradientBevel(r)); break; case FilterKind.GradientGlow: FilterList.Add(new FilterGradientGlow(r)); break; default: // unsupported filter break; } } } if (PlaceFlagHasBlendMode) { BlendMode = (BlendMode)r.GetByte(); } if (HasClipActions) { //ClipActions = new ClipActions(); } }
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 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 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(); } }