mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
THis fixes an exception when Greenshot is used via wine.
This commit is contained in:
parent
5b29eebd37
commit
633b31ec29
1 changed files with 33 additions and 24 deletions
|
@ -1351,22 +1351,22 @@ namespace GreenshotPlugin.Core {
|
||||||
// Make sure both images have the same resolution
|
// Make sure both images have the same resolution
|
||||||
newImage.SetResolution(sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
|
newImage.SetResolution(sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
|
||||||
|
|
||||||
using Graphics graphics = Graphics.FromImage(newImage);
|
using Graphics graphics = Graphics.FromImage(newImage);
|
||||||
if (fromTransparentToNon)
|
if (fromTransparentToNon)
|
||||||
{
|
{
|
||||||
// Rule 2: Make sure the background color is white
|
// Rule 2: Make sure the background color is white
|
||||||
graphics.Clear(Color.White);
|
graphics.Clear(Color.White);
|
||||||
}
|
}
|
||||||
// decide fastest copy method
|
// decide fastest copy method
|
||||||
if (isAreaEqual)
|
if (isAreaEqual)
|
||||||
{
|
{
|
||||||
graphics.DrawImageUnscaled(sourceImage, 0, 0);
|
graphics.DrawImageUnscaled(sourceImage, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
graphics.DrawImage(sourceImage, 0, 0, sourceRect, GraphicsUnit.Pixel);
|
graphics.DrawImage(sourceImage, 0, 0, sourceRect, GraphicsUnit.Pixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Let GDI+ decide how to convert, need to test what is quicker...
|
// Let GDI+ decide how to convert, need to test what is quicker...
|
||||||
|
@ -1374,18 +1374,27 @@ namespace GreenshotPlugin.Core {
|
||||||
// Make sure both images have the same resolution
|
// Make sure both images have the same resolution
|
||||||
newImage.SetResolution(sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
|
newImage.SetResolution(sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
|
||||||
}
|
}
|
||||||
// Clone property items (EXIF information etc)
|
|
||||||
foreach (var propertyItem in sourceImage.PropertyItems)
|
// In WINE someone getting the PropertyItems doesn't work
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
// Clone property items (EXIF information etc)
|
||||||
|
foreach (var propertyItem in sourceImage.PropertyItems)
|
||||||
{
|
{
|
||||||
newImage.SetPropertyItem(propertyItem);
|
try
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
newImage.SetPropertyItem(propertyItem);
|
||||||
{
|
}
|
||||||
Log.Warn("Problem cloning a propertyItem.", ex);
|
catch (Exception innerEx)
|
||||||
|
{
|
||||||
|
Log.Warn("Problem cloning a propertyItem.", innerEx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warn("Problem cloning a propertyItem.", ex);
|
||||||
|
}
|
||||||
return newImage;
|
return newImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue