ReadData() public method

Reads the data from the binary reader.
public ReadData ( BufferedBinaryReader binaryReader ) : void
binaryReader SwfDotNet.IO.Utils.BufferedBinaryReader Binary reader.
return void
Exemplo n.º 1
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)
 {
     base.SetStartPoint(binaryReader);
     ratio = binaryReader.ReadByte();
     color = null;
     if (shapeType == ShapeType.Shape3)
     {
         color = new RGBA();
         color.ReadData(binaryReader);
     }
     else if (shapeType == ShapeType.Shape || shapeType == ShapeType.Shape2)
     {
         color = new RGB();
         color.ReadData(binaryReader);
     }
     base.SetEndPoint(binaryReader);
 }
Exemplo 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)
 {
     base.SetStartPoint(binaryReader);
     width = binaryReader.ReadUInt16();
     rgb   = null;
     if (shapeType == ShapeType.Shape3)
     {
         rgb = new RGBA();
         rgb.ReadData(binaryReader);
     }
     else if (shapeType == ShapeType.Shape || shapeType == ShapeType.Shape2)
     {
         rgb = new RGB();
         rgb.ReadData(binaryReader);
     }
     base.SetEndPoint(binaryReader);
 }
Exemplo n.º 3
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)
        {
            base.SetStartPoint(binaryReader);

            fillStyleType  = binaryReader.ReadByte();
            rgbColor       = null;
            gradientMatrix = null;
            bitmapId       = 0;
            bitmapMatrix   = null;
            gradient       = null;

            if (fillStyleType == (byte)FillStyleType.SolidFill)
            {
                if (shapeType == ShapeType.Shape3)
                {
                    rgbColor = new RGBA();
                    rgbColor.ReadData(binaryReader);
                }
                else if (shapeType == ShapeType.Shape2 || shapeType == ShapeType.Shape)
                {
                    rgbColor = new RGB();
                    rgbColor.ReadData(binaryReader);
                }
            }

            if (fillStyleType == (byte)FillStyleType.RadialGradientFill ||
                fillStyleType == (byte)FillStyleType.LinearGradientFill)
            {
                gradientMatrix = new Matrix();
                gradientMatrix.ReadData(binaryReader);
                gradient = new GradientRecordCollection();
                gradient.ReadData(binaryReader, shapeType);
            }

            if (fillStyleType == (byte)FillStyleType.RepeatingBitmapFill ||
                fillStyleType == (byte)FillStyleType.ClippedBitmapFill ||
                fillStyleType == (byte)FillStyleType.NonSmoothedClippedBitmap ||
                fillStyleType == (byte)FillStyleType.NonSmoothedRepeatingBitmap)
            {
                bitmapId     = binaryReader.ReadUInt16();
                bitmapMatrix = new Matrix();
                bitmapMatrix.ReadData(binaryReader);
            }

            base.SetEndPoint(binaryReader);
        }
Exemplo n.º 4
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)
        {
            base.SetStartPoint(binaryReader);

            fillStyleType = binaryReader.ReadByte();
            rgbColor = null;
            gradientMatrix = null;
            bitmapId = 0;
            bitmapMatrix = null;
            gradient = null;

            if (fillStyleType == (byte)FillStyleType.SolidFill)
            {
                if (shapeType == ShapeType.Shape3)
                {
                    rgbColor = new RGBA();
                    rgbColor.ReadData(binaryReader);
                }
                else if (shapeType == ShapeType.Shape2 || shapeType == ShapeType.Shape)
                {
                    rgbColor = new RGB();
                    rgbColor.ReadData(binaryReader);
                }
            }

            if (fillStyleType == (byte)FillStyleType.RadialGradientFill ||
                fillStyleType == (byte)FillStyleType.LinearGradientFill)
            {
                gradientMatrix = new Matrix();
                gradientMatrix.ReadData(binaryReader);
                gradient = new GradientRecordCollection();
                gradient.ReadData(binaryReader, shapeType);
            }

            if (fillStyleType == (byte)FillStyleType.RepeatingBitmapFill ||
                fillStyleType == (byte)FillStyleType.ClippedBitmapFill ||
                fillStyleType == (byte)FillStyleType.NonSmoothedClippedBitmap ||
                fillStyleType == (byte)FillStyleType.NonSmoothedRepeatingBitmap)
            {
                bitmapId = binaryReader.ReadUInt16();
                bitmapMatrix = new Matrix();
                bitmapMatrix.ReadData(binaryReader);
            }

            base.SetEndPoint(binaryReader);
        }
Exemplo n.º 5
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)
 {
     base.SetStartPoint(binaryReader);
     ratio = binaryReader.ReadByte();
     color = null;
     if (shapeType == ShapeType.Shape3)
     {
         color = new RGBA();
         color.ReadData(binaryReader);
     }
     else if (shapeType == ShapeType.Shape || shapeType == ShapeType.Shape2)
     {
         color = new RGB();
         color.ReadData(binaryReader);
     }
     base.SetEndPoint(binaryReader);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="endOfRecordsFlag">End of records flag.</param>
        /// <param name="tagCodeEnum">Tag code enum.</param>
        public void ReadData(BufferedBinaryReader binaryReader, ref bool endOfRecordsFlag, 
            TagCodeEnum tagCodeEnum)
        {
            binaryReader.SynchBits();
            bool textRecordType = binaryReader.ReadBoolean();
            binaryReader.ReadUBits(3);

            bool styleFlagsHasFont = binaryReader.ReadBoolean();
            bool styleFlagsHasColor = binaryReader.ReadBoolean();
            bool styleFlagsHasYOffset = binaryReader.ReadBoolean();
            bool styleFlagsHasXOffset = binaryReader.ReadBoolean();

            if (textRecordType == false)
            {
                endOfRecordsFlag = true;
                return;
            }

            fontId = 0;
            if (styleFlagsHasFont)
                fontId = binaryReader.ReadUInt16();

            textColor = null;
            if (styleFlagsHasColor)
            {
                if (tagCodeEnum == TagCodeEnum.DefineText2)
                {
                    textColor = new RGBA();
                    textColor.ReadData(binaryReader);
                }
                else
                {
                    textColor = new RGB();
                    textColor.ReadData(binaryReader);
                }
            }

            xOffset = 0;
            if (styleFlagsHasXOffset)
                xOffset = binaryReader.ReadInt16();

            yOffset = 0;
            if (styleFlagsHasYOffset)
                yOffset = binaryReader.ReadInt16();

            textHeight = 0;
            if (styleFlagsHasFont)
                textHeight = binaryReader.ReadUInt16();

            byte glyphCount = binaryReader.ReadByte();
            if (glyphCount > 0)
            {
                if (glyphEntries == null)
                    glyphEntries = new GlyphEntryCollection();
                else
                    glyphEntries.Clear();

                for (int i = 0; i < glyphCount; i++)
                {
                    GlyphEntry glyphEntry = new GlyphEntry();
                    glyphEntry.ReadData(binaryReader);
                    glyphEntries.Add(glyphEntry);
                }
            }
        }
Exemplo n.º 7
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)
 {
     base.SetStartPoint(binaryReader);
     width = binaryReader.ReadUInt16();
     rgb = null;
     if (shapeType == ShapeType.Shape3)
     {
         rgb = new RGBA();
         rgb.ReadData(binaryReader);
     }
     else if (shapeType == ShapeType.Shape || shapeType == ShapeType.Shape2)
     {
         rgb = new RGB();
         rgb.ReadData(binaryReader);
     }
     base.SetEndPoint(binaryReader);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="endOfRecordsFlag">End of records flag.</param>
        /// <param name="tagCodeEnum">Tag code enum.</param>
        public void ReadData(BufferedBinaryReader binaryReader, ref bool endOfRecordsFlag,
                             TagCodeEnum tagCodeEnum)
        {
            binaryReader.SynchBits();
            bool textRecordType = binaryReader.ReadBoolean();

            binaryReader.ReadUBits(3);

            bool styleFlagsHasFont    = binaryReader.ReadBoolean();
            bool styleFlagsHasColor   = binaryReader.ReadBoolean();
            bool styleFlagsHasYOffset = binaryReader.ReadBoolean();
            bool styleFlagsHasXOffset = binaryReader.ReadBoolean();

            if (textRecordType == false)
            {
                endOfRecordsFlag = true;
                return;
            }

            fontId = 0;
            if (styleFlagsHasFont)
            {
                fontId = binaryReader.ReadUInt16();
            }

            textColor = null;
            if (styleFlagsHasColor)
            {
                if (tagCodeEnum == TagCodeEnum.DefineText2)
                {
                    textColor = new RGBA();
                    textColor.ReadData(binaryReader);
                }
                else
                {
                    textColor = new RGB();
                    textColor.ReadData(binaryReader);
                }
            }

            xOffset = 0;
            if (styleFlagsHasXOffset)
            {
                xOffset = binaryReader.ReadInt16();
            }

            yOffset = 0;
            if (styleFlagsHasYOffset)
            {
                yOffset = binaryReader.ReadInt16();
            }

            textHeight = 0;
            if (styleFlagsHasFont)
            {
                textHeight = binaryReader.ReadUInt16();
            }

            byte glyphCount = binaryReader.ReadByte();

            if (glyphCount > 0)
            {
                if (glyphEntries == null)
                {
                    glyphEntries = new GlyphEntryCollection();
                }
                else
                {
                    glyphEntries.Clear();
                }

                for (int i = 0; i < glyphCount; i++)
                {
                    GlyphEntry glyphEntry = new GlyphEntry();
                    glyphEntry.ReadData(binaryReader);
                    glyphEntries.Add(glyphEntry);
                }
            }
        }