public PngWriter(Stream outputStream, ImageInfo imgInfo,
String filename)
{
this.filename = (filename == null) ? "" : filename;
this.outputStream = outputStream;
this.ImgInfo = imgInfo;
// defaults settings
this.CompLevel = 6;
this.ShouldCloseStream = true;
this.IdatMaxSize = 0; // use default
this.CompressionStrategy = EDeflateCompressStrategy.Filtered;
// prealloc
//scanline = new int[imgInfo.SamplesPerRowPacked];
rowb = new byte[imgInfo.BytesPerRow + 1];
rowbprev = new byte[rowb.Length];
rowbfilter = new byte[rowb.Length];
chunksList = new ChunksListForWrite(ImgInfo);
metadata = new PngMetadata(chunksList);
filterStrat = new FilterWriteStrategy(ImgInfo, FilterType.FILTER_DEFAULT);
unpackedMode = false;
needsPack = unpackedMode && imgInfo.Packed;
}