diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/EllipseDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/EllipseDrawingShape.cs index 90267af7e..0bb19a8da 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/EllipseDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/EllipseDrawingShape.cs @@ -43,7 +43,7 @@ public override void OnDraw(Graphics g) DrawEllipse(g, BorderColor, BorderSize, FillColor, Rectangle); } - private void DrawEllipse(Graphics g, Color borderColor, int borderSize, Color fillColor, Rectangle rect) + protected void DrawEllipse(Graphics g, Color borderColor, int borderSize, Color fillColor, Rectangle rect) { g.SmoothingMode = SmoothingMode.HighQuality; diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs index 1483be9e4..45af4ba0c 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/FreehandDrawingShape.cs @@ -117,7 +117,7 @@ public override void OnDraw(Graphics g) DrawFreehand(g, BorderColor, BorderSize, positions.ToArray()); } - private void DrawFreehand(Graphics g, Color borderColor, int borderSize, Point[] points) + protected void DrawFreehand(Graphics g, Color borderColor, int borderSize, Point[] points) { if (points.Length > 0 && borderSize > 0 && borderColor.A > 0) { diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs index 5b525e99a..ecf682afc 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/RectangleDrawingShape.cs @@ -45,7 +45,7 @@ public override void OnDraw(Graphics g) DrawRectangle(g, BorderColor, BorderSize, FillColor, Rectangle, CornerRadius); } - private void DrawRectangle(Graphics g, Color borderColor, int borderSize, Color fillColor, Rectangle rect, int cornerRadius) + protected void DrawRectangle(Graphics g, Color borderColor, int borderSize, Color fillColor, Rectangle rect, int cornerRadius) { Brush brush = null; Pen pen = null; diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/StepDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/StepDrawingShape.cs index f8f1785e2..6a8f39e48 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/StepDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/StepDrawingShape.cs @@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License #endregion License Information (GPL v3) +using ShareX.HelpersLib; using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -30,7 +31,7 @@ You should have received a copy of the GNU General Public License namespace ShareX.ScreenCaptureLib { - public class StepDrawingShape : BaseDrawingShape + public class StepDrawingShape : EllipseDrawingShape { private const int DefaultSize = 30; @@ -70,37 +71,27 @@ public override void OnConfigSave() public override void OnDraw(Graphics g) { - g.SmoothingMode = SmoothingMode.HighQuality; + base.OnDraw(g); - if (FillColor.A > 0) + if (Shadow) { - using (Brush brush = new SolidBrush(FillColor)) - { - g.FillEllipse(brush, Rectangle); - } + DrawNumber(g, Number, ShadowColor, Rectangle.LocationOffset(ShadowOffset)); } - if (BorderSize > 0 && BorderColor.A > 0) - { - //g.DrawEllipse(Pens.Black, Rectangle.LocationOffset(0, 1)); + DrawNumber(g, Number, BorderColor, Rectangle); + } - using (Pen pen = new Pen(BorderColor, BorderSize)) - { - g.DrawEllipse(pen, Rectangle); - } - } - - g.SmoothingMode = SmoothingMode.None; - - if (Rectangle.Width > 20 && Rectangle.Height > 20) + protected void DrawNumber(Graphics g, int number, Color textColor, Rectangle rect) + { + if (rect.Width > 20 && rect.Height > 20) { int offset; - if (Number > 99) + if (number > 99) { offset = 20; } - else if (Number > 9) + else if (number > 9) { offset = 15; } @@ -109,25 +100,19 @@ public override void OnDraw(Graphics g) offset = 10; } - int fontSize = Math.Min(Rectangle.Width, Rectangle.Height) - offset; + int fontSize = Math.Min(rect.Width, rect.Height) - offset; using (Font font = new Font(FontFamily.GenericSansSerif, fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }) - using (Brush textBrush = new SolidBrush(BorderColor)) + using (Brush textBrush = new SolidBrush(textColor)) { g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; - //g.DrawString(Number.ToString(), font, Brushes.Black, Rectangle.LocationOffset(1, 1), sf); - g.DrawString(Number.ToString(), font, textBrush, Rectangle, sf); + g.DrawString(number.ToString(), font, textBrush, rect, sf); g.TextRenderingHint = TextRenderingHint.SystemDefault; } } } - public override void OnShapePathRequested(GraphicsPath gp, Rectangle rect) - { - gp.AddEllipse(rect); - } - public override void Resize(int x, int y, bool fromBottomRight) { Move(x, y);