Пример #1
0
		/// <summary>
		/// Writes to.
		/// </summary>
		/// <param name="binaryWriter">Binary writer.</param>
		public void WriteTo(BufferedBinaryWriter binaryWriter)
		{
            binaryWriter.SynchBits();
            bool hasScale = HasScale();
            bool hasRotate = HasRotate();

            binaryWriter.WriteBoolean(hasScale);
            if (hasScale)
            {
                uint nScaleBits = GetScaleBitsNum();
                binaryWriter.WriteUBits(nScaleBits, 5);
                binaryWriter.WriteFBits(matrix[0, 0], nScaleBits);
                binaryWriter.WriteFBits(matrix[1, 1], nScaleBits);
            }

            binaryWriter.WriteBoolean(hasRotate);
            if (hasRotate)
            {
                uint nRotateBits = GetRotateBitsNum();
                binaryWriter.WriteUBits(nRotateBits, 5);
                binaryWriter.WriteFBits(matrix[1, 0], nRotateBits);
                binaryWriter.WriteFBits(matrix[0, 1], nRotateBits);
            }
            
            uint nTranslateBits = GetTranslateBitsNum();
            binaryWriter.WriteUBits(nTranslateBits, 5);
            binaryWriter.WriteSBits((int)matrix[0, 2], nTranslateBits);
            binaryWriter.WriteSBits((int)matrix[1, 2], nTranslateBits);
            binaryWriter.SynchBits();
        }