StraightEdgeRecord defines a straight line.

The line is drawn from the current drawing point to the end point specified in the StraightEdgeRecord object which is specified relative to the current drawing point. Once the line is drawn, the end of the line is now the current drawing point.

The relative coordinates are specified in twips (where 20 twips = 1 pixel) and must be in the range -65536..65535.

Lines are drawn with rounded corners and line ends. Different join and line end styles can be created by drawing line segments as a sequence of filled shapes. With 1 twip equal to 1/20th of a pixel this technique can easily be used to draw the narrowest of visible lines.

This tag was introduced in Flash 1.

Inheritance: EdgeRecord
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="shapeType">Shape type.</param>
        public void ReadData(BufferedBinaryReader binaryReader, ShapeType shapeType)
        {
            binaryReader.SynchBits();
            byte numFillBits = (byte)binaryReader.ReadUBits(4);
            byte numLineBits = (byte)binaryReader.ReadUBits(4);

            bool readEndShapeRecord = false;

            while (!readEndShapeRecord)
            {
                bool type  = binaryReader.ReadBoolean();
                byte flags = (byte)binaryReader.ReadUBits(5);

                if (type == false)
                {
                    //Non-edge record
                    if (flags == 0)
                    {
                        //EndShapeRecord
                        readEndShapeRecord = true;
                        this.Add(new EndShapeRecord());
                    }
                    else
                    {
                        //StyleChangerecord
                        StyleChangeRecord styleChange = new StyleChangeRecord();
                        styleChange.ReadData(binaryReader, flags, ref numFillBits, ref numLineBits, shapeType);
                        this.Add(styleChange);
                    }
                }
                else
                {
                    //Edge record
                    if ((flags & 0x10) != 0)
                    {
                        //StraightedEdgeRecord
                        StraightEdgeRecord straight = new StraightEdgeRecord();
                        straight.ReadData(binaryReader, flags);
                        this.Add(straight);
                    }
                    else
                    {
                        //CurvedEdgeRecord
                        CurvedEdgeRecord curved = new CurvedEdgeRecord();
                        curved.ReadData(binaryReader, flags);
                        this.Add(curved);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="shapeType">Shape type.</param>
        public void ReadData(BufferedBinaryReader binaryReader, ShapeType shapeType)
        {
            binaryReader.SynchBits();
            byte numFillBits = (byte)binaryReader.ReadUBits(4);
            byte numLineBits = (byte)binaryReader.ReadUBits(4);

            bool readEndShapeRecord = false;
            while (!readEndShapeRecord)
            {
                bool type = binaryReader.ReadBoolean();
                byte flags = (byte)binaryReader.ReadUBits(5);

                if (type == false)
                {
                    //Non-edge record
                    if (flags == 0)
                    {
                        //EndShapeRecord
                        readEndShapeRecord = true;
                        this.Add(new EndShapeRecord());
                        if (log.IsInfoEnabled)
                            log.Info("Shape: EndShapeRecord");
                    }
                    else
                    {
                        //StyleChangerecord
                        StyleChangeRecord styleChange = new StyleChangeRecord();
                        styleChange.ReadData(binaryReader, flags, ref numFillBits, ref numLineBits, shapeType);
                        this.Add(styleChange);
                        if (log.IsInfoEnabled)
                            log.Info("Shape: StyleChangeRecord");
                    }
                }
                else
                {
                    //Edge record
                    if ((flags & 0x10) != 0)
                    {
                        //StraightedEdgeRecord
                        StraightEdgeRecord straight = new StraightEdgeRecord();
                        straight.ReadData(binaryReader, flags);
                        this.Add(straight);
                        if (log.IsInfoEnabled)
                            log.Info("Shape: StraightedEdgeRecord");
                    }
                    else
                    {
                        //CurvedEdgeRecord
                        CurvedEdgeRecord curved = new CurvedEdgeRecord();
                        curved.ReadData(binaryReader, flags);
                        this.Add(curved);
                        if (log.IsInfoEnabled)
                            log.Info("Shape: CurvedEdgeRecord");
                    }
                }
            }
        }