mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
BUG-1686: Fix for weird shadow effect, this was actually a bug in the background drawing routine.
This commit is contained in:
parent
8cb2dedb87
commit
82705b6165
1 changed files with 11 additions and 10 deletions
|
@ -1235,32 +1235,33 @@ namespace Greenshot.Drawing {
|
||||||
//graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
//graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
//graphics.CompositingQuality = CompositingQuality.HighQuality;
|
//graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
//graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
//graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
|
DrawBackground(graphics, clipRectangle);
|
||||||
graphics.DrawImage(Image, clipRectangle, clipRectangle, GraphicsUnit.Pixel);
|
graphics.DrawImage(Image, clipRectangle, clipRectangle, GraphicsUnit.Pixel);
|
||||||
graphics.SetClip(targetGraphics);
|
graphics.SetClip(targetGraphics);
|
||||||
_elements.Draw(graphics, _buffer, RenderMode.EDIT, clipRectangle);
|
_elements.Draw(graphics, _buffer, RenderMode.EDIT, clipRectangle);
|
||||||
}
|
}
|
||||||
targetGraphics.DrawImage(_buffer, clipRectangle, clipRectangle, GraphicsUnit.Pixel);
|
targetGraphics.DrawImage(_buffer, clipRectangle, clipRectangle, GraphicsUnit.Pixel);
|
||||||
} else {
|
} else {
|
||||||
|
DrawBackground(targetGraphics, clipRectangle);
|
||||||
targetGraphics.DrawImage(Image, clipRectangle, clipRectangle, GraphicsUnit.Pixel);
|
targetGraphics.DrawImage(Image, clipRectangle, clipRectangle, GraphicsUnit.Pixel);
|
||||||
_elements.Draw(targetGraphics, null, RenderMode.EDIT, clipRectangle);
|
_elements.Draw(targetGraphics, null, RenderMode.EDIT, clipRectangle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawBackground(Graphics targetGraphics, Rectangle clipRectangle) {
|
||||||
|
// check if we need to draw the checkerboard
|
||||||
|
if (Image.IsAlphaPixelFormat(Image.PixelFormat) && _transparencyBackgroundBrush != null) {
|
||||||
|
targetGraphics.FillRectangle(_transparencyBackgroundBrush, clipRectangle);
|
||||||
|
} else {
|
||||||
|
targetGraphics.Clear(BackColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draw a checkboard when capturing with transparency
|
/// Draw a checkboard when capturing with transparency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">PaintEventArgs</param>
|
/// <param name="e">PaintEventArgs</param>
|
||||||
protected override void OnPaintBackground(PaintEventArgs e) {
|
protected override void OnPaintBackground(PaintEventArgs e) {
|
||||||
// check if we need to draw the checkerboard
|
|
||||||
if (Image.IsAlphaPixelFormat(Image.PixelFormat) && _transparencyBackgroundBrush != null) {
|
|
||||||
Graphics targetGraphics = e.Graphics;
|
|
||||||
Rectangle clipRectangle = e.ClipRectangle;
|
|
||||||
targetGraphics.FillRectangle(_transparencyBackgroundBrush, clipRectangle);
|
|
||||||
} else {
|
|
||||||
Graphics targetGraphics = e.Graphics;
|
|
||||||
targetGraphics.Clear(BackColor);
|
|
||||||
//base.OnPaintBackground(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue