ReadData() 공개 메소드

Reads the data.
public ReadData ( BufferedBinaryReader binaryReader ) : void
binaryReader SwfDotNet.IO.Utils.BufferedBinaryReader Binary reader.
리턴 void
예제 #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);

            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);
        }
예제 #2
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            fillStyleType = binaryReader.ReadByte();

            startColor = null;
            endColor   = null;
            if (fillStyleType == (byte)MorphFillStyleType.SolidFill)
            {
                startColor = new RGBA();
                startColor.ReadData(binaryReader);
                endColor = new RGBA();
                endColor.ReadData(binaryReader);
            }

            startGradientMatrix = null;
            endGradientMatrix   = null;
            MorphGradientCollection gradient = null;

            if (fillStyleType == (byte)MorphFillStyleType.LinearGradientFill ||
                fillStyleType == (byte)MorphFillStyleType.RadialGradientFill)
            {
                startGradientMatrix = new Matrix();
                startGradientMatrix.ReadData(binaryReader);
                endGradientMatrix = new Matrix();
                endGradientMatrix.ReadData(binaryReader);
                gradient = new MorphGradientCollection();
                gradient.ReadData(binaryReader);
            }

            bitmapId          = 0;
            startBitmapMatrix = null;
            endBitmapMatrix   = null;
            if (fillStyleType == (byte)MorphFillStyleType.RepeatingBitmap ||
                fillStyleType == (byte)MorphFillStyleType.ClippedBitmapFill ||
                fillStyleType == (byte)MorphFillStyleType.NonSmoothedClippedBitmap ||
                fillStyleType == (byte)MorphFillStyleType.NonSmoothedRepeatingBitmap)
            {
                bitmapId          = binaryReader.ReadUInt16();
                startBitmapMatrix = new Matrix();
                startBitmapMatrix.ReadData(binaryReader);
                endBitmapMatrix = new Matrix();
                endBitmapMatrix.ReadData(binaryReader);
            }
        }
예제 #3
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="firstByte">First byte.</param>
        /// <param name="buttonType">Button type.</param>
        public void ReadData(BufferedBinaryReader binaryReader,
                             byte firstByte, TagCodeEnum buttonType)
        {
            BitArray ba = BitParser.GetBitValues(new byte[1] {
                firstByte
            });

            buttonStateHitTest = ba.Get(4);
            buttonStateDown    = ba.Get(5);
            buttonStateOver    = ba.Get(6);
            buttonStateUp      = ba.Get(7);

            characterId = binaryReader.ReadUInt16();
            placeDepth  = binaryReader.ReadUInt16();
            placeMatrix = new Matrix();
            placeMatrix.ReadData(binaryReader);
            colorTransform = null;

            if (buttonType == TagCodeEnum.DefineButton2)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
        }
예제 #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);
        }
예제 #5
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            fillStyleType = binaryReader.ReadByte();

            startColor = null;
            endColor = null;
            if (fillStyleType == (byte)MorphFillStyleType.SolidFill)
            {
                startColor = new RGBA();
                startColor.ReadData(binaryReader);
                endColor = new RGBA();
                endColor.ReadData(binaryReader);
            }

            startGradientMatrix = null;
            endGradientMatrix = null;
            MorphGradientCollection gradient = null;
            if (fillStyleType == (byte)MorphFillStyleType.LinearGradientFill ||
                fillStyleType == (byte)MorphFillStyleType.RadialGradientFill)
            {
                startGradientMatrix = new Matrix();
                startGradientMatrix.ReadData(binaryReader);
                endGradientMatrix = new Matrix();
                endGradientMatrix.ReadData(binaryReader);
                gradient = new MorphGradientCollection();
                gradient.ReadData(binaryReader);
            }

            bitmapId = 0;
            startBitmapMatrix = null;
            endBitmapMatrix = null;
            if (fillStyleType == (byte)MorphFillStyleType.RepeatingBitmap ||
                fillStyleType == (byte)MorphFillStyleType.ClippedBitmapFill ||
                fillStyleType == (byte)MorphFillStyleType.NonSmoothedClippedBitmap ||
                fillStyleType == (byte)MorphFillStyleType.NonSmoothedRepeatingBitmap)
            {
                bitmapId = binaryReader.ReadUInt16();
                startBitmapMatrix = new Matrix();
                startBitmapMatrix.ReadData(binaryReader);
                endBitmapMatrix = new Matrix();
                endBitmapMatrix.ReadData(binaryReader);
            }
        }
예제 #6
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            long initPos = binaryReader.BaseStream.Position;

            characterId = binaryReader.ReadUInt16();
            depth = binaryReader.ReadUInt16();
            matrix = new Matrix();
            matrix.ReadData(binaryReader);

            long pos = binaryReader.BaseStream.Position - initPos;
            if (pos < rh.TagLength)
            {
                colorTransform = new CXForm();
                colorTransform.ReadData(binaryReader);
            }
        }
예제 #7
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="firstByte">First byte.</param>
        /// <param name="buttonType">Button type.</param>
        public void ReadData(BufferedBinaryReader binaryReader,
            byte firstByte, TagCodeEnum buttonType)
        {
            BitArray ba = BitParser.GetBitValues(new byte[1]{firstByte});
            buttonStateHitTest = ba.Get(4);
            buttonStateDown = ba.Get(5);
            buttonStateOver = ba.Get(6);
            buttonStateUp = ba.Get(7);

            characterId = binaryReader.ReadUInt16();
            placeDepth = binaryReader.ReadUInt16();
            placeMatrix = new Matrix();
            placeMatrix.ReadData(binaryReader);
            colorTransform = null;

            if (buttonType == TagCodeEnum.DefineButton2)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
        }
예제 #8
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            bool placeFlagHasClipActions = binaryReader.ReadBoolean();
            bool placeFlagHasClipDepth = binaryReader.ReadBoolean();
            bool placeFlagHasName = binaryReader.ReadBoolean();
            bool placeFlagHasRatio = binaryReader.ReadBoolean();
            bool placeFlagHasColorTransform = binaryReader.ReadBoolean();
            bool placeFlagHasMatrix = binaryReader.ReadBoolean();
            bool placeFlagHasCharacter = binaryReader.ReadBoolean();
            placeFlagMove = binaryReader.ReadBoolean();

            depth = binaryReader.ReadUInt16();
            characterId = 0;
            if (placeFlagHasCharacter)
                characterId = binaryReader.ReadUInt16();
            matrix = null;
            if (placeFlagHasMatrix)
            {
                matrix = new Matrix();
                matrix.ReadData(binaryReader);
            }
            colorTransform = null;
            if (placeFlagHasColorTransform)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
            ratio = 0;
            if (placeFlagHasRatio)
                ratio = binaryReader.ReadUInt16() / 65535.0f;
            name = null;
            if (placeFlagHasName)
                name = binaryReader.ReadString();
            clipDepth = 0;
            if (placeFlagHasClipDepth)
                clipDepth = binaryReader.ReadUInt16();

            // get bytecode actions
            clipActions = null;
            if (placeFlagHasClipActions)
            {
                // different behaviour for Flash 6+
                actionHead = (version>=6) ? binaryReader.ReadBytes(6) : binaryReader.ReadBytes(4);
                // read clip action records to list
                ArrayList clpAc = new ArrayList();
                //ClipActionRec a = null;
                bool res = true;
                do
                {
                    ClipActionRec action = new ClipActionRec();
                    res = action.ReadData(binaryReader, version);
                    if (res)
                        clpAc.Add(action);
                }
                while (res);
                // copy list to array
                clipActions = new ClipActionRec[clpAc.Count];
                clpAc.CopyTo(clipActions,0);
            }
        }