dpi: add ScaleBitmap static method to DisplayHelper
This commit is contained in:
parent
a1c4d542e0
commit
d02e120386
|
@ -101,6 +101,17 @@ namespace OpenLiveWriter.CoreServices
|
|||
c.Scale(new SizeF((float)PixelsPerLogicalInchX / DEFAULT_DPI, (float)PixelsPerLogicalInchY / DEFAULT_DPI));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales a bitmap from 96dpi to the actual screen dpi.
|
||||
/// </summary>
|
||||
public static Bitmap ScaleBitmap(Bitmap original)
|
||||
{
|
||||
return new Bitmap(original, new Size(
|
||||
(int)Math.Ceiling(ScaleX(original.Width)),
|
||||
(int)Math.Ceiling(ScaleY(original.Height))
|
||||
));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When PMingLiU is rendered by GDI+ with StringFormat.LineAlignment == StringAlignment.Center
|
||||
/// with at least one Chinese character, it ends up 2-3 pixels higher than it should be.
|
||||
|
|
Loading…
Reference in New Issue