Changed code for the Clipboard and changed a lot of "Bitmap" code to work on images, this might give problems but if these are solved we have better support for MetaFiles. This made it possible to remove the MetafileContainer, which is replaced by the ImageContainer (which is the BitmapContainer modified). The clipboard code now knows more ways to load images from the clipboard!

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2398 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-20 12:33:17 +00:00
commit f627ce5dd0
15 changed files with 301 additions and 382 deletions

View file

@ -247,7 +247,7 @@ namespace GreenshotPlugin.Core {
if (string.IsNullOrEmpty(fullPath)) {
return null;
}
Bitmap fileBitmap = null;
Image fileImage = null;
LOG.InfoFormat("Loading image from file {0}", fullPath);
// Fixed lock problem Bug #3431881
using (Stream surfaceFileStream = File.OpenRead(fullPath)) {
@ -258,7 +258,7 @@ namespace GreenshotPlugin.Core {
surfaceFileStream.Position = 0;
using (Image tmpImage = Image.FromStream(surfaceFileStream, true, true)) {
LOG.DebugFormat("Loaded {0} with Size {1}x{2} and PixelFormat {3}", fullPath, tmpImage.Width, tmpImage.Height, tmpImage.PixelFormat);
fileBitmap = ImageHelper.Clone(tmpImage);
fileImage = ImageHelper.Clone(tmpImage);
}
// Start at -14 read "GreenshotXX.YY" (XX=Major, YY=Minor)
const int markerSize = 14;
@ -280,9 +280,9 @@ namespace GreenshotPlugin.Core {
}
}
}
if (fileBitmap != null) {
returnSurface.Image = fileBitmap;
LOG.InfoFormat("Information about file {0}: {1}x{2}-{3} Resolution {4}x{5}", fullPath, fileBitmap.Width, fileBitmap.Height, fileBitmap.PixelFormat, fileBitmap.HorizontalResolution, fileBitmap.VerticalResolution);
if (fileImage != null) {
returnSurface.Image = fileImage;
LOG.InfoFormat("Information about file {0}: {1}x{2}-{3} Resolution {4}x{5}", fullPath, fileImage.Width, fileImage.Height, fileImage.PixelFormat, fileImage.HorizontalResolution, fileImage.VerticalResolution);
}
return returnSurface;
}