コード例 #1
0
        /// <summary>
        /// Gets the frame as PNG FileStream.
        /// </summary>
        public MemoryStream GetStream()
        {
            var ihdrChunk = new IHDRChunk(IHDRChunk);

            if (fcTLChunk != null)
            {
                // Fix frame size with fcTL data.
                ihdrChunk.ModifyChunkData(0, Helper.ConvertEndian(fcTLChunk.Width));
                ihdrChunk.ModifyChunkData(4, Helper.ConvertEndian(fcTLChunk.Height));
            }

            // Write image data
            using (var ms = new MemoryStream())
            {
                ms.WriteBytes(Signature);
                ms.WriteBytes(ihdrChunk.RawData);

                foreach (IDATChunk idatChunk in idatChunks)
                {
                    ms.WriteBytes(idatChunk.RawData);
                }

                foreach (ITextChunk chunk in TextChunks)
                {
                    ms.WriteBytes((chunk as Chunk).RawData);
                }

                ms.WriteBytes(IENDChunk.RawData);

                ms.Position = 0;
                return(ms);
            }
        }
コード例 #2
0
ファイル: Frame.cs プロジェクト: mwheeler/APNG.NET
        /// <summary>
        /// Gets the frame as PNG FileStream.
        /// </summary>
        public MemoryStream GetStream()
        {
            var ihdrChunk = new IHDRChunk(IHDRChunk);
            if (fcTLChunk != null)
            {
                // Fix frame size with fcTL data.
                ihdrChunk.ModifyChunkData(0, Helper.ConvertEndian(fcTLChunk.Width));
                ihdrChunk.ModifyChunkData(4, Helper.ConvertEndian(fcTLChunk.Height));
            }

            // Write image data
            using (var ms = new MemoryStream())
            {
                ms.WriteBytes(Signature);
                ms.WriteBytes(ihdrChunk.RawData);

                foreach (IDATChunk idatChunk in idatChunks)
                    ms.WriteBytes(idatChunk.RawData);

                foreach (ITextChunk chunk in TextChunks)
                    ms.WriteBytes((chunk as Chunk).RawData);

                ms.WriteBytes(IENDChunk.RawData);

                ms.Position = 0;
                return ms;
            }
        }
コード例 #3
0
ファイル: Frame.cs プロジェクト: xupefei/APNG.NET
        /// <summary>
        ///     Gets the frame as PNG FileStream.
        /// </summary>
        public MemoryStream GetStream()
        {
            var ihdrChunk = new IHDRChunk(IHDRChunk);
            if (fcTLChunk != null)
            {
                // Fix frame size with fcTL data.
                ihdrChunk.ModifyChunkData(0, Helper.ConvertEndian(fcTLChunk.Width));
                ihdrChunk.ModifyChunkData(4, Helper.ConvertEndian(fcTLChunk.Height));
            }

            // Write image data
            using (var ms = new MemoryStream())
            {
                ms.WriteBytes(Signature);
                ms.WriteBytes(ihdrChunk.RawData);
                otherChunks.ForEach(o => ms.WriteBytes(o.RawData));
                idatChunks.ForEach(i => ms.WriteBytes(i.RawData));
                ms.WriteBytes(IENDChunk.RawData);

                ms.Position = 0;
                return ms;
            }
        }
コード例 #4
0
ファイル: Frame.cs プロジェクト: sniperykun/APNG.NET
        /// <summary>
        ///     Gets the frame as PNG FileStream.
        /// </summary>
        public MemoryStream GetStream()
        {
            var ihdrChunk = new IHDRChunk(IHDRChunk);

            if (fcTLChunk != null)
            {
                // Fix frame size with fcTL data.
                ihdrChunk.ModifyChunkData(0, Helper.ConvertEndian(fcTLChunk.Width));
                ihdrChunk.ModifyChunkData(4, Helper.ConvertEndian(fcTLChunk.Height));
            }

            // Write image data
            using (var ms = new MemoryStream())
            {
                ms.WriteBytes(Signature);
                ms.WriteBytes(ihdrChunk.RawData);
                otherChunks.ForEach(o => ms.WriteBytes(o.RawData));
                idatChunks.ForEach(i => ms.WriteBytes(i.RawData));
                ms.WriteBytes(IENDChunk.RawData);

                ms.Position = 0;
                return(ms);
            }
        }