示例#1
0
 public PngWriter(Stream outputStream, ImageInfo imgInfo, string filename)
 {
     this.filename       = ((filename == null) ? "" : filename);
     this.outputStream   = outputStream;
     ImgInfo             = imgInfo;
     CompLevel           = 6;
     ShouldCloseStream   = true;
     IdatMaxSize         = 0;
     CompressionStrategy = EDeflateCompressStrategy.Filtered;
     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);
 }
示例#2
0
        public PngWriter( Stream outputStream, ImageInfo imgInfo,
				String filename )
        {
            this.filename = ( filename == null ) ? "" : filename;
            this.outputStream = outputStream;
            this.ImgInfo = imgInfo;
            this.CompLevel = 6;
            this.ShouldCloseStream = true;
            this.IdatMaxSize = 0;
            this.CompressionStrategy = EDeflateCompressStrategy.Filtered;
            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;
        }
示例#3
0
 /// <summary>
   /// Constructs a PngWriter from a outputStream, with optional filename or description
   /// </summary>
   /// <remarks>
   /// After construction nothing is writen yet. You still can set some
   /// parameters (compression, filters) and queue chunks before start writing the pixels.
   /// 
   /// See also <c>FileHelper.createPngWriter()</c>
   /// </remarks>
   /// <param name="outputStream">Opened stream for binary writing</param>
   /// <param name="imgInfo">Basic image parameters</param>
   /// <param name="filename">Optional, can be the filename or a description.</param>
   public PngWriter(Stream outputStream, ImageInfo imgInfo,
           String filename) {
       this.filename = filename == null ? "" : filename;
       this.outputStream = outputStream;
       ImgInfo = imgInfo;
       // defaults settings
       CompLevel = 6;
       ShouldCloseStream = true;
       IdatMaxSize = 0; // use default
       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;
   }
示例#4
0
 public void SetFilterType( FilterType filterType )
 {
     filterStrat = new FilterWriteStrategy ( ImgInfo, filterType );
 }
示例#5
0
 /// <summary>
 /// Sets internal prediction filter type, or strategy to choose it.
 /// </summary>
 /// <remarks>
 /// This must be called just after constructor, before starting writing.
 ///
 /// Recommended values: DEFAULT (default) or AGGRESIVE
 /// </remarks>
 /// <param name="filterType">One of the five prediction types or strategy to choose it</param>
 public void SetFilterType(FilterType filterType)
 {
     filterStrat = new FilterWriteStrategy(ImgInfo, filterType);
 }