/// <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); } }
/// <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; } }
/// <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; } }
/// <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); } }