示例#1
0
            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);
            }
示例#2
0
 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)
                         ));
 }
示例#3
0
        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);
        }
示例#4
0
 protected override IShapeRecordEx Adapt(CurvedEdgeShapeRecord record)
 {
     return(record);
 }
示例#5
0
 protected abstract T Adapt(CurvedEdgeShapeRecord record);
示例#6
0
        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);
        }