0

我正在尝试捕获我的 WPF Viewport3D,问题是无论我做什么都不能以高质量捕获,RenderTargetBitmap 的参数应该是什么以获得最佳质量?

 RenderTargetBitmap bmp = new RenderTargetBitmap(
                          (int)viewport3D.ActualWidth, (int)viewport3D.ActualHeight, 96, 96, PixelFormats.Pbgra32);

bmp.Render(viewport3D);
PngBitmapEncoder png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(bmp));

using (Stream stm = File.Create(m_captureWithoutMainModelFileName))
{
   png.Save(stm);
}

我也尝试将图像另存为 BMP,但它并没有提高质量。

4

1 回答 1

0

也许您的问题是 Dpi 设置为 96,96。在高分辨率屏幕上,Vista/7 不再是这种情况。

PresSource = PresentationSource.FromVisual( TheViewPort3D );
dpiX = 96 * PresSource.CompositionTarget.TransformToDevice.M11;  
dpiY = 96 * PresSource.CompositionTarget.TransformToDevice.M22;
于 2012-07-16T09:46:03.953 回答