GetBitsSigned() public méthode

public GetBitsSigned ( UInt32 numberOfBits ) : Int32
numberOfBits System.UInt32
Résultat System.Int32
Exemple #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse(Stream input)
        {
            BitStream bits = new BitStream(input);

            if (_HasScale = (1 == bits.GetBits(1)))
            {
                _numScaleBits = (byte)bits.GetBits(5);
                bits.GetBitsFB(_numScaleBits, out _xScaleF);
                bits.GetBitsFB(_numScaleBits, out _yScaleF);
            }

            _numTranslateBits = (byte)bits.GetBits(5);
            _translateX = bits.GetBitsSigned(_numTranslateBits);
            _translateY = bits.GetBitsSigned(_numTranslateBits);
        }
Exemple #2
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        public void Parse(BitStream bits, byte glyphBits, byte advancedBits)
        {
            this._glyphBits = glyphBits;
            this._advancedBits = advancedBits;

            this._glyphIndex =   bits.GetBits((UInt32)glyphBits);
            this._glyphAdvance = bits.GetBitsSigned((UInt32)advancedBits);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="inout"></param>
        /// <param name="bits"></param>
        public override void Parse(Stream inout, BitStream bits)
        {
            this._numbits = (UInt32)bits.GetBits(4);

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

            if (this._generalLineFlag)
            {
                this._deltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
                this._deltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            }
            else
            {
                this._vertLineFlag = (0 != bits.GetBits(1)) ? true : false;

                if (this._vertLineFlag)
                {
                    this._deltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
                }
                else
                {
                    this._deltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse( Stream input )
        {
            BitStream bits = new BitStream( input );

            _HasAddTerms = ( 1 == bits.GetBits( 1 ) );
            _HasMultTerms = ( 1 == bits.GetBits( 1 ) );
            _numBits = (byte)bits.GetBits( 4 );

            if ( _HasMultTerms )
            {
                _RedMultTerm = bits.GetBitsSigned( _numBits );
                _GreenMultTerm = bits.GetBitsSigned( _numBits );
                _BlueMultTerm = bits.GetBitsSigned( _numBits );
                _AlphaMultTerm = bits.GetBitsSigned( _numBits );
            }

            if ( _HasAddTerms )
            {
                _RedAddTerm = bits.GetBitsSigned( _numBits );
                _GreenAddTerm = bits.GetBitsSigned( _numBits );
                _BlueAddTerm = bits.GetBitsSigned( _numBits );
                _AlphaAddTerm = bits.GetBitsSigned( _numBits );
            }

            if ( ( !_HasAddTerms ) && ( !_HasMultTerms ) )
            {
                //
                // When none of the two flags are set, get the remaining bits
                // so that the entire method here works byte aligned
                //
                bits.GetBitsSigned( 2 );
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        /// <param name="bits"></param>
        public override void Parse(Stream output, BitStream bits)
        {
            this._numbits = (byte)bits.GetBits(4);

            this._controlDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._controlDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._anchorDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._anchorDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
        }
Exemple #6
0
        /// <summary>
        /// TODO : Documentation
        /// </summary>
        /// <param name="source"></param>
        public void Parse( Stream source )
        {
            BitStream bits = new BitStream(source);

            if (source.Length < 1)
            {
                throw new ArgumentException("Source does not contain enough data. Length = " + source.Length.ToString("d"));
            }
            else
            {
                //
                // The first 5 bits declare how many bits per entry are used
                //
                _bits_per_entry = bits.GetBits(5);
            }
            _x_min = bits.GetBitsSigned( _bits_per_entry );
            _x_max = bits.GetBitsSigned( _bits_per_entry );
            _y_min = bits.GetBitsSigned( _bits_per_entry );
            _y_max = bits.GetBitsSigned( _bits_per_entry );
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="input"></param>
 /// <param name="bits"></param>
 /// <param name="fillBits"></param>
 /// <param name="lineBits"></param>
 /// <param name="first"></param>
 private void ParseGeneric(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);
     }
 }
        /// <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;

            }
        }