SWFProcessing.SWFModeller.Characters.Shapes.IO.ShapeParser.ParseDefineMorphShape C# (CSharp) Method

ParseDefineMorphShape() private method

private ParseDefineMorphShape ( SWFDataTypeReader shapeReader, Tag format ) : IShape
shapeReader SWFDataTypeReader
format Tag
return IShape
        private IShape ParseDefineMorphShape(SWFDataTypeReader shapeReader, Tag format)
        {
            Rect startBounds = shapeReader.ReadRect();
            shapeReader.Align8();
            Rect endBounds = shapeReader.ReadRect();
            shapeReader.Align8();

            Rect startEdgeBounds = null;
            Rect endEdgeBounds = null;
            bool usesNonScalingStrokes = false;
            bool usesScalingStrokes = false;

            if (format == Tag.DefineMorphShape2)
            {
                startEdgeBounds = shapeReader.ReadRect();
                shapeReader.Align8();
                endEdgeBounds = shapeReader.ReadRect();
                shapeReader.Align8();

                /*(void)*/shapeReader.ReadUBits(6); /* Reserved. Assume 0 */

                usesNonScalingStrokes = shapeReader.ReadBit();
                usesScalingStrokes = shapeReader.ReadBit();
            }

            /*(void)*/shapeReader.ReadUI32(); /* end edges offset. We don't need this */

            MorphFillStyle[] mfsa = this.ReadMorphFillStyleArray(shapeReader);

            MorphLineStyle[] mlsa = this.ReadMorphLineStyleArray(shapeReader, format);

            ShapeDef startShape = this.ReadShapeDef(shapeReader, format, false, mfsa, mlsa);
            ShapeDef endShape = this.ReadShapeDef(shapeReader, format, false, mfsa, mlsa);

            return new MorphShape()
            {
                Bounds = startBounds,
                EndBounds = endBounds,
                StartEdgeBounds = startEdgeBounds,
                EndEdgeBounds = endEdgeBounds,
                UsesNonScalingStrokes = usesNonScalingStrokes,
                UsesScalingStrokes = usesScalingStrokes,
                StartShape = startShape,
                EndShape = endShape
            };
        }