From 453ac850dcb35355396b8d57a556ba62f01acfbf Mon Sep 17 00:00:00 2001 From: Cole Tobin Date: Tue, 28 Dec 2021 11:00:54 -0500 Subject: [PATCH] Fix for oxyplot/oxyplot-avalonia#44 The `Resolution` property was not being considered at the very end. For example, if one doubles the `Width`, `Height`, and `Resolution` (to 1400x800 at 196ppi), the output PNG would be 1400x800, but the rendered chart would be 700x400 in the top-left corner of the PNG (with the rest transparent) --- Source/OxyPlot.Avalonia/PngExporter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/OxyPlot.Avalonia/PngExporter.cs b/Source/OxyPlot.Avalonia/PngExporter.cs index d92775e..ea34de6 100644 --- a/Source/OxyPlot.Avalonia/PngExporter.cs +++ b/Source/OxyPlot.Avalonia/PngExporter.cs @@ -118,9 +118,9 @@ public IBitmap ExportToBitmap(IPlotModel model) canvas.Measure(new Size(canvas.Width, canvas.Height)); canvas.Arrange(new Rect(0, 0, canvas.Width, canvas.Height)); - var bmp = new RenderTargetBitmap(new PixelSize(Width, Height)); + var bmp = new RenderTargetBitmap(new PixelSize(Width, Height), new Vector(Resolution, Resolution)); bmp.Render(canvas); return bmp; } } -} \ No newline at end of file +}