public GDIBitmapExportContext(int width, int height, float displayScale = 1, int dpi = 72, bool disposeBitmap = true) : base(width, height, dpi) { _disposeBitmap = disposeBitmap; _bitmap = new Bitmap(width, height); _canvas = new GDICanvas { Graphics = System.Drawing.Graphics.FromImage(_bitmap), DisplayScale = displayScale }; }
public override void Dispose() { _canvas = null; if (_bitmap != null && _disposeBitmap) { _bitmap.Dispose(); _bitmap = null; } base.Dispose(); }