ReadSBits() public method

Reads Signed bits.
public ReadSBits ( uint bits ) : int
bits uint Bits.
return int
コード例 #1
0
ファイル: ShapeRecord.cs プロジェクト: foresightbrand/brandqq
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="flags">Flags.</param>
        /// <param name="numFillBits">Num fill bits.</param>
        /// <param name="numLineBits">Num line bits.</param>
        /// <param name="shapeType">Shape type.</param>
        public void ReadData(BufferedBinaryReader binaryReader, byte flags,
            ref byte numFillBits, ref byte numLineBits, ShapeType shapeType)
        {
            base.SetStartPoint(binaryReader);
            bool stateNewStyle = ((flags & 0x10) != 0);
            bool stateLineStyle = ((flags & 0x08) != 0);
            bool stateFillStyle1 = ((flags & 0x04) != 0);
            bool stateFillStyle0 = ((flags & 0x02) != 0);
            bool stateMoveTo = ((flags & 0x01) != 0);

            if  (stateMoveTo)
            {
                uint bits = binaryReader.ReadUBits(5);
                moveDeltaX = binaryReader.ReadSBits(bits);
                moveDeltaY = binaryReader.ReadSBits(bits);
            }
            if (stateFillStyle0)
            {
                fillStyle0 = (int)binaryReader.ReadUBits(numFillBits);
            }
            if (stateFillStyle1)
            {
                fillStyle1 = (int)binaryReader.ReadUBits(numFillBits);
            }
            if (stateLineStyle)
            {
                lineStyle = (int)binaryReader.ReadUBits(numLineBits);
            }

            fillStyles = null;
            lineStyles = null;

            if (stateNewStyle)
            {
                fillStyles = new FillStyleCollection();
                fillStyles.ReadData(binaryReader, shapeType);
                lineStyles = new LineStyleCollection();
                lineStyles.ReadData(binaryReader, shapeType);

                numFillBits = (byte)binaryReader.ReadUBits(4);
                numLineBits = (byte)binaryReader.ReadUBits(4);
            }
            base.SetEndPoint(binaryReader);
        }
コード例 #2
0
ファイル: ShapeRecord.cs プロジェクト: foresightbrand/brandqq
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="flags">Flags.</param>
        public void ReadData(BufferedBinaryReader binaryReader, byte flags)
        {
            base.SetStartPoint(binaryReader);
            byte numBits = (byte)(flags & 0x0F);

            controlDeltaX = binaryReader.ReadSBits((uint)(numBits + 2));
            controlDeltaY = binaryReader.ReadSBits((uint)(numBits + 2));
            anchorDeltaX = binaryReader.ReadSBits((uint)(numBits + 2));
            anchorDeltaY = binaryReader.ReadSBits((uint)(numBits + 2));
            base.SetEndPoint(binaryReader);
        }
コード例 #3
0
ファイル: ShapeRecord.cs プロジェクト: foresightbrand/brandqq
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="flags">Flags.</param>
        public void ReadData(BufferedBinaryReader binaryReader, byte flags)
        {
            base.SetStartPoint(binaryReader);
            byte numBits = (byte)(flags & 0x0F);
            bool generalLineFLag = binaryReader.ReadBoolean();
            deltaX = 0;
            deltaY = 0;

            if (generalLineFLag)
            {
                deltaX = binaryReader.ReadSBits((uint)(numBits + 2));
                deltaY = binaryReader.ReadSBits((uint)(numBits + 2));
            }
            else
            {
                bool vertLineFlag = binaryReader.ReadBoolean();
                if (!vertLineFlag)
                    deltaX = binaryReader.ReadSBits((uint)(numBits + 2));
                else
                    deltaY = binaryReader.ReadSBits((uint)(numBits + 2));
            }
            base.SetEndPoint(binaryReader);
        }
コード例 #4
0
ファイル: Matrix.cs プロジェクト: foresightbrand/brandqq
 /// <summary>
 /// Reads the data.
 /// </summary>
 /// <param name="binaryReader">Binary reader.</param>
 public void ReadData(BufferedBinaryReader binaryReader)
 {
     base.SetStartPoint(binaryReader);
     binaryReader.SynchBits();
     bool hasScale = binaryReader.ReadBoolean();
     if (hasScale)
     {
         uint nScaleBits = binaryReader.ReadUBits(5);
         matrix[0, 0] = binaryReader.ReadFloat(nScaleBits);
         matrix[1, 1] = binaryReader.ReadFloat(nScaleBits);
     }
     bool hasRotate = binaryReader.ReadBoolean();
     if (hasRotate)
     {
         uint nRotateBits = binaryReader.ReadUBits(5);
         matrix[1, 0] = binaryReader.ReadFloat(nRotateBits);
         matrix[0, 1] = binaryReader.ReadFloat(nRotateBits);
     }
     uint nTranslateBits = binaryReader.ReadUBits(5);
     matrix[0, 2] = (float)binaryReader.ReadSBits(nTranslateBits);
     matrix[1, 2] = (float)binaryReader.ReadSBits(nTranslateBits);
     binaryReader.SynchBits();
     base.SetEndPoint(binaryReader);
 }
コード例 #5
0
ファイル: Rect.cs プロジェクト: Berenold/SwfExport
        /// <summary>
        /// Reads the data from a binary file
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            base.SetStartPoint(binaryReader);

            uint nBits = binaryReader.ReadUBits(5);
            xMin = binaryReader.ReadSBits(nBits);
            xMax = binaryReader.ReadSBits(nBits);
            yMin = binaryReader.ReadSBits(nBits);
            yMax = binaryReader.ReadSBits(nBits);

            base.SetEndPoint(binaryReader);
        }
コード例 #6
0
ファイル: TextRecord.cs プロジェクト: Berenold/SwfExport
 /// <summary>
 /// Reads the data.
 /// </summary>
 /// <param name="binaryReader">Binary reader.</param>
 public void ReadData(BufferedBinaryReader binaryReader)
 {
     glyphIndex = binaryReader.ReadUBits(TextRecordCollection.GLYPH_BITS);
     glyphAdvance = binaryReader.ReadSBits(TextRecordCollection.ADVANCE_BITS);
 }
コード例 #7
0
ファイル: CXForm.cs プロジェクト: foresightbrand/brandqq
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            hasAddTerms = binaryReader.ReadBoolean();
            hasMultTerms = binaryReader.ReadBoolean();
            uint nBits = binaryReader.ReadUBits(4);

            if (hasMultTerms)
            {
                int redMultTerms = binaryReader.ReadSBits(nBits);
                int greenMultTerms = binaryReader.ReadSBits(nBits);
                int blueMultTerms = binaryReader.ReadSBits(nBits);
            }

            if (hasAddTerms)
            {
                int redAddTerms = binaryReader.ReadSBits(nBits);
                int greenAddTerms = binaryReader.ReadSBits(nBits);
                int blueAddTerms = binaryReader.ReadSBits(nBits);
            }
        }
コード例 #8
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            bool hasAddTerms = binaryReader.ReadBoolean();
            bool hasMultTerms = binaryReader.ReadBoolean();
            uint nBits = binaryReader.ReadUBits(4);

            if (hasMultTerms)
            {
                redMultTerms = binaryReader.ReadSBits(nBits);
                greenMultTerms = binaryReader.ReadSBits(nBits);
                blueMultTerms = binaryReader.ReadSBits(nBits);
                alphaMultTerms = binaryReader.ReadSBits(nBits);
            }

            if (hasAddTerms)
            {
                redAddTerms = binaryReader.ReadSBits(nBits);
                greenAddTerms = binaryReader.ReadSBits(nBits);
                blueAddTerms = binaryReader.ReadSBits(nBits);
                alphaAddTerms = binaryReader.ReadSBits(nBits);
            }
        }