/// <summary> /// Creates a new, blank BitmapGdi with the specified width and height. The pixel format is fixed: 32bppArgb, aka Bgra32. /// </summary> public BitmapGdi(int width, int height) { Width = width; Height = height; Stride = width * 4 + (16 - (width * 4) % 16) % 16; // pad to 16 bytes _bytes = new SharedPinnedByteArray(Stride * Height); Bitmap = new D.Bitmap(Width, Height, Stride, D.Imaging.PixelFormat.Format32bppArgb, _bytes.Address); Bitmap.SetResolution(96, 96); }
/// <summary>Disposes of the underlying resources.</summary> public override void Dispose() { if (Bitmap != null) { Bitmap.Dispose(); Bitmap = null; } if (_bytes != null) { _bytes.ReleaseReference(); _bytes = null; } base.Dispose(); }
/// <summary>Disposes of the underlying resources.</summary> public override void Dispose() { if (Bitmap != null) { Bitmap.Dispose(); Bitmap = null; } if (_bytes != null) { _bytes.ReleaseReference(); _bytes = null; } base.Dispose(); }
/// <summary> /// Creates a new, blank BitmapGdi with the specified width and height. The pixel format is fixed: 32bppArgb, aka Bgra32. /// </summary> public BitmapGdi(int width, int height) { Width = width; Height = height; Stride = width * 4 + (16 - (width * 4) % 16) % 16; // pad to 16 bytes _bytes = new SharedPinnedByteArray(Stride * Height); Bitmap = new D.Bitmap(Width, Height, Stride, D.Imaging.PixelFormat.Format32bppArgb, _bytes.Address); Bitmap.SetResolution(96, 96); }