示例#1
0
        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
            };
        }
示例#2
0
        public override void Dispose()
        {
            _canvas = null;

            if (_bitmap != null && _disposeBitmap)
            {
                _bitmap.Dispose();
                _bitmap = null;
            }

            base.Dispose();
        }