Decrease quality of image rendering on region capture but use high quality while rendering output image

This commit is contained in:
Jaex 2017-05-24 01:53:57 +03:00
parent 84d8997cfd
commit a79f44156f
3 changed files with 29 additions and 0 deletions

View file

@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ShareX.ScreenCaptureLib
{
@ -88,7 +89,18 @@ protected void DrawImage(Graphics g)
{
if (Image != null)
{
if (Manager.IsRenderingOutput)
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
}
else
{
g.InterpolationMode = InterpolationMode.NearestNeighbor;
}
g.DrawImage(Image, Rectangle);
g.InterpolationMode = InterpolationMode.Bilinear;
}
}

View file

@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ShareX.ScreenCaptureLib
{
@ -52,7 +53,18 @@ protected void DrawImage(Graphics g)
{
if (Image != null)
{
if (Manager.IsRenderingOutput)
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
}
else
{
g.InterpolationMode = InterpolationMode.NearestNeighbor;
}
g.DrawImage(Image, Rectangle);
g.InterpolationMode = InterpolationMode.Bilinear;
}
}

View file

@ -148,6 +148,7 @@ private set
public bool IsCornerMoving { get; private set; }
public bool IsProportionalResizing { get; private set; }
public bool IsSnapResizing { get; private set; }
public bool IsRenderingOutput { get; private set; }
private bool isEdited;
@ -938,6 +939,8 @@ public Image RenderOutputImage(Image img)
if (DrawingShapes.Length > 0 || EffectShapes.Length > 0)
{
IsRenderingOutput = true;
using (Graphics g = Graphics.FromImage(bmp))
{
foreach (BaseEffectShape shape in EffectShapes)
@ -956,6 +959,8 @@ public Image RenderOutputImage(Image img)
}
}
}
IsRenderingOutput = false;
}
return bmp;