mirror of
https://github.com/greenshot/greenshot
synced 2025-08-25 07:36:38 -07:00
修复默认特效重复出现的问题
This commit is contained in:
parent
bcc9e8bf45
commit
319b4af18a
5 changed files with 54 additions and 5 deletions
|
@ -2045,6 +2045,8 @@ namespace Greenshot.Drawing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDrawableContainerList Elements => _elements;
|
public IDrawableContainerList Elements => _elements;
|
||||||
|
|
||||||
|
public bool HasDefaultEffect { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pulls selected elements up one level in hierarchy
|
/// pulls selected elements up one level in hierarchy
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -99,7 +99,11 @@ namespace GreenshotPlugin.Core {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//set default border effect.
|
//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);
|
public abstract ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
|
||||||
|
|
40
GreenshotPlugin/Effects/DefaultEffect.cs
Normal file
40
GreenshotPlugin/Effects/DefaultEffect.cs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
using GreenshotPlugin.Core;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
|
namespace GreenshotPlugin.Effects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// default effect.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,6 +50,7 @@
|
||||||
<Compile Include="Core\EventDelay.cs" />
|
<Compile Include="Core\EventDelay.cs" />
|
||||||
<Compile Include="Core\FastBitmap.cs" />
|
<Compile Include="Core\FastBitmap.cs" />
|
||||||
<Compile Include="Core\Func.cs" />
|
<Compile Include="Core\Func.cs" />
|
||||||
|
<Compile Include="Effects\DefaultEffect.cs" />
|
||||||
<Compile Include="Effects\GrayscaleEffect.cs" />
|
<Compile Include="Effects\GrayscaleEffect.cs" />
|
||||||
<Compile Include="Effects\IEffect.cs" />
|
<Compile Include="Effects\IEffect.cs" />
|
||||||
<Compile Include="Core\IImage.cs" />
|
<Compile Include="Core\IImage.cs" />
|
||||||
|
|
|
@ -263,5 +263,7 @@ namespace Greenshot.Plugin
|
||||||
int Height { get; }
|
int Height { get; }
|
||||||
|
|
||||||
void MakeUndoable(IMemento memento, bool allowMerge);
|
void MakeUndoable(IMemento memento, bool allowMerge);
|
||||||
|
|
||||||
|
bool HasDefaultEffect { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue