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