diff --git a/ShareX.HelpersLib/Extensions/GraphicsPathExtensions.cs b/ShareX.HelpersLib/Extensions/GraphicsPathExtensions.cs
index 62407f220..114f65c27 100644
--- a/ShareX.HelpersLib/Extensions/GraphicsPathExtensions.cs
+++ b/ShareX.HelpersLib/Extensions/GraphicsPathExtensions.cs
@@ -59,11 +59,11 @@ public static void AddRoundedRectangleProper(this GraphicsPath graphicsPath, Rec
}
}
- public static void AddRoundedRectangle(this GraphicsPath graphicsPath, RectangleF rect, float radius)
+ public static void AddRoundedRectangle(this GraphicsPath gp, RectangleF rect, float radius)
{
if (radius <= 0f)
{
- graphicsPath.AddRectangle(rect);
+ gp.AddRectangle(rect);
}
else
{
@@ -72,7 +72,7 @@ public static void AddRoundedRectangle(this GraphicsPath graphicsPath, Rectangle
// then return a capsule instead of a lozenge
if (radius >= (Math.Min(rect.Width, rect.Height) / 2.0f))
{
- graphicsPath.AddCapsule(rect);
+ gp.AddCapsule(rect);
}
else
{
@@ -83,26 +83,26 @@ public static void AddRoundedRectangle(this GraphicsPath graphicsPath, Rectangle
RectangleF arc = new RectangleF(rect.Location, size);
// Top left arc
- graphicsPath.AddArc(arc, 180, 90);
+ gp.AddArc(arc, 180, 90);
// Top right arc
arc.X = rect.Right - diameter;
- graphicsPath.AddArc(arc, 270, 90);
+ gp.AddArc(arc, 270, 90);
// Bottom right arc
arc.Y = rect.Bottom - diameter;
- graphicsPath.AddArc(arc, 0, 90);
+ gp.AddArc(arc, 0, 90);
// Bottom left arc
arc.X = rect.Left;
- graphicsPath.AddArc(arc, 90, 90);
+ gp.AddArc(arc, 90, 90);
- graphicsPath.CloseFigure();
+ gp.CloseFigure();
}
}
}
- public static void AddCapsule(this GraphicsPath graphicsPath, RectangleF rect)
+ public static void AddCapsule(this GraphicsPath gp, RectangleF rect)
{
float diameter;
RectangleF arc;
@@ -115,9 +115,9 @@ public static void AddCapsule(this GraphicsPath graphicsPath, RectangleF rect)
diameter = rect.Height;
SizeF sizeF = new SizeF(diameter, diameter);
arc = new RectangleF(rect.Location, sizeF);
- graphicsPath.AddArc(arc, 90, 180);
+ gp.AddArc(arc, 90, 180);
arc.X = rect.Right - diameter;
- graphicsPath.AddArc(arc, 270, 180);
+ gp.AddArc(arc, 270, 180);
}
else if (rect.Width < rect.Height)
{
@@ -125,22 +125,22 @@ public static void AddCapsule(this GraphicsPath graphicsPath, RectangleF rect)
diameter = rect.Width;
SizeF sizeF = new SizeF(diameter, diameter);
arc = new RectangleF(rect.Location, sizeF);
- graphicsPath.AddArc(arc, 180, 180);
+ gp.AddArc(arc, 180, 180);
arc.Y = rect.Bottom - diameter;
- graphicsPath.AddArc(arc, 0, 180);
+ gp.AddArc(arc, 0, 180);
}
else
{
// Circle
- graphicsPath.AddEllipse(rect);
+ gp.AddEllipse(rect);
}
}
catch
{
- graphicsPath.AddEllipse(rect);
+ gp.AddEllipse(rect);
}
- graphicsPath.CloseFigure();
+ gp.CloseFigure();
}
public static void AddDiamond(this GraphicsPath graphicsPath, RectangleF rect)
diff --git a/ShareX.ScreenCaptureLib/Enums.cs b/ShareX.ScreenCaptureLib/Enums.cs
index 0dafb1f36..23f5d7f02 100644
--- a/ShareX.ScreenCaptureLib/Enums.cs
+++ b/ShareX.ScreenCaptureLib/Enums.cs
@@ -182,11 +182,9 @@ public enum ShapeCategory
public enum ShapeType // Localized
{
RegionRectangle,
- RegionRoundedRectangle,
RegionEllipse,
RegionFreehand,
DrawingRectangle,
- DrawingRoundedRectangle,
DrawingEllipse,
DrawingFreehand,
DrawingLine,
diff --git a/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs b/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs
index 12ab23e8e..b8dba2566 100644
--- a/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs
+++ b/ShareX.ScreenCaptureLib/Forms/RegionCaptureForm.cs
@@ -763,20 +763,16 @@ private void WriteTips(StringBuilder sb)
sb.AppendLine(Resources.RectangleRegionForm_WriteTips__Ctrl___Mouse_wheel__Change_magnifier_size);
if (ShapeManager.CurrentShapeType == ShapeType.RegionRectangle) sb.Append("-> ");
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 0", ShapeType.RegionRectangle.GetLocalizedDescription()));
- if (ShapeManager.CurrentShapeType == ShapeType.RegionRoundedRectangle) sb.Append("-> ");
- sb.AppendLine(ShapeType.RegionRoundedRectangle.GetLocalizedDescription());
if (ShapeManager.CurrentShapeType == ShapeType.RegionEllipse) sb.Append("-> ");
sb.AppendLine(ShapeType.RegionEllipse.GetLocalizedDescription());
if (ShapeManager.CurrentShapeType == ShapeType.RegionFreehand) sb.Append("-> ");
sb.AppendLine(ShapeType.RegionFreehand.GetLocalizedDescription());
if (ShapeManager.CurrentShapeType == ShapeType.DrawingRectangle) sb.Append("-> ");
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 1", ShapeType.DrawingRectangle.GetLocalizedDescription()));
- if (ShapeManager.CurrentShapeType == ShapeType.DrawingRoundedRectangle) sb.Append("-> ");
- sb.AppendLine(string.Format("[{0}] {1}", "Numpad 2", ShapeType.DrawingRoundedRectangle.GetLocalizedDescription()));
if (ShapeManager.CurrentShapeType == ShapeType.DrawingEllipse) sb.Append("-> ");
- sb.AppendLine(string.Format("[{0}] {1}", "Numpad 3", ShapeType.DrawingEllipse.GetLocalizedDescription()));
+ sb.AppendLine(string.Format("[{0}] {1}", "Numpad 2", ShapeType.DrawingEllipse.GetLocalizedDescription()));
if (ShapeManager.CurrentShapeType == ShapeType.DrawingFreehand) sb.Append("-> ");
- sb.AppendLine(ShapeType.DrawingFreehand.GetLocalizedDescription());
+ sb.AppendLine(string.Format("[{0}] {1}", "Numpad 3", ShapeType.DrawingFreehand.GetLocalizedDescription()));
if (ShapeManager.CurrentShapeType == ShapeType.DrawingLine) sb.Append("-> ");
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 4", ShapeType.DrawingLine.GetLocalizedDescription()));
if (ShapeManager.CurrentShapeType == ShapeType.DrawingArrow) sb.Append("-> ");
diff --git a/ShareX.ScreenCaptureLib/Shapes/AnnotationOptions.cs b/ShareX.ScreenCaptureLib/Shapes/AnnotationOptions.cs
index 321356550..00f73453a 100644
--- a/ShareX.ScreenCaptureLib/Shapes/AnnotationOptions.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/AnnotationOptions.cs
@@ -29,26 +29,30 @@ namespace ShareX.ScreenCaptureLib
{
public class AnnotationOptions
{
- // Drawing
- public Color BorderColor { get; set; } = Color.Red;
- public int BorderSize { get; set; } = 5;
- public Color FillColor { get; set; } = Color.FromArgb(0, 0, 0, 0);
- public bool Shadow { get; set; } = true;
+ public static readonly Color PrimaryColor = Color.Red;
+ public static readonly Color SecondaryColor = Color.White;
+ public static readonly Color TransparentColor = Color.FromArgb(0, 0, 0, 0);
- // Rounded rectangle region, rounded rectangle drawing
- public int RoundedRectangleRadius { get; set; } = 8;
+ // Region
+ public int RegionCornerRadius { get; set; } = 0;
+
+ // Drawing
+ public Color BorderColor { get; set; } = PrimaryColor;
+ public int BorderSize { get; set; } = 5;
+ public Color FillColor { get; set; } = TransparentColor;
+ public int DrawingCornerRadius { get; set; } = 3;
+ public bool Shadow { get; set; } = true;
// Text drawing
public TextDrawingOptions TextOptions { get; set; } = new TextDrawingOptions();
- public Color TextBorderColor { get; set; } = Color.White;
- public int TextBorderSize { get; set; } = 0;
- public Color TextFillColor { get; set; } = Color.FromArgb(150, Color.Black);
- public int TextCornerRadius { get; set; } = 0;
+ public Color TextBorderColor { get; set; } = SecondaryColor;
+ public int TextBorderSize { get; set; } = 2;
+ public Color TextFillColor { get; set; } = PrimaryColor;
// Step drawing
- public Color StepBorderColor { get; set; } = Color.White;
+ public Color StepBorderColor { get; set; } = SecondaryColor;
public int StepBorderSize { get; set; } = 2;
- public Color StepFillColor { get; set; } = Color.Red;
+ public Color StepFillColor { get; set; } = PrimaryColor;
// Blur effect
public int BlurRadius { get; set; } = 15;
diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs
index 79eacac65..3e533edbb 100644
--- a/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs
@@ -35,6 +35,18 @@ public class RectangleDrawingShape : BaseDrawingShape
public int CornerRadius { get; set; }
+ public override void OnConfigLoad()
+ {
+ base.OnConfigLoad();
+ CornerRadius = AnnotationOptions.DrawingCornerRadius;
+ }
+
+ public override void OnConfigSave()
+ {
+ base.OnConfigSave();
+ AnnotationOptions.DrawingCornerRadius = CornerRadius;
+ }
+
public override void OnDraw(Graphics g)
{
DrawRectangle(g);
diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/RoundedRectangleDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/RoundedRectangleDrawingShape.cs
deleted file mode 100644
index d128e0af8..000000000
--- a/ShareX.ScreenCaptureLib/Shapes/Drawing/RoundedRectangleDrawingShape.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-#region License Information (GPL v3)
-
-/*
- ShareX - A program that allows you to take screenshots and share any file type
- Copyright (c) 2007-2016 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)
-
-namespace ShareX.ScreenCaptureLib
-{
- public class RoundedRectangleDrawingShape : RectangleDrawingShape
- {
- public override ShapeType ShapeType { get; } = ShapeType.DrawingRoundedRectangle;
-
- public override void OnConfigLoad()
- {
- base.OnConfigLoad();
- CornerRadius = AnnotationOptions.RoundedRectangleRadius;
- }
-
- public override void OnConfigSave()
- {
- base.OnConfigSave();
- AnnotationOptions.RoundedRectangleRadius = CornerRadius;
- }
- }
-}
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs
index b7fe371ec..ccb799723 100644
--- a/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/TextDrawingShape.cs
@@ -42,7 +42,7 @@ public override void OnConfigLoad()
BorderColor = AnnotationOptions.TextBorderColor;
BorderSize = AnnotationOptions.TextBorderSize;
FillColor = AnnotationOptions.TextFillColor;
- CornerRadius = AnnotationOptions.TextCornerRadius;
+ CornerRadius = AnnotationOptions.DrawingCornerRadius;
Shadow = AnnotationOptions.Shadow;
}
@@ -52,7 +52,7 @@ public override void OnConfigSave()
AnnotationOptions.TextBorderColor = BorderColor;
AnnotationOptions.TextBorderSize = BorderSize;
AnnotationOptions.TextFillColor = FillColor;
- AnnotationOptions.TextCornerRadius = CornerRadius;
+ AnnotationOptions.DrawingCornerRadius = CornerRadius;
AnnotationOptions.Shadow = Shadow;
}
diff --git a/ShareX.ScreenCaptureLib/Shapes/Region/RectangleRegionShape.cs b/ShareX.ScreenCaptureLib/Shapes/Region/RectangleRegionShape.cs
index 6d53b2e30..a589cad4c 100644
--- a/ShareX.ScreenCaptureLib/Shapes/Region/RectangleRegionShape.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/Region/RectangleRegionShape.cs
@@ -23,10 +23,31 @@
#endregion License Information (GPL v3)
+using ShareX.HelpersLib;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
namespace ShareX.ScreenCaptureLib
{
public class RectangleRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionRectangle;
+
+ public int CornerRadius { get; set; }
+
+ public override void OnConfigLoad()
+ {
+ CornerRadius = AnnotationOptions.RegionCornerRadius;
+ }
+
+ public override void OnConfigSave()
+ {
+ AnnotationOptions.RegionCornerRadius = CornerRadius;
+ }
+
+ public override void OnShapePathRequested(GraphicsPath gp, Rectangle rect)
+ {
+ gp.AddRoundedRectangle(rect, CornerRadius);
+ }
}
}
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Shapes/Region/RoundedRectangleRegionShape.cs b/ShareX.ScreenCaptureLib/Shapes/Region/RoundedRectangleRegionShape.cs
deleted file mode 100644
index bfb67d65e..000000000
--- a/ShareX.ScreenCaptureLib/Shapes/Region/RoundedRectangleRegionShape.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#region License Information (GPL v3)
-
-/*
- ShareX - A program that allows you to take screenshots and share any file type
- Copyright (c) 2007-2016 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 RoundedRectangleRegionShape : BaseRegionShape
- {
- public override ShapeType ShapeType { get; } = ShapeType.RegionRoundedRectangle;
-
- public int CornerRadius { get; set; }
-
- public override void OnConfigLoad()
- {
- CornerRadius = AnnotationOptions.RoundedRectangleRadius;
- }
-
- public override void OnConfigSave()
- {
- AnnotationOptions.RoundedRectangleRadius = CornerRadius;
- }
-
- public override void OnShapePathRequested(GraphicsPath gp, Rectangle rect)
- {
- gp.AddRoundedRectangle(rect, CornerRadius);
- }
- }
-}
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
index f1cfa9a07..df969d126 100644
--- a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
@@ -401,10 +401,10 @@ private void form_KeyDown(object sender, KeyEventArgs e)
CurrentShapeType = ShapeType.DrawingRectangle;
break;
case Keys.NumPad2:
- CurrentShapeType = ShapeType.DrawingRoundedRectangle;
+ CurrentShapeType = ShapeType.DrawingEllipse;
break;
case Keys.NumPad3:
- CurrentShapeType = ShapeType.DrawingEllipse;
+ CurrentShapeType = ShapeType.DrawingFreehand;
break;
case Keys.NumPad4:
CurrentShapeType = ShapeType.DrawingLine;
@@ -693,9 +693,6 @@ private BaseShape CreateShape(ShapeType shapeType)
case ShapeType.RegionRectangle:
shape = new RectangleRegionShape();
break;
- case ShapeType.RegionRoundedRectangle:
- shape = new RoundedRectangleRegionShape();
- break;
case ShapeType.RegionEllipse:
shape = new EllipseRegionShape();
break;
@@ -705,9 +702,6 @@ private BaseShape CreateShape(ShapeType shapeType)
case ShapeType.DrawingRectangle:
shape = new RectangleDrawingShape();
break;
- case ShapeType.DrawingRoundedRectangle:
- shape = new RoundedRectangleDrawingShape();
- break;
case ShapeType.DrawingEllipse:
shape = new EllipseDrawingShape();
break;
@@ -1017,7 +1011,6 @@ private bool IsShapeTypeRegion(ShapeType shapeType)
switch (shapeType)
{
case ShapeType.RegionRectangle:
- case ShapeType.RegionRoundedRectangle:
case ShapeType.RegionEllipse:
case ShapeType.RegionFreehand:
return true;
diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
index ac96a4b1c..1fafee92e 100644
--- a/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
@@ -184,9 +184,6 @@ private void CreateToolbar()
case ShapeType.RegionRectangle:
img = Resources.layer_shape_region;
break;
- case ShapeType.RegionRoundedRectangle:
- img = Resources.layer_shape_round_region;
- break;
case ShapeType.RegionEllipse:
img = Resources.layer_shape_ellipse_region;
break;
@@ -196,9 +193,6 @@ private void CreateToolbar()
case ShapeType.DrawingRectangle:
img = Resources.layer_shape;
break;
- case ShapeType.DrawingRoundedRectangle:
- img = Resources.layer_shape_round;
- break;
case ShapeType.DrawingEllipse:
img = Resources.layer_shape_ellipse;
break;
@@ -409,13 +403,13 @@ private void CreateToolbar()
{
ShapeType shapeType = CurrentShapeType;
- if (shapeType == ShapeType.RegionRoundedRectangle || shapeType == ShapeType.DrawingRoundedRectangle)
+ if (shapeType == ShapeType.RegionRectangle)
{
- AnnotationOptions.RoundedRectangleRadius = (int)tslnudCornerRadius.Content.Value;
+ AnnotationOptions.RegionCornerRadius = (int)tslnudCornerRadius.Content.Value;
}
- else if (shapeType == ShapeType.DrawingText)
+ else if (shapeType == ShapeType.DrawingRectangle || shapeType == ShapeType.DrawingText)
{
- AnnotationOptions.TextCornerRadius = (int)tslnudCornerRadius.Content.Value;
+ AnnotationOptions.DrawingCornerRadius = (int)tslnudCornerRadius.Content.Value;
}
UpdateCurrentShape();
@@ -893,13 +887,13 @@ private void UpdateMenu()
int cornerRadius = 0;
- if (shapeType == ShapeType.RegionRoundedRectangle || shapeType == ShapeType.DrawingRoundedRectangle)
+ if (shapeType == ShapeType.RegionRectangle)
{
- cornerRadius = AnnotationOptions.RoundedRectangleRadius;
+ cornerRadius = AnnotationOptions.RegionCornerRadius;
}
- else if (shapeType == ShapeType.DrawingText)
+ else if (shapeType == ShapeType.DrawingRectangle || shapeType == ShapeType.DrawingText)
{
- cornerRadius = AnnotationOptions.TextCornerRadius;
+ cornerRadius = AnnotationOptions.DrawingCornerRadius;
}
tslnudCornerRadius.Content.Value = cornerRadius;
@@ -918,9 +912,8 @@ private void UpdateMenu()
default:
tsddbShapeOptions.Visible = false;
break;
- case ShapeType.RegionRoundedRectangle:
+ case ShapeType.RegionRectangle:
case ShapeType.DrawingRectangle:
- case ShapeType.DrawingRoundedRectangle:
case ShapeType.DrawingEllipse:
case ShapeType.DrawingFreehand:
case ShapeType.DrawingLine:
@@ -944,7 +937,6 @@ private void UpdateMenu()
tsmiShadow.Visible = false;
break;
case ShapeType.DrawingRectangle:
- case ShapeType.DrawingRoundedRectangle:
case ShapeType.DrawingEllipse:
case ShapeType.DrawingFreehand:
case ShapeType.DrawingLine:
@@ -964,7 +956,6 @@ private void UpdateMenu()
tsbFillColor.Visible = false;
break;
case ShapeType.DrawingRectangle:
- case ShapeType.DrawingRoundedRectangle:
case ShapeType.DrawingEllipse:
case ShapeType.DrawingText:
case ShapeType.DrawingSpeechBalloon:
@@ -978,8 +969,8 @@ private void UpdateMenu()
default:
tslnudCornerRadius.Visible = false;
break;
- case ShapeType.RegionRoundedRectangle:
- case ShapeType.DrawingRoundedRectangle:
+ case ShapeType.RegionRectangle:
+ case ShapeType.DrawingRectangle:
case ShapeType.DrawingText:
tslnudCornerRadius.Visible = true;
break;
diff --git a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
index 801bfda19..1ade03eda 100644
--- a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
+++ b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
@@ -106,7 +106,6 @@
-
@@ -140,7 +139,6 @@
-