Skip to content

Commit 4d996f9

Browse files
Fix incorrect export resolution (#45)
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)
1 parent b342491 commit 4d996f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/OxyPlot.Avalonia/PngExporter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ public IBitmap ExportToBitmap(IPlotModel model)
118118
canvas.Measure(new Size(canvas.Width, canvas.Height));
119119
canvas.Arrange(new Rect(0, 0, canvas.Width, canvas.Height));
120120

121-
var bmp = new RenderTargetBitmap(new PixelSize(Width, Height));
121+
var bmp = new RenderTargetBitmap(new PixelSize(Width, Height), new Vector(Resolution, Resolution));
122122
bmp.Render(canvas);
123123
return bmp;
124124
}
125125
}
126-
}
126+
}

0 commit comments

Comments
 (0)