BUG-1908: Made Greenshot recheck & add the external commands like Ms-Paint and Paint.NET if they are not deleted manually and not yet available. Also cleaned up some code.

This commit is contained in:
Robin 2016-09-16 21:48:57 +02:00
commit 6efc7796b8
49 changed files with 322 additions and 294 deletions

View file

@ -519,7 +519,7 @@ namespace GreenshotPlugin.Core {
throw new NotImplementedException();
}
static class Sine {
private static class Sine {
public static double EaseIn(double s) {
return Math.Sin(s * (Math.PI / 2) - (Math.PI / 2)) + 1;
}
@ -531,7 +531,7 @@ namespace GreenshotPlugin.Core {
}
}
static class Power {
private static class Power {
public static double EaseIn(double s, int power) {
return Math.Pow(s, power);
}

View file

@ -490,7 +490,7 @@ namespace GreenshotPlugin.Core {
/// <returns>Bitmap</returns>
public static Image ApplyEffect(Image sourceImage, IEffect effect, Matrix matrix)
{
List<IEffect> effects = new List<IEffect> { effect };
var effects = new List<IEffect> { effect };
return ApplyEffects(sourceImage, effects, matrix);
}
@ -501,13 +501,13 @@ namespace GreenshotPlugin.Core {
/// <param name="effects">List of IEffect</param>
/// <param name="matrix"></param>
/// <returns>Bitmap</returns>
public static Image ApplyEffects(Image sourceImage, List<IEffect> effects, Matrix matrix)
public static Image ApplyEffects(Image sourceImage, IEnumerable<IEffect> effects, Matrix matrix)
{
Image currentImage = sourceImage;
var currentImage = sourceImage;
bool disposeImage = false;
foreach (IEffect effect in effects)
foreach (var effect in effects)
{
Image tmpImage = effect.Apply(currentImage, matrix);
var tmpImage = effect.Apply(currentImage, matrix);
if (tmpImage != null)
{
if (disposeImage)
@ -515,7 +515,6 @@ namespace GreenshotPlugin.Core {
currentImage.Dispose();
}
currentImage = tmpImage;
tmpImage = null;
// Make sure the "new" image is disposed
disposeImage = true;
}
@ -549,7 +548,7 @@ namespace GreenshotPlugin.Core {
public static Image CreateTornEdge(Image sourceImage, int toothHeight, int horizontalToothRange, int verticalToothRange, bool[] edges)
{
Image returnImage = CreateEmpty(sourceImage.Width, sourceImage.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
using (GraphicsPath path = new GraphicsPath())
using (var path = new GraphicsPath())
{
Random random = new Random();
int horizontalRegions = (int)Math.Round((float)sourceImage.Width / horizontalToothRange);

View file

@ -780,7 +780,7 @@ namespace GreenshotPlugin.Core {
}
if (windowRect.IsEmpty) {
if (GetWindowRect(out windowRect))
if (!GetWindowRect(out windowRect))
{
Win32Error error = Win32.GetLastErrorCode();
Log.WarnFormat("Couldn't retrieve the windows rectangle: {0}", Win32.GetMessage(error));