Esempio n. 1
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(characterId);
            if (jpegData != null)
            {
                w.Write(Convert.ToUInt32(jpegData.Length));
            }
            else
            {
                w.Write((int)0);
            }
            if (jpegData != null)
            {
                w.Write(jpegData);
            }
            if (alphaData != null)
            {
                w.Write(alphaData);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Serializes the specified writer.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void Serialize(XmlWriter writer)
        {
            writer.WriteStartElement("ShapeWithStyle");
            base.SerializeBinarySize(writer);

            if (fillStyleArray != null)
            {
                fillStyleArray.Serialize(writer);
            }
            if (lineStyleArray != null)
            {
                lineStyleArray.Serialize(writer);
            }
            if (shapes != null)
            {
                ShapeWithStyle.NumFillBits = 0;
                ShapeWithStyle.NumLineBits = 0;
                if (fillStyleArray != null && fillStyleArray.Count != 0)
                {
                    ShapeWithStyle.NumFillBits = BufferedBinaryWriter.GetNumBits((uint)fillStyleArray.Count);
                }
                if (lineStyleArray != null && lineStyleArray.Count != 0)
                {
                    ShapeWithStyle.NumLineBits = BufferedBinaryWriter.GetNumBits((uint)lineStyleArray.Count);
                }

                shapes.Serialize(writer);

                ShapeWithStyle.NumFillBits = 0;
                ShapeWithStyle.NumLineBits = 0;
            }
            writer.WriteEndElement();
        }
Esempio n. 4
0
 /// <summary>
 /// Writes to a binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     writer.WriteUBits(0, 1);
     writer.WriteUBits((uint)red, 5);
     writer.WriteUBits((uint)green, 5);
     writer.WriteUBits((uint)blue, 5);
 }
        /// <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.WriteUBits(0, 4);
            w.WriteUBits(playbackSoundRate, 2);
            w.WriteUBits(playbackSoundSize, 1);
            w.WriteUBits(playbackSoundType, 1);
            w.SynchBits();
            w.WriteUBits(streamSoundCompression, 4);
            w.WriteUBits(streamSoundRate, 2);
            w.WriteUBits(streamSoundSize, 1);
            w.WriteUBits(streamSoundType, 1);

            w.Write(streamSoundSampleCount);
            if (streamSoundCompression == 2)
            {
                w.Write(latencySeek);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Esempio n. 6
0
        /// <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();
        }
Esempio n. 7
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.fontId);

            //TODO: calcule offset !!
            if (offsetTable != null)
            {
                IEnumerator offsets = offsetTable.GetEnumerator();
                while (offsets.MoveNext())
                {
                    w.Write((ushort)offsets.Current);
                }
            }

            ShapeWithStyle.NumFillBits = 0;
            ShapeWithStyle.NumLineBits = 0;
            glyphShapesTable.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Esempio n. 8
0
        /// <summary>
        /// Writes to binary writer.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            writer.WriteUBits(0, 2);
            writer.WriteBoolean(syncStop);
            writer.WriteBoolean(syncNoMultiple);
            writer.WriteBoolean(HasEnvelope);
            writer.WriteBoolean(HasLoops);
            writer.WriteBoolean(HasOutPoint);
            writer.WriteBoolean(HasInPoint);

            if (HasInPoint)
            {
                writer.Write(inPoint);
            }
            if (HasOutPoint)
            {
                writer.Write(outPoint);
            }
            if (HasLoops)
            {
                writer.Write(loopCount);
            }

            if (HasEnvelope)
            {
                writer.Write((byte)envelopeRecord.Count);
                IEnumerator envelopes = envelopeRecord.GetEnumerator();
                while (envelopes.MoveNext())
                {
                    ((SoundEnvelope)envelopes.Current).WriteTo(writer);
                }
            }
        }
Esempio n. 9
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();
        }
Esempio n. 10
0
        /// <summary>
        /// Gets the size of.
        /// </summary>
        /// <returns>Size of this object.</returns>
        public int GetSizeOf()
        {
            int res = 0;

            if (fillStyleArray != null)
            {
                res += fillStyleArray.GetSizeOf();
            }
            if (lineStyleArray != null)
            {
                res += lineStyleArray.GetSizeOf();
            }
            if (shapes != null)
            {
                ShapeWithStyle.NumFillBits = 0;
                ShapeWithStyle.NumLineBits = 0;
                if (fillStyleArray != null && fillStyleArray.Count != 0)
                {
                    ShapeWithStyle.NumFillBits = BufferedBinaryWriter.GetNumBits((uint)fillStyleArray.Count);
                }
                if (lineStyleArray != null && lineStyleArray.Count != 0)
                {
                    ShapeWithStyle.NumLineBits = BufferedBinaryWriter.GetNumBits((uint)lineStyleArray.Count);
                }
                res += shapes.GetSizeOf();
                ShapeWithStyle.NumFillBits = 0;
                ShapeWithStyle.NumLineBits = 0;
            }
            return(res);
        }
Esempio n. 11
0
 /// <summary>
 /// Writes to a binary writer.
 /// </summary>
 /// <param name="writer">Writer.</param>
 public void WriteTo(BufferedBinaryWriter writer)
 {
     if (fillStyleArray != null)
     {
         fillStyleArray.WriteTo(writer);
     }
     if (lineStyleArray != null)
     {
         lineStyleArray.WriteTo(writer);
     }
     if (shapes != null)
     {
         ShapeWithStyle.NumFillBits = 0;
         ShapeWithStyle.NumLineBits = 0;
         if (fillStyleArray != null && fillStyleArray.Count != 0)
         {
             ShapeWithStyle.NumFillBits = BufferedBinaryWriter.GetNumBits((uint)fillStyleArray.Count);
         }
         if (lineStyleArray != null && lineStyleArray.Count != 0)
         {
             ShapeWithStyle.NumLineBits = BufferedBinaryWriter.GetNumBits((uint)lineStyleArray.Count);
         }
         shapes.WriteTo(writer);
         ShapeWithStyle.NumFillBits = 0;
         ShapeWithStyle.NumLineBits = 0;
     }
 }
Esempio n. 12
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(version));

            rh.WriteTo(w);

            if (name != null)
            {
                w.WriteString(name, (uint)name.Length);
            }
            if (version >= 6)
            {
                w.Write((byte)1);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Esempio n. 13
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);
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Gets the num bits.
        /// </summary>
        /// <returns></returns>
        private uint GetNumBits()
        {
            uint res = 0;
            uint num = BufferedBinaryWriter.GetNumBits(xMin);

            if (num > res)
            {
                res = num;
            }
            num = BufferedBinaryWriter.GetNumBits(xMax);
            if (num > res)
            {
                res = num;
            }
            num = BufferedBinaryWriter.GetNumBits(yMin);
            if (num > res)
            {
                res = num;
            }
            num = BufferedBinaryWriter.GetNumBits(yMax);
            if (num > res)
            {
                res = num;
            }
            return(res);
        }
Esempio n. 15
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.buttonId);
            if (characters != null)
            {
                foreach (ButtonRecord buttRec in characters)
                {
                    buttRec.WriteTo(w, TagCodeEnum.DefineButton);
                }
            }
            byte end = 0;

            w.Write(end);
            if (actions != null)
            {
                w.Write(actions);
            }
            w.Write(end);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Esempio n. 16
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();
        }
Esempio n. 17
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);
                }
            }
        }
        /// <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();
        }
Esempio n. 19
0
        /// <summary>
        /// Gets the num bits.
        /// </summary>
        /// <returns></returns>
        private uint GetNumBits()
        {
            uint res = 0;
            uint tmp = 0;

            tmp = BufferedBinaryWriter.GetNumBits(controlDeltaX);
            if (tmp > res)
            {
                res = tmp;
            }
            tmp = BufferedBinaryWriter.GetNumBits(controlDeltaY);
            if (tmp > res)
            {
                res = tmp;
            }
            tmp = BufferedBinaryWriter.GetNumBits(anchorDeltaX);
            if (tmp > res)
            {
                res = tmp;
            }
            tmp = BufferedBinaryWriter.GetNumBits(anchorDeltaY);
            if (tmp > res)
            {
                res = tmp;
            }
            return(res);
        }
Esempio n. 20
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();
        }
Esempio n. 21
0
        /// <summary>
        /// Writes to.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            IEnumerator shorts = this.GetEnumerator();

            while (shorts.MoveNext())
            {
                writer.Write((short)shorts.Current);
            }
        }
        /// <summary>
        /// Writes to.
        /// </summary>
        /// <param name="writer">Writer.</param>
        public void WriteTo(BufferedBinaryWriter writer)
        {
            IEnumerator shapes = this.GetEnumerator();

            while (shapes.MoveNext())
            {
                ((ShapeRecordCollection)shapes.Current).WriteTo(writer);
            }
        }
Esempio n. 23
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);
        }
Esempio n. 24
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);
            }
        }
Esempio n. 25
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);
            }
        }
Esempio n. 26
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);
        }
Esempio n. 27
0
 /// <summary>
 /// Gets the rotate bits num.
 /// </summary>
 /// <returns></returns>
 private uint GetRotateBitsNum()
 {
     uint res = 0;
     uint tmp = 0;
     tmp = BufferedBinaryWriter.GetNumBits(matrix[1, 0]);
     if (tmp > res)
         res = tmp;
     tmp = BufferedBinaryWriter.GetNumBits(matrix[0, 1]);
     if (tmp > res)
         res = tmp;
     return res;
 }
Esempio n. 28
0
        /// <summary>
        /// Gets the num bits.
        /// </summary>
        /// <returns></returns>
        private uint GetNumBits()
        {
            uint max = 0;
            uint tmp = 0;

            if (HasMultTerms)
            {
                tmp = BufferedBinaryWriter.GetNumBits(redMultTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
                tmp = BufferedBinaryWriter.GetNumBits(greenMultTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
                tmp = BufferedBinaryWriter.GetNumBits(blueMultTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
                tmp = BufferedBinaryWriter.GetNumBits(alphaMultTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
            }
            if (HasAddTerms)
            {
                tmp = BufferedBinaryWriter.GetNumBits(redAddTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
                tmp = BufferedBinaryWriter.GetNumBits(greenAddTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
                tmp = BufferedBinaryWriter.GetNumBits(blueAddTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
                tmp = BufferedBinaryWriter.GetNumBits(alphaAddTerms);
                if (tmp > max)
                {
                    max = tmp;
                }
            }
            return(max);
        }
Esempio n. 29
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();
        }
Esempio n. 30
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, 0);

            rh.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }