internal override void ToSwf(SwfWriter w, bool useAlpha) { w.AppendUI16(this.Width); w.AppendBits((uint)this.StartCapStyle, 2); w.AppendBits((uint)this.JoinStyle, 2); w.AppendBit(this.HasFillFlag); w.AppendBit(this.NoHScaleFlag); w.AppendBit(this.NoVScaleFlag); w.AppendBit(this.PixelHintingFlag); w.AppendBits(0, 5); w.AppendBit(this.NoClose); w.AppendBits((uint)this.EndCapStyle, 2); if (this.JoinStyle == JoinStyle.MiterJoin) { w.AppendFixed8_8(this.MiterLimitFactor); } if (this.HasFillFlag) { this.FillStyle.ToSwf(w); } else { w.AppendByte(Color.R); w.AppendByte(Color.G); w.AppendByte(Color.B); if (useAlpha) { w.AppendByte(Color.A); } } }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.WaitForFrame2); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendByte((byte)SkipCount); }
internal void ToSwf(SwfWriter w) { w.AppendBits(0, 2); w.AppendBit(ButtonHasBlendMode); w.AppendBit(ButtonHasFilterList); w.AppendBit(ButtonStateHitTest); w.AppendBit(ButtonStateDown); w.AppendBit(ButtonStateOver); w.AppendBit(ButtonStateUp); w.AppendUI16(CharacterID); w.AppendUI16(PlaceDepth); PlaceMatrix.ToSwf(w); if (containerTag == TagType.DefineButton2) { ColorTransform.ToSwf(w, true); if (ButtonHasFilterList) { w.AppendByte((byte)FilterList.Count); for (int i = 0; i < FilterList.Count; i++) { FilterList[i].ToSwf(w); } } if (ButtonHasBlendMode) { w.AppendByte((byte)BlendMode); } } }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.StoreRegister); w.AppendUI16(Length - 3); // don't incude this part w.AppendByte((byte)Register); }
internal override void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(CharacterID); Bounds.ToSwf(w); w.AppendBit(HasText); w.AppendBit(WordWrap); w.AppendBit(Multiline); w.AppendBit(Password); w.AppendBit(ReadOnly); w.AppendBit(HasTextColor); w.AppendBit(HasMaxLength); w.AppendBit(HasFont); w.AppendBit(false);// resreved w.AppendBit(AutoSize); w.AppendBit(HasLayout); w.AppendBit(NoSelect); w.AppendBit(Border); w.AppendBit(false);// resreved w.AppendBit(HTML); w.AppendBit(UseOutlines); if (HasFont) { w.AppendUI16(FontID); w.AppendUI16(FontHeight); } if (HasTextColor) { w.AppendByte((byte)TextColor.R); w.AppendByte((byte)TextColor.G); w.AppendByte((byte)TextColor.B); w.AppendByte((byte)TextColor.A); } if (HasMaxLength) { w.AppendUI16(MaxLength); } if (HasLayout) { w.AppendByte((byte)Align); w.AppendUI16(LeftMargin); w.AppendUI16(RightMargin); w.AppendUI16(Indent); w.AppendUI16((uint)Leading); } w.AppendString(VariableName); if (HasText) { w.AppendString(InitialText); } w.ResetLongTagLength(this.TagType, start, true); }
internal override void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(CharacterId); if (!HasAlphaData) { if (!HasOwnTable) { w.AppendByte(0xFF); w.AppendByte(0xD8); w.AppendBytes(JpegData); w.AppendByte(0xFF); w.AppendByte(0xD9); } else { w.AppendBytes(JpegData); } } else { w.AppendUI32((uint)JpegData.Length); w.AppendBytes(JpegData); w.AppendBytes(CompressedAlphaData); } w.ResetLongTagLength(this.TagType, start, true); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)PrimitiveType); byte b = (BooleanValue == true) ? (byte)0x01 : (byte)0x00; w.AppendByte(b); }
internal override void ToSwf(SwfWriter w) { uint len = 3; w.AppendTagIDAndLength(this.TagType, len, false); w.AppendByte(Color.R); w.AppendByte(Color.G); w.AppendByte(Color.B); }
internal void ToSwf(SwfWriter w, bool useAlpha) { w.AppendByte(Ratio); w.AppendByte(Color.R); w.AppendByte(Color.G); w.AppendByte(Color.B); if (useAlpha) { w.AppendByte(Color.A); } }
internal override void ToSwf(SwfWriter w, bool useAlpha) { w.AppendByte((byte)this.FillType); w.AppendByte(Color.R); w.AppendByte(Color.G); w.AppendByte(Color.B); if (useAlpha) { w.AppendByte(Color.A); } }
internal override void ToSwf(SwfWriter w, bool useAlpha) { w.AppendUI16(this.Width); w.AppendByte(Color.R); w.AppendByte(Color.G); w.AppendByte(Color.B); if (useAlpha) { w.AppendByte(Color.A); } }
internal override void ToSwf(SwfWriter w) { return; // NOT YET HANDLED uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendByte((byte)MajorVersion); w.AppendByte((byte)MinorVersion); w.AppendInt32(Product); w.AppendInt32(Edition); //w.AppendBytes(build); //w.AppendBytes(compilationDate); w.ResetLongTagLength(this.TagType, start, true); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.GoToLabel); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendString(Label); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.DefineFunction); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendString(FunctionName); w.AppendUI16((uint)Params.Length); for (int i = 0; i < Params.Length; i++) { w.AppendString(Params[i]); } w.AppendUI16(CodeSize); // temp long startPos = w.Position; for (int i = 0; i < Statements.Count; i++) { Statements[i].ToSwf(w); } // adjust code size long curPos = w.Position; if (codeSize != (curPos - startPos)) { codeSize = (uint)(curPos - startPos); w.Position = startPos - 2; w.AppendUI16(CodeSize); // acutal w.Position = curPos; } }
internal void ToSwf(SwfWriter w, bool isSwf6Plus) { if ((uint)ClipEvents == 0) { if (isSwf6Plus) { w.AppendUI32(0); } else { w.AppendUI16(0); } } else { w.AppendBits((uint)ClipEvents, 32); uint start = (uint)w.Position; w.AppendUI32(0); // write len after tag written if ((ClipEvents & ClipEvents.KeyPress) > 0) { w.AppendByte(KeyCode); } ActionRecords.ToSwf(w); uint end = (uint)w.Position; w.Position = start; w.AppendUI32(end - start - 4); w.Position = end; } }
internal override void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(ButtonId); w.AppendBits(0, 7); w.AppendBit(TrackAsMenu); w.AppendUI16(ActionOffset); // todo: calc offset for (int i = 0; i < Characters.Count; i++) { Characters[i].ToSwf(w); } w.AppendByte(0); if (ActionOffset > 0) { ButtonCondActions[ButtonCondActions.Count - 1].CondActionSize = 0; for (int i = 0; i < ButtonCondActions.Count; i++) { ButtonCondActions[i].ToSwf(w); } } w.ResetLongTagLength(this.TagType, start, true); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.With); w.AppendUI16(Length - 3); // don't incude def byte and len // todo: ctor missing }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.SetTarget); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendString(TargetName); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.Jump); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendInt16(BranchOffset); }
internal void ToSwf(SwfWriter w) { w.AppendBits(0, 2); // reserved w.AppendBit(IsSyncStop); w.AppendBit(IsSyncNoMultiple); w.AppendBit(HasEnvelope); w.AppendBit(HasLoops); w.AppendBit(HasOutPoint); w.Align(); if (HasInPoint) { w.AppendUI32(InPoint); } if (HasOutPoint) { w.AppendUI32(OutPoint); } if (HasLoops) { w.AppendUI16(LoopCount); } if (HasEnvelope) { w.AppendByte((byte)LoopCount); uint count = (uint)EnvelopeRecords.Length; for (int i = 0; i < EnvelopeRecords.Length; i++) { w.AppendUI32(EnvelopeRecords[i].Pos44); w.AppendUI16(EnvelopeRecords[i].LeftLevel); w.AppendUI16(EnvelopeRecords[i].RightLevel); } } }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.GetURL); w.AppendUI16(Length - 3);// don't incude this part w.AppendString(UrlString); w.AppendString(TargetString); }
internal void ToSwf(SwfWriter w, uint glyphBits, uint advanceBits, bool hasAlpha) { w.AppendBit(_TextRecordType); w.AppendBits(_StyleFlagsReserved, 3); w.AppendBit(StyleFlagsHasFont); w.AppendBit(StyleFlagsHasColor); w.AppendBit(StyleFlagsHasYOffset); w.AppendBit(StyleFlagsHasXOffset); w.Align(); if (StyleFlagsHasFont) { w.AppendUI16(FontID); } if (StyleFlagsHasColor) { w.AppendByte(TextColor.R); w.AppendByte(TextColor.G); w.AppendByte(TextColor.B); if (hasAlpha) { w.AppendByte(TextColor.A); } } if (StyleFlagsHasXOffset) { w.AppendInt16(XOffset); } if (StyleFlagsHasYOffset) { w.AppendInt16(YOffset); } if (StyleFlagsHasFont) { w.AppendUI16(TextHeight); } w.AppendByte((byte)GlyphEntries.Length); for (int i = 0; i < GlyphEntries.Length; i++) { w.AppendBits(GlyphEntries[i].GlyphIndex, glyphBits); w.AppendSignedNBits(GlyphEntries[i].GlyphAdvance, advanceBits); } w.Align(); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.DefineFunction2); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendString(FunctionName); w.AppendUI16((uint)Parameters.Count); w.AppendByte((byte)RegisterCount); w.AppendBit((Preloads & PreloadFlags.Parent) > 0); w.AppendBit((Preloads & PreloadFlags.Root) > 0); w.AppendBit(SuppressSuperFlag); w.AppendBit((Preloads & PreloadFlags.Super) > 0); w.AppendBit(SuppressArgumentsFlag); w.AppendBit((Preloads & PreloadFlags.Arguments) > 0); w.AppendBit(SuppressThisFlag); w.AppendBit((Preloads & PreloadFlags.This) > 0); w.AppendBits(0, 7); w.AppendBit((Preloads & PreloadFlags.Global) > 0); foreach (KeyValuePair <uint, string> d in Parameters) { w.AppendByte((byte)d.Key); w.AppendString(d.Value); } w.AppendUI16(ActionContainer.CodeSize); // temp long startPos = w.Position; for (int i = 0; i < ActionContainer.Statements.Count; i++) { ActionContainer.Statements[i].ToSwf(w); } // adjust code size long curPos = w.Position; if (ActionContainer.codeSize != (curPos - startPos)) { ActionContainer.codeSize = (uint)(curPos - startPos); w.Position = startPos - 2; w.AppendUI16(ActionContainer.CodeSize); // acutal w.Position = curPos; } }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.Push); w.AppendUI16(Length - 3); // don't incude def byte and len for (int i = 0; i < Values.Count; i++) { Values[i].ToSwf(w); } }
internal void ToSwf(SwfWriter w, ShapeType shapeType) { if (FillStyles.Count > 0xFE) { w.AppendByte(0xFF); w.AppendUI16((uint)FillStyles.Count); } else { w.AppendByte((byte)FillStyles.Count); } bool useAlpha = shapeType > ShapeType.DefineShape2; for (int i = 0; i < FillStyles.Count; i++) { FillStyles[i].ToSwf(w, useAlpha); } }
internal override void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); if (JpegTable.Length > 0) { w.AppendByte(0xFF); w.AppendByte(0xD8); w.AppendBytes(JpegTable); w.AppendByte(0xFF); w.AppendByte(0xD9); } w.ResetLongTagLength(this.TagType, start, true); }
internal override void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.GetURL2); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendBits((uint)SendVarsMethod, 2); w.AppendBits(0, 4); w.AppendBit(TargetIsSprite); w.AppendBit(LoadVariables); w.Align(); }
internal override void ToSwf(SwfWriter w) { if (this.CompressionMode == CompressionType.ZLIB) { w.AppendByte((byte)'C'); } else if (this.CompressionMode == CompressionType.LZMA) { w.AppendByte((byte)'Z'); } else { w.AppendByte((byte)'F'); } w.AppendByte((byte)'W'); w.AppendByte((byte)'S'); w.AppendByte(this.Version); w.AppendUI32(this.FileLength); this.FrameSize.ToSwf(w); ushort frateWhole = (ushort)this.FrameRate; uint frateDec = (((uint)this.FrameRate * 0x100) & 0xFF); w.AppendUI16((uint)((frateWhole << 8) + frateDec)); w.AppendUI16(this.FrameCount); }
internal override void ToSwf(SwfWriter w) { byte[] bytes = BitConverter.GetBytes(DoubleValue); w.AppendByte((byte)PrimitiveType); w.AppendByte(bytes[4]); w.AppendByte(bytes[5]); w.AppendByte(bytes[6]); w.AppendByte(bytes[7]); w.AppendByte(bytes[0]); w.AppendByte(bytes[1]); w.AppendByte(bytes[2]); w.AppendByte(bytes[3]); }
internal override void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(CharacterId); TextBounds.ToSwf(w); TextMatrix.ToSwf(w); w.AppendByte((byte)glyphBits); // TODO: gen nbits w.AppendByte((byte)advanceBits); // TODO: gen nbits for (int i = 0; i < TextRecords.Count; i++) { TextRecords[i].ToSwf(w, glyphBits, advanceBits, tagType >= TagType.DefineText2); } w.AppendByte(0); // end w.ResetLongTagLength(this.TagType, start, true); }