Fixed shadow with transparency issue.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2095 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-25 12:19:22 +00:00
parent 9488200886
commit d8cb00e70c
4 changed files with 49 additions and 51 deletions

View file

@ -605,16 +605,14 @@ namespace Greenshot.Drawing {
try {
Rectangle imageRectangle = new Rectangle(Point.Empty, Image.Size);
Bitmap newImage = null;
Point offset = Point.Empty;
Point offset = new Point(-1,-1);
switch (effect) {
case Effects.Shadow:
offset = new Point(6, 6);
newImage = ImageHelper.CreateShadow((Bitmap)Image, 1f, 7, offset, PixelFormat.Format24bppRgb); //Image.PixelFormat);
newImage = ImageHelper.CreateShadow((Bitmap)Image, 1f, 9, ref offset, PixelFormat.Format32bppArgb); //Image.PixelFormat);
break;
case Effects.TornEdge:
offset = new Point(5, 5);
using (Bitmap tmpImage = ImageHelper.CreateTornEdge((Bitmap)Image)) {
newImage = ImageHelper.CreateShadow(tmpImage, 1f, 6, offset, PixelFormat.Format24bppRgb); //Image.PixelFormat);
newImage = ImageHelper.CreateShadow(tmpImage, 1f, 6, ref offset, PixelFormat.Format32bppArgb); //Image.PixelFormat);
}
break;
case Effects.Border:
@ -971,7 +969,7 @@ namespace Greenshot.Drawing {
// Draw a checkboard when capturing with transparency
protected override void OnPaintBackground(PaintEventArgs e) {
// check if we need to draw the checkerboard
if (Image.PixelFormat == PixelFormat.Format32bppArgb && transparencyBackgroundBrush != null) {
if (Image.IsAlphaPixelFormat(Image.PixelFormat) && transparencyBackgroundBrush != null) {
Graphics targetGraphics = e.Graphics;
Rectangle clipRectangle = e.ClipRectangle;
targetGraphics.FillRectangle(transparencyBackgroundBrush, clipRectangle);