Reset() 공개 메소드

public Reset ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public override void Parse( Stream input, TagTypes caller )
        {
            BitStream bits = new BitStream( input );

            this._spreadMode = ( SpreadMode )bits.GetBits( 2 );
            this._interpolationMode = ( InterPolation )bits.GetBits( 2 );
            this._numGradients = ( byte )bits.GetBits( 4 );

            bits.Reset();

            GradRecord temp = new GradRecord(this._SwfVersion);

            for ( int i = 0; i < _numGradients; i++ )
            {
                temp = new GradRecord( this._SwfVersion );
                temp.Parse( input, caller );
                this._gradientRecords.Add(temp);
            }

            bits.GetBitsFB( 16, out this._focalPoint );
        }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public virtual void TryParseShapeRecords(MemoryStream input, TagTypes caller)
        {
            BitStream bits = new BitStream(input);

            this._shapeRecords = new List<ShapeRecord>();

            StyleChangeRecord tempSCR = new StyleChangeRecord(this._SwfVersion);
            StraightEdgeRecord tempSER = new StraightEdgeRecord(this._SwfVersion);
            CurvedEdgeRecord tempCER = new CurvedEdgeRecord(this._SwfVersion);

            byte fiveBits = 0;
            bool endShapeRecordSeen = false;
            int numberOfStyleChanges = 0;

            UInt16 localNumFillBits = this._numFillBits;
            UInt16 localNumLineBits = this._numLineBits;

            do
            {
                bool typeFlag = (0 != bits.GetBits(1)) ? true : false;

                if (typeFlag)
                {
                    bool straightFlag = Convert.ToBoolean(bits.GetBits(1));

                    if (straightFlag)
                    {
                        tempSER = new StraightEdgeRecord(this._SwfVersion);
                        tempSER.Parse(input, bits);
                        this._shapeRecords.Add(tempSER);
                    }
                    else
                    {
                        tempCER = new CurvedEdgeRecord(this._SwfVersion);
                        tempCER.Parse(input, bits);
                        this._shapeRecords.Add(tempCER);
                    }
                }
                else
                {
                    fiveBits = (byte)bits.GetBits(5);

                    if (0 == fiveBits)
                    {
                        endShapeRecordSeen = true;
                    }
                    else
                    {
                        tempSCR = new StyleChangeRecord(this._SwfVersion);
                        tempSCR.Parse(input, bits, fiveBits, caller, ref localNumFillBits, ref localNumLineBits, 0 == numberOfStyleChanges ? true : false);
                        numberOfStyleChanges += 1;
                        this._shapeRecords.Add(tempSCR);
                    }
                }
            }
            while (!endShapeRecordSeen);
            bits.Reset();
        }
예제 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public override void Parse(Stream input, TagTypes caller)
        {
            BinaryReader br = new BinaryReader(input);

            this._width = br.ReadUInt16();

            BitStream bits = new BitStream(input);

            this._startCapStyle = (CapStyle)(Convert.ToByte(bits.GetBits(2)));
            this._joinstyle = (JoinStyle)(Convert.ToByte(bits.GetBits(2)));

            this._hasFillFlag = (0 != bits.GetBits(1) ? true : false);
            this._noHScale = (0 != bits.GetBits(1) ? true : false);
            this._noVScale = (0 != bits.GetBits(1) ? true : false);
            this._pixelHinting = (0 != bits.GetBits(1) ? true : false);

            bits.GetBits(5); // reserved must be null

            this._noClose = (0 != bits.GetBits(1) ? true : false);

            this._endCapStyle = (CapStyle)bits.GetBits(2);

            if (this._joinstyle.Equals(JoinStyle.Miter))
            {
                bits.Reset();
                this._miterLimtiFactor = br.ReadUInt16();
            }
            if (!this._hasFillFlag)
            {
                bits.Reset();
                this._color.Parse(input);
            }
            if (this._hasFillFlag)
            {
                bits.Reset();
                this._fillStyle.Parse(input, caller);
            }
        }
예제 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="bits"></param>
        /// <param name="fillBits"></param>
        /// <param name="lineBits"></param>
        /// <param name="first"></param>
        private void ParseDefineShape23(Stream input, BitStream bits, ref UInt16 fillBits, ref UInt16 lineBits, bool first)
        {
            if (this._stateMoveTo)
            {
                this._moveBits = (byte)bits.GetBits(5);
                this._moveDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._moveBits);
                this._moveDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._moveBits);
            }

            if (this._stateFillStyle0)
            {
                this._fillStyle0 = bits.GetBits((UInt32)fillBits);
            }

            if (this._stateFillStyle1)
            {
                this._fillStyle1 = bits.GetBits((UInt32)fillBits);
            }
            if (this._stateLineStyle)
            {
                this._lineStyle = bits.GetBits((UInt32)lineBits);
            }
            if (this._stateNewStyles)
            {

                bits.Reset();
                this._fillStyles.Parse(input, this._caller);
                this._lineStyles.Parse(input, this._caller);
                this._newNumFillBits = (UInt16)bits.GetBits(4);
                this._newNumLineBits = (UInt16)bits.GetBits(4);
                fillBits = this._newNumFillBits;
                lineBits = this._newNumLineBits;

            }
        }