Merge pull request #6548 from L1Q/fix-dpi-changes

Use editor DPI when rendering final image
This commit is contained in:
Jaex 2022-10-12 20:47:57 +03:00 committed by GitHub
commit 325df2ea2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -884,6 +884,9 @@ protected override void OnPaint(PaintEventArgs e)
Graphics g = e.Graphics;
ShapeManager.CurrentDPI.X = g.DpiX;
ShapeManager.CurrentDPI.Y = g.DpiY;
ZoomTransform(g);
if (IsEditorMode && !CanvasRectangle.Contains(ClientArea))

View file

@ -146,6 +146,8 @@ public RectangleF CurrentRectangle
}
}
public PointF CurrentDPI = new PointF(96f, 96f);
public bool IsCurrentShapeValid => CurrentShape != null && CurrentShape.IsValidShape;
public BaseShape[] Regions => Shapes.OfType<BaseRegionShape>().ToArray();
@ -1366,6 +1368,7 @@ public Bitmap RenderOutputImage(Bitmap bmp)
public Bitmap RenderOutputImage(Bitmap bmp, PointF offset)
{
Bitmap bmpOutput = (Bitmap)bmp.Clone();
bmpOutput.SetResolution(CurrentDPI.X, CurrentDPI.Y);
if (DrawingShapes.Length > 0 || EffectShapes.Length > 0)
{