public Bitmap GenerateBitmap() { if (Pixels == null || Width <= 0 || Height <= 0 || Width >= 2048 || Height >= 2048) { return(null); } Bitmap bmp = new Bitmap(Width, Height); FastPixel fp = new FastPixel(bmp); fp.Lock(); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { fp.SetPixel(x, y, Pixels[x + y * Width]); } } fp.Unlock(true); return(bmp); }
public static void initDrawingArea(int h, int w, Color[] _pixels) { pixels = new int[_pixels.Length]; for (int i = 0; i < pixels.Length; i++) pixels[i] = _pixels[i].ToArgb(); width = w; height = h; if (pixels != null && h > 0 && w > 0) { if (bmp == null || bmp.Width != width || bmp.Height != height) { bmp = new Bitmap(width, height); fp = new FastPixel(bmp); } } setDrawingArea(h, 0, w, 0); }
public Bitmap GenerateBitmap() { if (Pixels == null || Width <= 0 || Height <= 0 || Width >= 2048 || Height >= 2048) return null; Bitmap bmp = new Bitmap(Width, Height); FastPixel fp = new FastPixel(bmp); fp.Lock(); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { fp.SetPixel(x, y, Pixels[x + y * Width]); } } fp.Unlock(true); return bmp; }
public static void initDrawingArea(int i, int j, int[] pixels) { DrawingArea.pixels = pixels; width = j; height = i; if (pixels != null && i > 0 && j > 0) { if (bmp == null || bmp.Width != width || bmp.Height != height) { bmp = new Bitmap(width, height); fp = new FastPixel(bmp); } } setDrawingArea(i, 0, j, 0); }