예제 #1
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);
        }
예제 #2
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);
        }
예제 #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);
        }