public IShapeRecord Visit(CurvedEdgeShapeRecord record, XElement xShape) { foreach (var attribute in xShape.Attributes()) { switch (attribute.Name.LocalName) { case "x1": record.ControlDeltaX = int.Parse(attribute.Value); break; case "y1": record.ControlDeltaY = int.Parse(attribute.Value); break; case "x2": record.AnchorDeltaX = int.Parse(attribute.Value); break; case "y2": record.AnchorDeltaY = int.Parse(attribute.Value); break; default: OnUnknownAttributeFound(attribute); break; } } return(record); }
public XElement Visit(CurvedEdgeShapeRecord record, object arg) { return(new XElement("CurveTo", new XAttribute("x1", record.ControlDeltaX), new XAttribute("y1", record.ControlDeltaY), new XAttribute("x2", record.AnchorDeltaX), new XAttribute("y2", record.AnchorDeltaY) )); }
private CurvedEdgeShapeRecord ReadCurvedEdgeShapeRecord(ISwfStreamReader reader) { var record = new CurvedEdgeShapeRecord(); var numBits = reader.ReadUnsignedBits(4) + 2; record.ControlDeltaX = reader.ReadSignedBits(numBits); record.ControlDeltaY = reader.ReadSignedBits(numBits); record.AnchorDeltaX = reader.ReadSignedBits(numBits); record.AnchorDeltaY = reader.ReadSignedBits(numBits); return(record); }
protected override IShapeRecordEx Adapt(CurvedEdgeShapeRecord record) { return(record); }
protected abstract T Adapt(CurvedEdgeShapeRecord record);
ShapeRecordWriteContext IShapeRecordVisitor <ShapeRecordWriteContext, ShapeRecordWriteContext> .Visit(CurvedEdgeShapeRecord record, ShapeRecordWriteContext ctx) { var writer = ctx.Writer; writer.WriteBit(true); writer.WriteBit(false); var actualBits = new SignedBitsCount(record.ControlDeltaX, record.ControlDeltaY, record.AnchorDeltaX, record.AnchorDeltaY).GetBits(); if (actualBits < 2) { actualBits = 2; } writer.WriteUnsignedBits(actualBits - 2u, 4); writer.WriteSignedBits(record.ControlDeltaX, actualBits); writer.WriteSignedBits(record.ControlDeltaY, actualBits); writer.WriteSignedBits(record.AnchorDeltaX, actualBits); writer.WriteSignedBits(record.AnchorDeltaY, actualBits); return(ctx); }