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