diff --git a/ShareX.HelpersLib/Properties/Resources.Designer.cs b/ShareX.HelpersLib/Properties/Resources.Designer.cs
index 56f59acc6..235951e4c 100644
--- a/ShareX.HelpersLib/Properties/Resources.Designer.cs
+++ b/ShareX.HelpersLib/Properties/Resources.Designer.cs
@@ -3598,6 +3598,15 @@ internal static string ShapeType_DrawingFreehand {
}
}
+ ///
+ /// Looks up a localized string similar to Freehand arrow.
+ ///
+ internal static string ShapeType_DrawingFreehandArrow {
+ get {
+ return ResourceManager.GetString("ShapeType_DrawingFreehandArrow", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Image (File).
///
diff --git a/ShareX.HelpersLib/Properties/Resources.resx b/ShareX.HelpersLib/Properties/Resources.resx
index b4fbf06a1..e646f501b 100644
--- a/ShareX.HelpersLib/Properties/Resources.resx
+++ b/ShareX.HelpersLib/Properties/Resources.resx
@@ -1493,4 +1493,7 @@ Would you like to download and install it?
Screen record
+
+ Freehand arrow
+
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Enums.cs b/ShareX.ScreenCaptureLib/Enums.cs
index f2ca5e3fb..73f6ac6dc 100644
--- a/ShareX.ScreenCaptureLib/Enums.cs
+++ b/ShareX.ScreenCaptureLib/Enums.cs
@@ -276,6 +276,7 @@ public enum ShapeType // Localized
DrawingRectangle,
DrawingEllipse,
DrawingFreehand,
+ DrawingFreehandArrow,
DrawingLine,
DrawingArrow,
DrawingTextOutline,
diff --git a/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs b/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs
index aa1c1f756..89f303075 100644
--- a/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs
+++ b/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs
@@ -1252,6 +1252,16 @@ internal static System.Drawing.Bitmap pencil {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap pencil__arrow {
+ get {
+ object obj = ResourceManager.GetObject("pencil__arrow", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized string similar to Pixelate.
///
diff --git a/ShareX.ScreenCaptureLib/Properties/Resources.resx b/ShareX.ScreenCaptureLib/Properties/Resources.resx
index f14c795e5..b93587c1a 100644
--- a/ShareX.ScreenCaptureLib/Properties/Resources.resx
+++ b/ShareX.ScreenCaptureLib/Properties/Resources.resx
@@ -808,4 +808,7 @@ X: {4} Y: {5}
..\Resources\table-delete-column.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\pencil--arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Resources/pencil--arrow.png b/ShareX.ScreenCaptureLib/Resources/pencil--arrow.png
new file mode 100644
index 000000000..5c724b4dd
Binary files /dev/null and b/ShareX.ScreenCaptureLib/Resources/pencil--arrow.png differ
diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandArrowDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandArrowDrawingShape.cs
new file mode 100644
index 000000000..c31e287cb
--- /dev/null
+++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandArrowDrawingShape.cs
@@ -0,0 +1,85 @@
+#region License Information (GPL v3)
+
+/*
+ ShareX - A program that allows you to take screenshots and share any file type
+ Copyright (c) 2007-2022 ShareX Team
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Optionally you can also view the license at .
+*/
+
+#endregion License Information (GPL v3)
+
+using ShareX.HelpersLib;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace ShareX.ScreenCaptureLib
+{
+ public class FreehandArrowDrawingShape : FreehandDrawingShape
+ {
+ public override ShapeType ShapeType { get; } = ShapeType.DrawingFreehandArrow;
+
+ public ArrowHeadDirection ArrowHeadDirection { get; set; }
+
+ public override void OnConfigLoad()
+ {
+ base.OnConfigLoad();
+ ArrowHeadDirection = AnnotationOptions.ArrowHeadDirection;
+ }
+
+ public override void OnConfigSave()
+ {
+ base.OnConfigSave();
+ AnnotationOptions.ArrowHeadDirection = ArrowHeadDirection;
+ }
+
+ protected override Pen CreatePen(Color borderColor, int borderSize, BorderStyle borderStyle)
+ {
+ using (GraphicsPath gp = new GraphicsPath())
+ {
+ int arrowWidth = 2, arrowHeight = 6, arrowCurve = 1;
+ gp.AddLine(new Point(0, 0), new Point(-arrowWidth, -arrowHeight));
+ gp.AddCurve(new Point[] { new Point(-arrowWidth, -arrowHeight), new Point(0, -arrowHeight + arrowCurve), new Point(arrowWidth, -arrowHeight) });
+ gp.CloseFigure();
+
+ CustomLineCap lineCap = new CustomLineCap(gp, null)
+ {
+ BaseInset = arrowHeight - arrowCurve
+ };
+
+ Pen pen = new Pen(borderColor, borderSize);
+
+ if (ArrowHeadDirection == ArrowHeadDirection.Both && MathHelpers.Distance(positions[0], positions[positions.Count - 1]) > arrowHeight * borderSize * 2)
+ {
+ pen.CustomEndCap = pen.CustomStartCap = lineCap;
+ }
+ else if (ArrowHeadDirection == ArrowHeadDirection.Start)
+ {
+ pen.CustomStartCap = lineCap;
+ }
+ else
+ {
+ pen.CustomEndCap = lineCap;
+ }
+
+ pen.LineJoin = LineJoin.Round;
+ pen.DashStyle = (DashStyle)borderStyle;
+ return pen;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs
index 59e497ba8..bfe4bbf6c 100644
--- a/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs
@@ -60,7 +60,7 @@ public PointF LastPosition
}
}
- private List positions = new List();
+ protected List positions = new List();
private bool isPolygonMode;
public override void ShowNodes()
@@ -145,13 +145,8 @@ protected void DrawFreehand(Graphics g, Color borderColor, int borderSize, Borde
}
else
{
- using (Pen pen = new Pen(borderColor, borderSize))
+ using (Pen pen = CreatePen(borderColor, borderSize, borderStyle))
{
- pen.StartCap = LineCap.Round;
- pen.EndCap = LineCap.Round;
- pen.LineJoin = LineJoin.Round;
- pen.DashStyle = (DashStyle)borderStyle;
-
g.DrawLines(pen, points.ToArray());
}
}
@@ -160,6 +155,16 @@ protected void DrawFreehand(Graphics g, Color borderColor, int borderSize, Borde
}
}
+ protected virtual Pen CreatePen(Color borderColor, int borderSize, BorderStyle borderStyle)
+ {
+ Pen pen = new Pen(borderColor, borderSize);
+ pen.StartCap = LineCap.Round;
+ pen.EndCap = LineCap.Round;
+ pen.LineJoin = LineJoin.Round;
+ pen.DashStyle = (DashStyle)borderStyle;
+ return pen;
+ }
+
public override void Move(float x, float y)
{
for (int i = 0; i < positions.Count; i++)
diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
index ac45e4eed..8a58b55fc 100644
--- a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
@@ -1153,6 +1153,9 @@ private BaseShape CreateShape(ShapeType shapeType)
case ShapeType.DrawingFreehand:
shape = new FreehandDrawingShape();
break;
+ case ShapeType.DrawingFreehandArrow:
+ shape = new FreehandArrowDrawingShape();
+ break;
case ShapeType.DrawingLine:
shape = new LineDrawingShape();
break;
@@ -1288,6 +1291,7 @@ private BaseShape CheckHover()
{
case ShapeType.RegionFreehand:
case ShapeType.DrawingFreehand:
+ case ShapeType.DrawingFreehandArrow:
case ShapeType.DrawingLine:
case ShapeType.DrawingArrow:
case ShapeType.DrawingTextOutline:
diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
index b895619be..7213e3849 100644
--- a/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
@@ -251,6 +251,9 @@ internal void CreateToolbar()
case ShapeType.DrawingFreehand:
img = Resources.pencil;
break;
+ case ShapeType.DrawingFreehandArrow:
+ img = Resources.pencil__arrow;
+ break;
case ShapeType.DrawingLine:
img = ShareXResources.IsDarkTheme ? Resources.layer_shape_line_white : Resources.layer_shape_line;
break;
@@ -1492,6 +1495,7 @@ private void UpdateMenu()
case ShapeType.DrawingRectangle:
case ShapeType.DrawingEllipse:
case ShapeType.DrawingFreehand:
+ case ShapeType.DrawingFreehandArrow:
case ShapeType.DrawingLine:
case ShapeType.DrawingArrow:
case ShapeType.DrawingTextOutline:
@@ -1523,6 +1527,7 @@ private void UpdateMenu()
case ShapeType.DrawingRectangle:
case ShapeType.DrawingEllipse:
case ShapeType.DrawingFreehand:
+ case ShapeType.DrawingFreehandArrow:
case ShapeType.DrawingLine:
case ShapeType.DrawingArrow:
case ShapeType.DrawingTextOutline:
@@ -1572,6 +1577,7 @@ private void UpdateMenu()
case ShapeType.DrawingRectangle:
case ShapeType.DrawingEllipse:
case ShapeType.DrawingFreehand:
+ case ShapeType.DrawingFreehandArrow:
case ShapeType.DrawingLine:
case ShapeType.DrawingArrow:
case ShapeType.DrawingMagnify:
@@ -1580,7 +1586,7 @@ private void UpdateMenu()
}
tslnudCenterPoints.Visible = shapeType == ShapeType.DrawingLine || shapeType == ShapeType.DrawingArrow;
- tscbArrowHeadDirection.Visible = shapeType == ShapeType.DrawingArrow;
+ tscbArrowHeadDirection.Visible = shapeType == ShapeType.DrawingArrow || shapeType == ShapeType.DrawingFreehandArrow;
tscbImageInterpolationMode.Visible = shapeType == ShapeType.DrawingImage || shapeType == ShapeType.DrawingImageScreen || shapeType == ShapeType.DrawingMagnify;
tslnudStartingStepValue.Visible = shapeType == ShapeType.DrawingStep;
tslnudStepFontSize.Visible = tscbStepType.Visible = shapeType == ShapeType.DrawingStep;
diff --git a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
index 3c53f9f6b..846ff4158 100644
--- a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
+++ b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
@@ -158,6 +158,7 @@
+
@@ -982,6 +983,9 @@
+
+
+