/// <summary> /// /// </summary> /// <param name="InitialVersion">The initial version of the Swf file</param> public MorphLineStyle2(byte InitialVersion) : base(InitialVersion) { this._endColor = new Rgba(this._SwfVersion); this._startColor = new Rgba(this._SwfVersion); this._fillStyle = new MorphFillStyle(this._SwfVersion); }
/// <summary> /// /// </summary> /// <param name="input"></param> /// <param name="caller"></param> public override void Parse(Stream input, TagTypes caller) { BinaryReader br = new BinaryReader(input); this._fillStyleCount = br.ReadByte(); if (this._fillStyleCount.Equals(0xFF)) { this._fillStyleCountExtended = br.ReadUInt16(); this._fillStyles = new MorphFillStyle[this._fillStyleCountExtended]; for (UInt16 i = 0; i < this._fillStyleCountExtended; i++) { MorphFillStyle temp = new MorphFillStyle(this._SwfVersion); temp.Parse(input); this._fillStyles[i] = temp; } } else { this._fillStyles = new MorphFillStyle[this._fillStyleCount]; for (byte i = 0; i < this._fillStyleCount; i++) { MorphFillStyle temp = new MorphFillStyle(this._SwfVersion); temp.Parse(input); this._fillStyles[i] = temp; } } }
private MorphLineStyle ReadMorphLineStyle2(SWFDataTypeReader shapeReader) { int startwidth = shapeReader.ReadUI16(); int endwidth = shapeReader.ReadUI16(); CapStyle startCap = (CapStyle)shapeReader.ReadUBits(2); JoinStyle join = (JoinStyle)shapeReader.ReadUBits(2); bool hasFill = shapeReader.ReadBit(); bool noHScaling = shapeReader.ReadBit(); bool noVScaling = shapeReader.ReadBit(); bool hasPixelHints = shapeReader.ReadBit(); shapeReader.ReadUBits(5); // Reserved: 0 bool noClose = shapeReader.ReadBit(); CapStyle endCap = (CapStyle)shapeReader.ReadUBits(2); int?miterLimit = null; if (join == JoinStyle.Miter) { miterLimit = shapeReader.ReadUI16(); } Color? startColour = null; Color? endColour = null; MorphFillStyle fs = null; if (hasFill) { fs = this.ReadMorphFillStyle(shapeReader); } else { startColour = shapeReader.ReadRGBA(); endColour = shapeReader.ReadRGBA(); } return(new MorphLineStyle() { StartWidth = startwidth, EndWidth = endwidth, StartColour = startColour, EndColour = endColour, StartCap = startCap, EndCap = endCap, Join = join, HasFill = hasFill, NoHScaling = noHScaling, NoVScaling = noVScaling, HasPixelHints = hasPixelHints, FillStyle = fs, MiterLimit = miterLimit }); }
private MorphFillStyle ReadMorphFillStyle(SWFDataTypeReader shapeReader) { MorphFillStyle style = new MorphFillStyle(); style.Type = (FillType)shapeReader.ReadUI8(); if (style.Type == FillType.Solid) { style.StartColour = shapeReader.ReadRGBA(); style.EndColour = shapeReader.ReadRGBA(); } if (style.Type == FillType.LinearGradient || style.Type == FillType.RadialGradient) { style.StartFillMatrix = shapeReader.ReadMatrix(); shapeReader.Align8(); style.EndFillMatrix = shapeReader.ReadMatrix(); shapeReader.Align8(); if (style.Type == FillType.LinearGradient || style.Type == FillType.RadialGradient) { style.Gradient = this.ReadMorphGradient(shapeReader); } } if (FillTypes.IsBitmap(style.Type)) { int cid = shapeReader.ReadUI16(); /* Some fills have this magic number in them which seems to deliberately not * reference a bitmap. The spec is silent on the matter. Oh flash, you * bumbling simian. */ if (cid != 0x0000FFFF) { style.Bitmap = this.ImageFinder.FindImage(cid); } style.StartFillMatrix = shapeReader.ReadMatrix(); shapeReader.Align8(); style.EndFillMatrix = shapeReader.ReadMatrix(); shapeReader.Align8(); } return(style); }
private MorphFillStyle[] ReadMorphFillStyleArray(SWFDataTypeReader shapeReader) { int fillCount = shapeReader.ReadUI8(); if (fillCount == 0xFF) { fillCount = shapeReader.ReadUI16(); } MorphFillStyle[] fillStyles = new MorphFillStyle[fillCount]; for (int i = 0; i < fillCount; i++) { fillStyles[i] = this.ReadMorphFillStyle(shapeReader); } return(fillStyles); }