Ejemplo n.º 1
0
        public static Stream WriteSingleImageToPngStream(this IColorFetchingIterator colorFetchingIterator, IPixelOrderIterator pixelOrderIterator, uint width, uint height)
        {
            MemoryStream s = new MemoryStream();

            colorFetchingIterator.ConvertToBitmap(pixelOrderIterator, width, height).Save(s, System.Drawing.Imaging.ImageFormat.Png);
            return(s);
        }
Ejemplo n.º 2
0
        public static Bitmap ConvertToBitmap(this IColorFetchingIterator colorFetchingIterator, IPixelOrderIterator pixelOrderIterator, uint width, uint height)
        {
            var bitmap = new System.Drawing.Bitmap((int)width, (int)height);

            foreach (var cxy in new ColorPositionFetcher(colorFetchingIterator, pixelOrderIterator))
            {
                bitmap.SetPixel(cxy.X, cxy.Y, cxy.Color);
            }
            return(bitmap);
        }
Ejemplo n.º 3
0
        public static Stream WriteSingleImageToPngStream(this IColorFetchingIterator colorFetchingIterator, IPixelOrderIterator pixelOrderIterator, uint width, uint height)
        {
            var bitmap = new System.Drawing.Bitmap((int)width, (int)height);

            foreach (Color c in colorFetchingIterator)
            {
                bitmap.SetPixel(pixelOrderIterator.X, pixelOrderIterator.Y, c);
                pixelOrderIterator.Next();
            }

            MemoryStream s = new MemoryStream();

            bitmap.Save(s, System.Drawing.Imaging.ImageFormat.Png);
            return(s);
        }
Ejemplo n.º 4
0
 public ColorFetcherIndexed4Bits(Stream stream, long width, long height, IColorFetchingIterator colorConverter)
 {
     SourceStream = stream;
     PixelCount   = width * height;
     colors       = colorConverter.ToArray();
 }