/// <summary> /// Creates a new <see cref="DefineShape3Tag"/> instance. /// </summary> /// <param name="shapeId">Shape id.</param> /// <param name="rect">Rect.</param> /// <param name="shape">Shape.</param> public DefineShape3Tag(ushort shapeId, Rect rect, ShapeWithStyle shape) : base(shapeId, rect, shape) { this.shapeType = ShapeType.Shape3; this.versionCompatibility = 3; this._tagCode = (int)TagCodeEnum.DefineShape3; }
/// <summary> /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see> /// </summary> public override void ReadData(byte version, BufferedBinaryReader binaryReader) { RecordHeader rh = new RecordHeader(); rh.ReadData(binaryReader); characterId = binaryReader.ReadUInt16(); binaryReader.SynchBits(); startBounds = new Rect(); startBounds.ReadData(binaryReader); binaryReader.SynchBits(); endBounds = new Rect(); endBounds.ReadData(binaryReader); binaryReader.SynchBits(); offset = binaryReader.ReadUInt32(); morphFillStyles = new MorphFillStyleCollection(); morphFillStyles.ReadData(binaryReader); morphLineStyles = new MorphLineStyleCollection(); morphLineStyles.ReadData(binaryReader); ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count; ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count; startEdges = new ShapeRecordCollection(); startEdges.ReadData(binaryReader, ShapeType.None); ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count; ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count; endEdges = new ShapeRecordCollection(); endEdges.ReadData(binaryReader, ShapeType.None); }
/// <summary> /// Creates a new <see cref="DefineMorphShapeTag"/> instance. /// </summary> /// <param name="characterId">Character id.</param> /// <param name="startBounds">Start bounds.</param> /// <param name="endBounds">End bounds.</param> /// <param name="offset">Offset.</param> /// <param name="morphFillStyles">Morph fill styles.</param> /// <param name="morphLineStyles">Morph line styles.</param> /// <param name="startEdges">Start edges.</param> /// <param name="endEdges">End edges.</param> public DefineMorphShapeTag(ushort characterId, Rect startBounds, Rect endBounds, uint offset, MorphFillStyleCollection morphFillStyles, MorphLineStyleCollection morphLineStyles, ShapeRecordCollection startEdges, ShapeRecordCollection endEdges) { this.characterId = characterId; this.startBounds = startBounds; this.endBounds = endBounds; this.offset = offset; this.morphFillStyles = morphFillStyles; this.morphLineStyles = morphLineStyles; this.startEdges = startEdges; this.endEdges = endEdges; this._tagCode = (int)TagCodeEnum.DefineMorphShape; }
/// <summary> /// Reads the data from a binary file /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { this.signature = binaryReader.ReadString(3); this.version = binaryReader.ReadByte(); if (this.version > MAX_VERSION) throw new InvalidSwfVersionException(this.version, MAX_VERSION); this.fileSize = binaryReader.ReadUInt32(); this.rect = new Rect(); this.rect.ReadData(binaryReader); binaryReader.SynchBits(); this.fps = binaryReader.ReadFloatWord(8, 8); this.frames = binaryReader.ReadUInt16(); }
/// <summary> /// Creates a new <see cref="SwfHeader"/> instance. /// </summary> /// <param name="signature">Signature.</param> /// <param name="version">Version.</param> /// <param name="fileSize">Size of the file.</param> /// <param name="dimensions">Dimensions.</param> /// <param name="fps">FPS.</param> /// <param name="frames">Frames.</param> public SwfHeader(string signature, byte version, uint fileSize, Rect dimensions, float fps, ushort frames) { this.signature = signature; Version = version; this.fileSize = fileSize; this.rect = dimensions; this.fps = fps; this.frames = frames; }
/// <summary> /// Constructor. /// </summary> public SwfHeader() { fps = 12.0f; frames = 0; rect = new Rect(0, 0, 550 * 20, 400 * 20); version = (byte)MAX_VERSION; signature = "FWS"; }
/// <summary> /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see> /// </summary> public override void ReadData(byte version, BufferedBinaryReader binaryReader) { RecordHeader rh = new RecordHeader(); rh.ReadData(binaryReader); characterId = binaryReader.ReadUInt16(); rect = new Rect(); rect.ReadData(binaryReader); BitArray ba = BitParser.GetBitValues(new byte[1]{ binaryReader.ReadByte() }); bool hasText = ba.Get(0); //binaryReader.ReadBoolean(); wordWrap = ba.Get(1); //binaryReader.ReadBoolean(); multiline = ba.Get(2); //binaryReader.ReadBoolean(); password = ba.Get(3); //binaryReader.ReadBoolean(); readOnly = ba.Get(4); //binaryReader.ReadBoolean(); bool hasTextColor = ba.Get(5); //binaryReader.ReadBoolean(); bool hasMaxLength = ba.Get(6); //binaryReader.ReadBoolean(); bool hasFont = ba.Get(7); //binaryReader.ReadBoolean(); //binaryReader.SynchBits(); ba = BitParser.GetBitValues(new byte[1]{ binaryReader.ReadByte() }); //binaryReader.ReadBoolean(); //Reserved autoSize = ba.Get(1); //binaryReader.ReadBoolean(); bool hasLayout = ba.Get(2); //binaryReader.ReadBoolean(); noSelect = ba.Get(3); //binaryReader.ReadBoolean(); border = ba.Get(4); //binaryReader.ReadBoolean(); //binaryReader.ReadBoolean(); //Reserved html = ba.Get(6); //binaryReader.ReadBoolean(); usedOutlines = ba.Get(7); //binaryReader.ReadBoolean(); if (hasFont) { fontId = binaryReader.ReadUInt16(); fontHeight = binaryReader.ReadUInt16(); } if (hasTextColor) { textColor = new RGBA(); textColor.ReadData(binaryReader); } if (hasMaxLength) maxLenght = binaryReader.ReadUInt16(); if (hasLayout) { align = binaryReader.ReadByte(); leftMargin = binaryReader.ReadUInt16(); rightMargin = binaryReader.ReadUInt16(); indent = binaryReader.ReadUInt16(); leading = binaryReader.ReadUInt16(); } variableName = binaryReader.ReadString(); if (hasText) initialText = binaryReader.ReadString(); }
/// <summary> /// Inits this instance. /// </summary> protected void Init() { textRecords = new TextRecordCollection(); rect = new Rect(); matrix = new Matrix(); }
/// <summary> /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see> /// </summary> public override void ReadData(byte version, BufferedBinaryReader binaryReader) { RecordHeader rh = new RecordHeader(); rh.ReadData(binaryReader); characterId = binaryReader.ReadUInt16(); if (rect == null) rect = new Rect(); rect.ReadData(binaryReader); if (matrix == null) matrix = new Matrix(); matrix.ReadData(binaryReader); TextRecordCollection.GLYPH_BITS = binaryReader.ReadByte(); TextRecordCollection.ADVANCE_BITS = binaryReader.ReadByte(); if (textRecords == null) textRecords = new TextRecordCollection(); else textRecords.Clear(); bool endOfRecordsFlag = false; while (!endOfRecordsFlag) { TextRecord textRecord = new TextRecord(); textRecord.ReadData(binaryReader, ref endOfRecordsFlag, (TagCodeEnum)this.TagCode); if (!endOfRecordsFlag) textRecords.Add(textRecord); } }
/// <summary> /// Inits this instance. /// </summary> private void Init() { this.rect = new Rect(); this.shape = new ShapeWithStyle(); }
/// <summary> /// Creates a new <see cref="DefineShape"/> instance. /// </summary> /// <param name="shapeId">Shape id.</param> /// <param name="rect">Rect.</param> /// <param name="shape">Shape.</param> protected DefineShape(ushort shapeId, Rect rect, ShapeWithStyle shape) { Init(); this.shapeId = shapeId; this.rect = rect; this.shape = shape; }