BufferedBinaryWriter class. This class extends a binaryWriter to provide the way to read bit per bit a binary stream. This class use a buffer to do it. ATTENTION: By default, this writer works with LittleEndian mode (for x86).
Inheritance: System.IO.BinaryWriter
示例#1
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            if (Meta != null)
                w.Write(Meta);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#2
0
        /// <summary>
        /// Writes to a binary writer.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            writer.SynchBits();

            writer.WriteBoolean(true);
            writer.WriteUBits(0, 3);

            bool styleFlagsHasFont = HasFont();
            bool styleFlagsHasColor = HasColor();
            bool styleFlagsHasYOffset = HasYOffset();
            bool styleFlagsHasXOffset = HasXOffset();

            writer.WriteBoolean(styleFlagsHasFont);
            writer.WriteBoolean(styleFlagsHasColor);
            writer.WriteBoolean(styleFlagsHasYOffset);
            writer.WriteBoolean(styleFlagsHasXOffset);

            if (styleFlagsHasFont)
                writer.Write(this.fontId);

            if (styleFlagsHasColor)
                this.textColor.WriteTo(writer);
            if (styleFlagsHasXOffset)
                writer.Write(this.xOffset);
            if (styleFlagsHasYOffset)
                writer.Write(this.yOffset);
            if (styleFlagsHasFont)
                writer.Write(this.textHeight);
            writer.Write((byte)this.glyphEntries.Count);

            if (this.glyphEntries != null)
            {
                IEnumerator glyphs = this.glyphEntries.GetEnumerator();
                while (glyphs.MoveNext())
                    ((GlyphEntry)glyphs.Current).WriteTo(writer);
            }
        }
示例#3
0
 /// <summary>
 /// Writes to a binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public virtual void WriteTo(BufferedBinaryWriter writer)
 {
     writer.WriteBoolean(typeFlag);
 }
示例#4
0
 /// <summary>
 /// Writes to.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public override void WriteTo(BufferedBinaryWriter writer)
 {
     base.WriteTo(writer);
     writer.WriteBoolean(this.straightFlag);
 }
示例#5
0
        /// <summary>
        /// Writes to.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public override void WriteTo(BufferedBinaryWriter writer)
        {
            base.WriteTo(writer);
            bool stateNewStyle = HasNewStyle();
            bool stateLineStyle = HasLineStyle();
            bool stateFillStyle0 = HasFillStyle0();
            bool stateFillStyle1 = HasFillStyle1();
            bool stateMoveTo = HasMoveTo();

            writer.WriteBoolean(stateNewStyle);
            writer.WriteBoolean(stateLineStyle);
            writer.WriteBoolean(stateFillStyle1);
            writer.WriteBoolean(stateFillStyle0);
            writer.WriteBoolean(stateMoveTo);

            if (stateMoveTo)
            {
                uint moveBitsNum = GetMoveNumBits();
                writer.WriteUBits(moveBitsNum, 5);
                writer.WriteSBits(moveDeltaX, moveBitsNum);
                writer.WriteSBits(moveDeltaY, moveBitsNum);
            }

            if (stateFillStyle0)
            {
                writer.WriteUBits((uint)fillStyle0, ShapeWithStyle.NumFillBits);
            }
            if (stateFillStyle1)
            {
                writer.WriteUBits((uint)fillStyle1, ShapeWithStyle.NumFillBits);
            }
            if (stateLineStyle)
            {
                writer.WriteUBits((uint)lineStyle, ShapeWithStyle.NumLineBits);
            }

            if (stateNewStyle)
            {
                fillStyles.WriteTo(writer);
                lineStyles.WriteTo(writer);
                ShapeWithStyle.NumFillBits = BufferedBinaryWriter.GetNumBits((uint)fillStyles.Count);
                ShapeWithStyle.NumLineBits = BufferedBinaryWriter.GetNumBits((uint)lineStyles.Count);
                writer.WriteUBits(ShapeWithStyle.NumFillBits, 4);
                writer.WriteUBits(ShapeWithStyle.NumLineBits, 4);
            }
        }
示例#6
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.Write(this.soundId);
            w.WriteUBits(soundFormat, 4);
            w.WriteUBits(soundRate, 2);
            w.WriteUBits(soundSize, 1);
            w.WriteUBits(soundType, 1);

            w.Write(this.soundSampleCount);
            if (soundData != null)
                w.Write(this.soundData);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#7
0
        /// <summary>
        /// Writes to a binary writer.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            int count = this.Count;
            if (count < 0xFF)
                writer.Write((byte)count);
            else
            {
                writer.Write((byte)(0xFF));
                writer.Write((ushort)count);
            }

            IEnumerator fillStyles = this.GetEnumerator();
            while (fillStyles.MoveNext())
                ((FillStyle)fillStyles.Current).WriteTo(writer);
        }
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
                return;

            // Compression process
            int lenghtOfCompressedBlock = 0;
            byte[] compressArray = null;
            MemoryStream unCompressedStream = new MemoryStream();
            BufferedBinaryWriter unCompressedWriter = new BufferedBinaryWriter(unCompressedStream);

            if (this._bitmapFormat == 3)
            {
                this._colorMapData.WriteTo(unCompressedWriter);
            }
            else if (this._bitmapFormat == 4 || this._bitmapFormat == 5)
            {
                this._bitmapColorData.WriteTo(unCompressedWriter);
            }

            MemoryStream compressedStream = new MemoryStream();
            DeflaterOutputStream ouput = new DeflaterOutputStream(compressedStream);
            byte[] unCompressArray = unCompressedStream.ToArray();
            ouput.Write(unCompressArray, 0, unCompressArray.Length);
            ouput.Finish();
            compressArray = compressedStream.ToArray();
            lenghtOfCompressedBlock = compressArray.Length;
            ouput.Close();
            unCompressedStream.Close();

            //Writing process
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf(lenghtOfCompressedBlock));

            rh.WriteTo(w);
            w.Write(this._characterId);
            w.Write(this._bitmapFormat);
            w.Write(this._bitmapWidth);
            w.Write(this._bitmapHeight);

            if (this._bitmapFormat == 3)
            {
                w.Write(this._bitmapColorTableSize);
                w.Write(compressArray);
            }
            else if (this._bitmapFormat == 4 || this._bitmapFormat == 5)
            {
                w.Write(compressArray);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#9
0
 /// <summary>
 /// Writes to.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     writer.Write((ushort)this.Count);
     IEnumerator kernings = this.GetEnumerator();
     while (kernings.MoveNext())
         ((KerningRecord)kernings.Current).WriteTo(writer);
 }
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);

            w.Write(this.buttonSoundChar);
            if (buttonSoundChar != 0 && buttonSoundInfo != null)
                buttonSoundInfo.WriteTo(w);

            w.Write(this.buttonSoundChar1);
            if (buttonSoundChar1 != 0 && buttonSoundInfo1 != null)
                buttonSoundInfo1.WriteTo(w);

            w.Write(this.buttonSoundChar2);
            if (buttonSoundChar2 != 0 && buttonSoundInfo2 != null)
                buttonSoundInfo2.WriteTo(w);

            w.Write(this.buttonSoundChar3);
            if (buttonSoundChar3 != 0 && buttonSoundInfo3 != null)
                buttonSoundInfo3.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 6)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.Write(this.characterId);
            w.Write(this.numFrames);
            w.Write(this.width);
            w.Write(this.height);

            w.WriteUBits(0, 5);
            w.WriteUBits(videoFlagsDeblocking, 2);
            w.WriteBoolean(videoFlagsSmoothing);

            w.Write(this.codecId);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#12
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.Write(characterId);
            w.Write(depth);
            if (this.matrix != null)
                this.matrix.WriteTo(w);
            if (this.colorTransform != null)
                this.colorTransform.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#13
0
        /// <summary>
        /// Writes to.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            char[] codes = GetOrderedCodes();
            ShapeRecordCollection[] glyphs = GetOrderedGlyphs(codes);

            ShapeWithStyle.NumFillBits = 0;
            ShapeWithStyle.NumLineBits = 0;

            IEnumerator glyphsEnum = glyphs.GetEnumerator();
            while (glyphsEnum.MoveNext())
            {
                ShapeWithStyle.NumFillBits = 1;
                ((ShapeRecordCollection)glyphsEnum.Current).WriteTo(writer);
            }

            IEnumerator chars = codes.GetEnumerator();
            while (chars.MoveNext())
            {
                char c = (char)chars.Current;
                if (isWideCodes)
                    writer.Write((ushort)c);
                else
                    writer.Write((byte)c);
            }
        }
示例#14
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, 4);
            rh.WriteTo(w);

            w.Write(characterId);
            w.Write(depth);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#15
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();
        }
示例#16
0
        /// <summary>
        /// Writes to a binary writer.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            writer.SynchBits();
            writer.WriteUBits(ShapeWithStyle.NumFillBits, 4);
            writer.WriteUBits(ShapeWithStyle.NumLineBits, 4);

            ShapeRecord lastShape = this.GetLastOne();
            if (lastShape != null && !(lastShape is EndShapeRecord))
                this.Add(new EndShapeRecord());

            IEnumerator shapes = this.GetEnumerator();
            while (shapes.MoveNext())
                ((ShapeRecord)shapes.Current).WriteTo(writer);
        }
示例#17
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);
            w.WriteUBits(0, 7);
            w.WriteBoolean(trackAsMenu);
            w.Write(this.actionOffset);
            if (characters != null)
            {
                IEnumerator butts = characters.GetEnumerator();
                while (butts.MoveNext())
                {
                    ((ButtonRecord)butts.Current).WriteTo(w, TagCodeEnum.DefineButton2);
                    w.SynchBits();
                }
            }
            w.Write((byte)0);
            if (actions != null)
            {
                for (int i = 0; i < actions.Count; i++)
                {
                    ButtonCondaction buttCon = actions[i];
                    if (i == actions.Count - 1)
                        w.Write((ushort)0);
                    else
                    {
                        int size = buttCon.GetSizeOf();
                        w.Write((ushort)size);
                    }
                    buttCon.WriteTo(w);
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#18
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 7)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, 4);

            rh.WriteTo(w);
            w.Write(recursion);
            w.Write(timeout);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#19
0
        /// <summary>
        /// Writes to a binary writer.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            writer.Write(this.fillStyleType);

            if (fillStyleType == (byte)FillStyleType.SolidFill && rgbColor != null)
                rgbColor.WriteTo(writer);

            if (fillStyleType == (byte)FillStyleType.RadialGradientFill ||
                fillStyleType == (byte)FillStyleType.LinearGradientFill)
            {
                if (gradientMatrix != null)
                    gradientMatrix.WriteTo(writer);
                if (gradient != null)
                    gradient.WriteTo(writer);
            }

            if (fillStyleType == (byte)FillStyleType.RepeatingBitmapFill ||
                fillStyleType == (byte)FillStyleType.ClippedBitmapFill ||
                fillStyleType == (byte)FillStyleType.NonSmoothedClippedBitmap ||
                fillStyleType == (byte)FillStyleType.NonSmoothedRepeatingBitmap)
            {
                writer.Write(this.bitmapId);
                if (this.bitmapMatrix != null)
                    this.bitmapMatrix.WriteTo(writer);
            }
        }
示例#20
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 5)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            if (exportedCharacters != null)
                w.Write((ushort)exportedCharacters.Count);
            else
                w.Write((ushort)0);

            if (exportedCharacters != null)
            {
                IEnumerator assertEnu = exportedCharacters.GetEnumerator();
                while (assertEnu.MoveNext())
                {
                    Assert assert = (Assert)assertEnu.Current;
                    assert.WriteTo(w);
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#21
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.characterId);

            w.SynchBits();
            if (this.startBounds != null)
                this.startBounds.WriteTo(w);
            w.SynchBits();
            if (this.endBounds != null)
                this.endBounds.WriteTo(w);

            w.Write(this.offset);
            if (this.morphFillStyles != null)
                this.morphFillStyles.WriteTo(w);
            if (this.morphLineStyles != null)
                this.morphLineStyles.WriteTo(w);

            ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count;
            ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count;

            if (this.startEdges != null)
                this.startEdges.WriteTo(w);
            if (this.endEdges != null)
                this.endEdges.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
示例#22
0
 /// <summary>
 /// Writes to a binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     writer.Write(this.fillStyleType);
     if (fillStyleType == (byte)MorphFillStyleType.SolidFill)
     {
         if (startColor != null)
             this.startColor.WriteTo(writer);
         if (endColor != null)
             this.endColor.WriteTo(writer);
     }
     if (fillStyleType == (byte)MorphFillStyleType.LinearGradientFill ||
         fillStyleType == (byte)MorphFillStyleType.RadialGradientFill)
     {
         if (startGradientMatrix != null)
             startGradientMatrix.WriteTo(writer);
         if (endGradientMatrix != null)
             endGradientMatrix.WriteTo(writer);
         if (gradient != null)
             gradient.WriteTo(writer);
     }
     if (fillStyleType == (byte)MorphFillStyleType.LinearGradientFill ||
         fillStyleType == (byte)MorphFillStyleType.RadialGradientFill ||
         fillStyleType == (byte)MorphFillStyleType.RadialGradientFill ||
         fillStyleType == (byte)MorphFillStyleType.RadialGradientFill)
     {
         writer.Write(this.bitmapId);
         if (startBitmapMatrix != null)
             startBitmapMatrix.WriteTo(writer);
         if (endBitmapMatrix != null)
             endBitmapMatrix.WriteTo(writer);
     }
 }
示例#23
0
        /// <summary>
        /// Writes the (compressed or uncompressed) swf data to a stream.
        /// The stream gets flushed and closed afterwards.
        /// </summary>
        /// <param name="swf">Swf</param>
        public void Write(Swf swf)
        {
            if (swf == null)
                return;

            // add EndTag is is not the last one
            BaseTag lastTag = swf.Tags.GetLastOne();
            if (lastTag == null || !(lastTag is EndTag))
                swf.Tags.Add(new EndTag());

            // update tag lengths to adapt to bytecode length
            swf.UpdateData();
            SwfHeader header = swf.Header;

            // ASCII seems to be ok for Flash 5 and 6+ as well
            BufferedBinaryWriter writer = new BufferedBinaryWriter(baseStream, System.Text.Encoding.GetEncoding("ascii"));
            BufferedBinaryWriter dataWriter = writer;

            bool isCompressed = (header.Signature[0] == 'C');

            if (isCompressed && swf.Version >= 6)
            {
                // SharpZipLib makes it easy for us, simply
                // chain a Deflater into the stream
                DeflaterOutputStream def = new DeflaterOutputStream(baseStream);
                dataWriter = new BufferedBinaryWriter(def);
            }

            // writer header data, always uncompressed
            writer.WriteString(header.Signature, 3);
            writer.Write(swf.Version);
            writer.Write(swf.ByteCount);
            writer.Flush();

            // write header data pt.2, using either
            // original stream or deflater stream
            header.Size.WriteTo(dataWriter);
            dataWriter.SynchBits();
            dataWriter.WriteFWord(header.Fps, 8, 8);
            dataWriter.Write(header.Frames);

            // write tags data
            IEnumerator tags = swf.Tags.GetEnumerator();
            while (tags.MoveNext())
            {
                BaseTag tagToWrite = (BaseTag)tags.Current;
                dataWriter.Write(tagToWrite.Data);
            }

            // flush + close
            dataWriter.Flush();
            dataWriter.Close();
        }
示例#24
0
 /// <summary>
 /// Writes to binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     int count = this.Count;
     if (count < 0xFF)
         writer.Write((byte)count);
     else
     {
         writer.Write((byte)(0xFF));
         writer.Write((ushort)count);
     }
     foreach (MorphFillStyle mFillStyle in this)
         mFillStyle.WriteTo(writer);
 }
示例#25
0
 /// <summary>
 /// Writes to a binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public override void WriteTo(BufferedBinaryWriter writer)
 {
     base.WriteTo(writer);
     uint numBits = GetNumBits();
     writer.WriteUBits(numBits - 2, 4);
     writer.WriteSBits(controlDeltaX, numBits);
     writer.WriteSBits(controlDeltaY, numBits);
     writer.WriteSBits(anchorDeltaX, numBits);
     writer.WriteSBits(anchorDeltaY, numBits);
 }
示例#26
0
 /// <summary>
 /// Writes to a binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     uint nBits = GetNumBits();
     writer.WriteUBits(nBits, 5);
     writer.WriteSBits(xMin, nBits);
     writer.WriteSBits(xMax, nBits);
     writer.WriteSBits(yMin, nBits);
     writer.WriteSBits(yMax, nBits);
 }
示例#27
0
 /// <summary>
 /// Writes to.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public override void WriteTo(BufferedBinaryWriter writer)
 {
     base.WriteTo(writer);
     writer.WriteUBits(0, 5);
 }
示例#28
0
 /// <summary>
 /// Writes to.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     IEnumerator rects = this.GetEnumerator();
     while (rects.MoveNext())
     {
         writer.SynchBits();
         ((Rect)rects.Current).WriteTo(writer);
     }
 }
示例#29
0
        /// <summary>
        /// Writes to.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public override void WriteTo(BufferedBinaryWriter writer)
        {
            base.WriteTo(writer);
            uint numBits = GetNumBits();
            writer.WriteUBits(numBits - 2, 4);

            bool generalLineFlag = HasGeneralLine();
            writer.WriteBoolean(generalLineFlag);

            if (generalLineFlag)
            {
                writer.WriteSBits(deltaX, numBits);
                writer.WriteSBits(deltaY, numBits);
            }
            else
            {
                bool vertLineFlag = HasVerticalLine();
                writer.WriteBoolean(vertLineFlag);
                if (!vertLineFlag)
                    writer.WriteSBits(deltaX, numBits);
                else
                    writer.WriteSBits(deltaY, numBits);
            }
        }
示例#30
0
 /// <summary>
 /// Writes to.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     writer.WriteUBits(glyphIndex, TextRecordCollection.GLYPH_BITS);
     writer.WriteSBits(glyphAdvance, TextRecordCollection.ADVANCE_BITS);
 }