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:
RKrom 2012-02-21 13:30:43 +00:00
parent 4a07359cf6
commit 150ea9c4eb
7 changed files with 157 additions and 51 deletions

View file

@ -216,6 +216,7 @@ namespace GreenshotPlugin.Core {
// We create a copy of the bitmap, so everything else can be disposed
imageFileStream.Position = 0;
using (Image tmpImage = Image.FromStream(imageFileStream, true, true)) {
LOG.DebugFormat("Loaded {0} with Size {1}x{2} and PixelFormat {3}", filename, tmpImage.Width, tmpImage.Height, tmpImage.PixelFormat);
fileBitmap = Clone(tmpImage);
}
}
@ -779,6 +780,26 @@ namespace GreenshotPlugin.Core {
return newImage;
}
/// <summary>
/// Return negative of Bitmap
/// </summary>
/// <param name="sourceBitmap">Bitmap to create a negative off</param>
/// <returns>Negative bitmap</returns>
public static Bitmap CreateNegative(Bitmap sourceBitmap) {
using (BitmapBuffer bb = new BitmapBuffer(sourceBitmap, true)) {
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);
}
}
bb.Unlock();
return bb.Bitmap;
}
}
/// <summary>
/// Create a new bitmap where the sourceBitmap has a Simple border around it
/// </summary>