public ShapeWithStyle(SwfReader r, ShapeType shapeType) { this.shapeType = shapeType; // parse fill defs FillStyles = new FillStyleArray(r, shapeType); // parse line defs LineStyles = new LineStyleArray(r, shapeType); r.Align(); fillBits = r.GetBits(4); lineBits = r.GetBits(4); r.Align(); ParseShapeRecords(r); }
public StyleChangedRecord(SwfReader r, uint flags, ref uint fillBits, ref uint lineBits, ShapeType shapeType) { MoveDeltaX = 0; MoveDeltaY = 0; FillStyle1 = 0; FillStyle0 = 0; LineStyle = 0; HasNewStyles = (flags & 0x10) != 0; HasLineStyle = (flags & 0x08) != 0; HasFillStyle1 = (flags & 0x04) != 0; HasFillStyle0 = (flags & 0x02) != 0; HasMove = (flags & 0x01) != 0; if (shapeType == ShapeType.Glyph) // glyphs really should be a different style changed record imo : ) { if (HasMove) { uint moveBits = r.GetBits(5); this.MoveDeltaX = r.GetSignedNBits(moveBits); this.MoveDeltaY = r.GetSignedNBits(moveBits); } if (HasFillStyle0) { this.FillStyle0 = r.GetBits(fillBits); } } else { if (HasMove) { uint moveBits = r.GetBits(5); this.MoveDeltaX = r.GetSignedNBits(moveBits); this.MoveDeltaY = r.GetSignedNBits(moveBits); } if (HasFillStyle0) { this.FillStyle0 = r.GetBits(fillBits); } if (HasFillStyle1) { this.FillStyle1 = r.GetBits(fillBits); } if (HasLineStyle) { this.LineStyle = r.GetBits(lineBits); } //r.Align(); if (HasNewStyles) { FillStyles = new FillStyleArray(r, shapeType); LineStyles = new LineStyleArray(r, shapeType); fillBits = r.GetBits(4); lineBits = r.GetBits(4); } else { FillStyles = new FillStyleArray(); LineStyles = new LineStyleArray(); HasNewStyles = false; } } }
private List<StrokeStyle> ParseLineStyleArray(LineStyleArray tag) { List<StrokeStyle> result = new List<StrokeStyle>(); foreach (ILineStyle o in tag.LineStyles) { if (o is LineStyle) { result.Add(ParseLineStyle((LineStyle)o)); } else if (o is LineStyle2) { result.Add(ParseLineStyle2((LineStyle2)o)); } } return result; }