mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Added curved edge support to torn edge effect
This commit is contained in:
parent
895beeaba5
commit
f2a3b80d60
2 changed files with 14 additions and 3 deletions
|
@ -1286,7 +1286,7 @@ public static void FastBoxBlur(Bitmap bmp, int radius)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Image TornEdges(Image img, int tornDepth, int tornRange, AnchorStyles sides)
|
public static Image TornEdges(Image img, int tornDepth, int tornRange, AnchorStyles sides, bool curvedEdges)
|
||||||
{
|
{
|
||||||
if (tornDepth < 1 || tornRange < 1 || sides == AnchorStyles.None)
|
if (tornDepth < 1 || tornRange < 1 || sides == AnchorStyles.None)
|
||||||
{
|
{
|
||||||
|
@ -1375,7 +1375,15 @@ public static Image TornEdges(Image img, int tornDepth, int tornRange, AnchorSty
|
||||||
using (TextureBrush brush = new TextureBrush(img))
|
using (TextureBrush brush = new TextureBrush(img))
|
||||||
{
|
{
|
||||||
g.SetHighQuality();
|
g.SetHighQuality();
|
||||||
|
|
||||||
|
if (curvedEdges)
|
||||||
|
{
|
||||||
|
g.FillClosedCurve(brush, points.ToArray());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
g.FillPolygon(brush, points.ToArray());
|
g.FillPolygon(brush, points.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ internal class TornEdge : ImageEffect
|
||||||
[DefaultValue(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)]
|
[DefaultValue(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)]
|
||||||
public AnchorStyles Sides { get; set; }
|
public AnchorStyles Sides { get; set; }
|
||||||
|
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool CurvedEdges { get; set; }
|
||||||
|
|
||||||
public TornEdge()
|
public TornEdge()
|
||||||
{
|
{
|
||||||
this.ApplyDefaultPropertyValues();
|
this.ApplyDefaultPropertyValues();
|
||||||
|
@ -49,7 +52,7 @@ public TornEdge()
|
||||||
|
|
||||||
public override Image Apply(Image img)
|
public override Image Apply(Image img)
|
||||||
{
|
{
|
||||||
return ImageHelpers.TornEdges(img, Depth, Range, Sides);
|
return ImageHelpers.TornEdges(img, Depth, Range, Sides, CurvedEdges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue