渲染目标位图出现错误内存不足
本文关键字:错误 内存不足 位图 目标 | 更新日期: 2023-09-27 18:32:25
当我尝试使用 canvas(10000 X 10000) 分辨率
渲染图像(10000 X 10000) 分辨率时,我遇到内存不足异常。
bmp = new RenderTargetBitmap((int)width, (int(height),graphics.DpiX,graphics.DpiY,PixelFormats.Default)bmp.Render(vs);
dc.PushTransform(new TranslateTransform(difX + left - horizontalScale, difY + top - verticalScale));
dc.PushTransform(new ScaleTransform(1, 1));
// Ask canvas to draw overlays
drawingCanvas.Draw(dc);
// Restore old actual scale.
drawingCanvas.ActualScale = oldActualScale;
// Restore clip
drawingCanvas.RefreshClip();
dc.Pop();
dc.Pop();
dc.Pop();
dc.Close();
width = (Utilityhelper.GetDIPIndependentHorizontal(rect.Width));
height = (Utilityhelper.GetDIPIndependentVertical(rect.Height));
bmp = new RenderTargetBitmap((int)width, (int)(height), Utilityhelper.graphics.DpiX, Utilityhelper.graphics.DpiY, PixelFormats.Default);
if (bmp != null)
{
bmp.Render(vs);
}
完成使用这个....DecodePixelWidth & DecodePixelHeight http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.decodepixelwidth(v=vs.110).aspx