Fix OnDrawFinal issues

This commit is contained in:
Jaex 2017-11-14 15:15:28 +03:00
parent 18cbe0b72c
commit d3295a412a
3 changed files with 21 additions and 15 deletions

View file

@ -77,14 +77,16 @@ public override void OnDrawFinal(Graphics g, Bitmap bmp)
{ {
if (BlurRadius > 1) if (BlurRadius > 1)
{ {
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); Rectangle rect = Rectangle.Intersect(new Rectangle(0, 0, bmp.Width, bmp.Height), Rectangle);
rect.Intersect(Rectangle);
using (Bitmap croppedImage = ImageHelpers.CropBitmap(bmp, rect)) if (!rect.IsEmpty)
{ {
ApplyEffect(croppedImage); using (Bitmap croppedImage = ImageHelpers.CropBitmap(bmp, rect))
{
ApplyEffect(croppedImage);
g.DrawImage(croppedImage, rect); g.DrawImage(croppedImage, rect);
}
} }
} }
} }

View file

@ -75,14 +75,16 @@ public override void OnDrawOverlay(Graphics g)
public override void OnDrawFinal(Graphics g, Bitmap bmp) public override void OnDrawFinal(Graphics g, Bitmap bmp)
{ {
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); Rectangle rect = Rectangle.Intersect(new Rectangle(0, 0, bmp.Width, bmp.Height), Rectangle);
rect.Intersect(Rectangle);
using (Bitmap croppedImage = ImageHelpers.CropBitmap(bmp, rect)) if (!rect.IsEmpty)
{ {
ApplyEffect(croppedImage); using (Bitmap croppedImage = ImageHelpers.CropBitmap(bmp, rect))
{
ApplyEffect(croppedImage);
g.DrawImage(croppedImage, rect); g.DrawImage(croppedImage, rect);
}
} }
} }
} }

View file

@ -77,14 +77,16 @@ public override void OnDrawFinal(Graphics g, Bitmap bmp)
{ {
if (PixelSize > 1) if (PixelSize > 1)
{ {
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); Rectangle rect = Rectangle.Intersect(new Rectangle(0, 0, bmp.Width, bmp.Height), Rectangle);
rect.Intersect(Rectangle);
using (Bitmap croppedImage = ImageHelpers.CropBitmap(bmp, rect)) if (!rect.IsEmpty)
{ {
ApplyEffect(croppedImage); using (Bitmap croppedImage = ImageHelpers.CropBitmap(bmp, rect))
{
ApplyEffect(croppedImage);
g.DrawImage(croppedImage, rect); g.DrawImage(croppedImage, rect);
}
} }
} }
} }