/// <summary> /// Creates a new, blank BytesBitmap with the specified width, height, and pixel format. /// </summary> public BytesBitmap(int width, int height, PixelFormat format) { _pixelFormatSize = Image.GetPixelFormatSize(format); _stride = width * _pixelFormatSize / 8; int padding = _stride % 4; _stride += (padding == 0) ? 0 : 4 - padding; _bytes = new SharedPinnedByteArray(_stride * height); _bitmap = new Bitmap(width, height, _stride, format, _bytes.Address); }
/// <summary> /// Creates a new, blank BytesBitmap with the specified width, height, and pixel format. /// </summary> public BytesBitmap(int width, int height, PixelFormat format) { _pixelFormatSize = Image.GetPixelFormatSize(format); _stride = width * _pixelFormatSize / 8; int padding = _stride % 4; _stride += (padding == 0) ? 0 : 4 - padding; _bytes = new SharedPinnedByteArray(_stride * height); _bitmap = new Bitmap(width, height, _stride, format, _bytes.Address); }