From 319b4af18a3bb63664add4c45a75d998998ebf42 Mon Sep 17 00:00:00 2001
From: xucongli1989 <80213876@qq.com>
Date: Mon, 16 Jan 2017 23:02:34 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4=E7=89=B9?=
=?UTF-8?q?=E6=95=88=E9=87=8D=E5=A4=8D=E5=87=BA=E7=8E=B0=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Greenshot/Drawing/Surface.cs | 10 +++---
GreenshotPlugin/Core/AbstractDestination.cs | 6 +++-
GreenshotPlugin/Effects/DefaultEffect.cs | 40 +++++++++++++++++++++
GreenshotPlugin/GreenshotPlugin.csproj | 1 +
GreenshotPlugin/Interfaces/Generic.cs | 2 ++
5 files changed, 54 insertions(+), 5 deletions(-)
create mode 100644 GreenshotPlugin/Effects/DefaultEffect.cs
diff --git a/Greenshot/Drawing/Surface.cs b/Greenshot/Drawing/Surface.cs
index e8b90026d..38df57973 100644
--- a/Greenshot/Drawing/Surface.cs
+++ b/Greenshot/Drawing/Surface.cs
@@ -2045,10 +2045,12 @@ namespace Greenshot.Drawing
///
public IDrawableContainerList Elements => _elements;
- ///
- /// pulls selected elements up one level in hierarchy
- ///
- public void PullElementsUp()
+ public bool HasDefaultEffect { get; set; } = false;
+
+ ///
+ /// pulls selected elements up one level in hierarchy
+ ///
+ public void PullElementsUp()
{
_elements.PullElementsUp(selectedElements);
_elements.Invalidate();
diff --git a/GreenshotPlugin/Core/AbstractDestination.cs b/GreenshotPlugin/Core/AbstractDestination.cs
index 1431636b5..15d2479a8 100644
--- a/GreenshotPlugin/Core/AbstractDestination.cs
+++ b/GreenshotPlugin/Core/AbstractDestination.cs
@@ -99,7 +99,11 @@ namespace GreenshotPlugin.Core {
return;
}
//set default border effect.
- surface.ApplyBitmapEffect(new Effects.BorderEffect());
+ if (!surface.HasDefaultEffect)
+ {
+ surface.ApplyBitmapEffect(new Effects.DefaultEffect());
+ surface.HasDefaultEffect = true;
+ }
}
public abstract ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
diff --git a/GreenshotPlugin/Effects/DefaultEffect.cs b/GreenshotPlugin/Effects/DefaultEffect.cs
new file mode 100644
index 000000000..b3e0b1e57
--- /dev/null
+++ b/GreenshotPlugin/Effects/DefaultEffect.cs
@@ -0,0 +1,40 @@
+using GreenshotPlugin.Core;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace GreenshotPlugin.Effects
+{
+ ///
+ /// default effect.
+ ///
+ public class DefaultEffect : IEffect
+ {
+ public DefaultEffect()
+ {
+ this.Reset();
+ }
+
+ public Color Color
+ {
+ get;
+ set;
+ }
+
+ public int Width
+ {
+ get;
+ set;
+ }
+
+ public Image Apply(Image sourceImage, Matrix matrix)
+ {
+ return ImageHelper.CreateBorder(sourceImage, Width, Color, sourceImage.PixelFormat, matrix);
+ }
+
+ public void Reset()
+ {
+ this.Width = 2;
+ this.Color = Color.Gray;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotPlugin/GreenshotPlugin.csproj b/GreenshotPlugin/GreenshotPlugin.csproj
index 1c3ab8ce7..da355b746 100644
--- a/GreenshotPlugin/GreenshotPlugin.csproj
+++ b/GreenshotPlugin/GreenshotPlugin.csproj
@@ -50,6 +50,7 @@
+
diff --git a/GreenshotPlugin/Interfaces/Generic.cs b/GreenshotPlugin/Interfaces/Generic.cs
index 4fc2da7aa..553e18d78 100644
--- a/GreenshotPlugin/Interfaces/Generic.cs
+++ b/GreenshotPlugin/Interfaces/Generic.cs
@@ -263,5 +263,7 @@ namespace Greenshot.Plugin
int Height { get; }
void MakeUndoable(IMemento memento, bool allowMerge);
+
+ bool HasDefaultEffect { get; set; }
}
}
\ No newline at end of file