public 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); }
public 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; } }
public void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.GetURL); w.AppendUI16(Length - 3);// don't incude this part w.AppendString(UrlString); w.AppendString(TargetString); }
public void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(FontID); w.AppendString(FontName); w.AppendString(FontCopyright); w.ResetLongTagLength(this.TagType, start, true); }
public void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.GoToLabel); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendString(Label); }
public void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.SetTarget); w.AppendUI16(Length - 3); // don't incude def byte and len w.AppendString(TargetName); }
public void ToSwf(SwfWriter w, bool isSwf6Plus) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendBit(HasClipActions); w.AppendBit(HasClipDepth); w.AppendBit(HasName); w.AppendBit(HasRatio); w.AppendBit(HasColorTransform); w.AppendBit(HasMatrix); w.AppendBit(HasCharacter); w.AppendBit(Move); w.AppendUI16(Depth); if (HasCharacter) { w.AppendUI16(Character); } if (HasMatrix) { Matrix.ToSwf(w); } if (HasColorTransform) { ColorTransform.ToSwf(w, true); } if (HasRatio) { w.AppendUI16(Ratio); } if (HasName) { w.AppendString(Name); } if (HasClipDepth) { w.AppendUI16(ClipDepth); } if (HasClipActions) { ClipActions.ToSwf(w, isSwf6Plus); } //w.ResetLongTagLength(this.TagType, start, true); // this may be always long tag? if (HasClipActions || HasName) { w.ResetLongTagLength(this.TagType, start, true); // flash always makes long tags is clip actions are present } else { w.ResetLongTagLength(this.TagType, start); } }
public 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(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; } }
public void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16((uint)Exports.Count); foreach (uint index in Exports.Keys) { w.AppendUI16(index); w.AppendString(Exports[index]); } w.ResetLongTagLength(this.TagType, start, true); }
public virtual void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); uint len = (uint)Ids.Length; w.AppendUI16(len); for (int i = 0; i < len; i++) { w.AppendUI16(Ids[i]); w.AppendString(Names[i]); } w.ResetLongTagLength(this.TagType, start, true); }
public void ToSwf(SwfWriter w) { w.AppendByte((byte)ActionKind.ConstantPool); long lenPos = w.Position; w.AppendUI16(0); // length w.AppendUI16((uint)Constants.Length); for (int i = 0; i < Constants.Length; i++) { w.AppendString(Constants[i]); } long temp = w.Position; w.Position = lenPos; w.AppendUI16((uint)(temp - lenPos - 2)); // skip len bytes w.Position = temp; }
public void ToSwf(SwfWriter w) { w.AppendTagIDAndLength(this.TagType, (uint)TargetName.Length + 1, true); w.AppendString(TargetName); // todo: check for unicode implications on labels }
public 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(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; } }
public void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(FontId); w.AppendBit(FontFlagsHasLayout); w.AppendBit(FontFlagsShiftJIS); w.AppendBit(FontFlagsSmallText); w.AppendBit(FontFlagsANSI); w.AppendBit(FontFlagsWideOffsets); w.AppendBit(FontFlagsWideCodes); w.AppendBit(FontFlagsItalic); w.AppendBit(FontFlagsBold); w.Align(); w.AppendByte((byte)LanguageCode); w.AppendByte((byte)(FontName.Length + 1)); // add trailing /0 w.AppendString(FontName, (uint)FontName.Length); w.AppendUI16(NumGlyphs); for (int i = 0; i < this.NumGlyphs; i++) { if (this.FontFlagsWideOffsets) { w.AppendUI32(this.OffsetTable[i]); } else { w.AppendUI16(this.OffsetTable[i]); } } if (this.FontFlagsWideOffsets) { w.AppendUI32(this.CodeTableOffset); } else { w.AppendUI16(this.CodeTableOffset); } for (int i = 0; i < this.NumGlyphs; i++) { GlyphShapeTable[i].ToSwf(w); } for (int i = 0; i < this.NumGlyphs; i++) { w.AppendUI16(this.CodeTable[i]); } if (this.FontFlagsHasLayout) { w.AppendInt16(FontAscent); w.AppendInt16(FontDescent); w.AppendInt16(FontLeading); for (int i = 0; i < this.NumGlyphs; i++) { w.AppendInt16(this.FontAdvanceTable[i]); } for (int i = 0; i < this.NumGlyphs; i++) { this.FontBoundsTable[i].ToSwf(w); } w.AppendUI16(this.KerningCount); if (this.FontFlagsWideCodes) { for (int i = 0; i < this.KerningCount; i++) { w.AppendUI16(this.FontKerningTable[i].FontKerningCode1); w.AppendUI16(this.FontKerningTable[i].FontKerningCode2); w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment); } } else { for (int i = 0; i < this.KerningCount; i++) { w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode1); w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode2); w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment); } } } w.ResetLongTagLength(this.TagType, start, true); }
public void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendUI16(FontId); w.AppendBit(FontFlagsHasLayout); w.AppendBit(FontFlagsShiftJIS); w.AppendBit(FontFlagsSmallText); w.AppendBit(FontFlagsANSI); w.AppendBit(FontFlagsWideOffsets); w.AppendBit(FontFlagsWideCodes); w.AppendBit(FontFlagsItalic); w.AppendBit(FontFlagsBold); w.Align(); w.AppendByte((byte)LanguageCode); w.AppendByte((byte)(FontName.Length + 1)); // add trailing /0 w.AppendString(FontName, (uint)FontName.Length); w.AppendUI16(NumGlyphs); for (int i = 0; i < this.NumGlyphs; i++) { if (this.FontFlagsWideOffsets) { w.AppendUI32(this.OffsetTable[i]); } else { w.AppendUI16(this.OffsetTable[i]); } } if (this.FontFlagsWideOffsets) { w.AppendUI32(this.CodeTableOffset); } else { w.AppendUI16(this.CodeTableOffset); } for (int i = 0; i < this.NumGlyphs; i++) { GlyphShapeTable[i].ToSwf(w); } for (int i = 0; i < this.NumGlyphs; i++) { w.AppendUI16(this.CodeTable[i]); } if (this.FontFlagsHasLayout) { w.AppendInt16(FontAscent); w.AppendInt16(FontDescent); w.AppendInt16(FontLeading); for (int i = 0; i < this.NumGlyphs; i++) { w.AppendInt16(this.FontAdvanceTable[i]); } for (int i = 0; i < this.NumGlyphs; i++) { this.FontBoundsTable[i].ToSwf(w); } w.AppendUI16(this.KerningCount); if(this.FontFlagsWideCodes) { for (int i = 0; i < this.KerningCount; i++) { w.AppendUI16(this.FontKerningTable[i].FontKerningCode1); w.AppendUI16(this.FontKerningTable[i].FontKerningCode2); w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment); } } else { for (int i = 0; i < this.KerningCount; i++) { w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode1); w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode2); w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment); } } } w.ResetLongTagLength(this.TagType, start, true); }
public void ToSwf(SwfWriter w) { w.AppendByte((byte)PrimitiveType); w.AppendString(StringValue); }
public override void ToSwf(SwfWriter w) { uint start = (uint)w.Position; w.AppendTagIDAndLength(this.TagType, 0, true); w.AppendBit(HasClipActions); w.AppendBit(HasClipDepth); w.AppendBit(HasName); w.AppendBit(HasRatio); w.AppendBit(HasColorTransform); w.AppendBit(HasMatrix); w.AppendBit(HasCharacter); w.AppendBit(Move); w.AppendBits(0, 5); // reserved w.AppendBit(PlaceFlagHasCacheAsBitmap); w.AppendBit(PlaceFlagHasBlendMode); w.AppendBit(PlaceFlagHasFilterList); w.AppendUI16(Depth); if (HasCharacter) { w.AppendUI16(Character); } if (HasMatrix) { Matrix.ToSwf(w); } if (HasColorTransform) { ColorTransform.ToSwf(w, true); } if (HasRatio) { w.AppendUI16(Ratio); } if (HasName) { w.AppendString(Name); } if (HasClipDepth) { w.AppendUI16(ClipDepth); } if (PlaceFlagHasFilterList) { w.AppendByte((byte)FilterList.Count); for (int i = 0; i < FilterList.Count; i++) { FilterList[i].ToSwf(w); } } if (PlaceFlagHasBlendMode) { w.AppendByte((byte)BlendMode); } if (HasClipActions) { //todo: ClipActions = new ClipActions(); } w.ResetLongTagLength(this.TagType, start); }