mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 00:53:51 -07:00
Fixed a problem with writing transparent bitmaps to non transparent image formats. Cleaned up some code, implemented the start of a donate page in the installer (also tweaked the size a bit)
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1673 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
4a07359cf6
commit
150ea9c4eb
7 changed files with 157 additions and 51 deletions
|
@ -142,20 +142,6 @@ namespace Greenshot.Helpers {
|
|||
}
|
||||
}
|
||||
|
||||
// Invert Bitmap if wanted
|
||||
if (conf.OutputPrintInverted) {
|
||||
using (BitmapBuffer bb = new BitmapBuffer((Bitmap)image, false)) {
|
||||
bb.Lock();
|
||||
for (int y = 0; y < bb.Height; y++) {
|
||||
for (int x = 0; x < bb.Width; x++) {
|
||||
Color color = bb.GetColorAt(x, y);
|
||||
Color invertedColor = Color.FromArgb(color.A, color.R ^ 255, color.G ^ 255, color.B ^ 255);
|
||||
bb.SetColorAt(x, y, invertedColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get a rectangle representing the printable Area
|
||||
RectangleF pageRect = e.PageSettings.PrintableArea;
|
||||
|
||||
|
@ -192,8 +178,13 @@ namespace Greenshot.Helpers {
|
|||
e.Graphics.DrawString(dateString, f, Brushes.Black, pageRect.Width / 2 - (dateStringWidth / 2), pageRect.Height);
|
||||
}
|
||||
}
|
||||
|
||||
e.Graphics.DrawImage(image, printRect, imageRect, GraphicsUnit.Pixel);
|
||||
if (conf.OutputPrintInverted) {
|
||||
using (Bitmap negativeBitmap = ImageHelper.CreateNegative((Bitmap)image)) {
|
||||
e.Graphics.DrawImage(negativeBitmap, printRect, imageRect, GraphicsUnit.Pixel);
|
||||
}
|
||||
} else {
|
||||
e.Graphics.DrawImage(image, printRect, imageRect, GraphicsUnit.Pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue