mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 09:03:44 -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
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue