mirror of
https://github.com/ShareX/ShareX.git
synced 2024-08-07 14:28:42 +12:00
Added step shadow
This commit is contained in:
parent
37c3b7aa18
commit
a6192aa76a
4 changed files with 18 additions and 33 deletions
|
@ -43,7 +43,7 @@ public override void OnDraw(Graphics g)
|
||||||
DrawEllipse(g, BorderColor, BorderSize, FillColor, Rectangle);
|
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;
|
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public override void OnDraw(Graphics g)
|
||||||
DrawFreehand(g, BorderColor, BorderSize, positions.ToArray());
|
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)
|
if (points.Length > 0 && borderSize > 0 && borderColor.A > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ public override void OnDraw(Graphics g)
|
||||||
DrawRectangle(g, BorderColor, BorderSize, FillColor, Rectangle, CornerRadius);
|
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;
|
Brush brush = null;
|
||||||
Pen pen = null;
|
Pen pen = null;
|
||||||
|
|
|
@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
|
||||||
|
|
||||||
#endregion License Information (GPL v3)
|
#endregion License Information (GPL v3)
|
||||||
|
|
||||||
|
using ShareX.HelpersLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
@ -30,7 +31,7 @@ You should have received a copy of the GNU General Public License
|
||||||
|
|
||||||
namespace ShareX.ScreenCaptureLib
|
namespace ShareX.ScreenCaptureLib
|
||||||
{
|
{
|
||||||
public class StepDrawingShape : BaseDrawingShape
|
public class StepDrawingShape : EllipseDrawingShape
|
||||||
{
|
{
|
||||||
private const int DefaultSize = 30;
|
private const int DefaultSize = 30;
|
||||||
|
|
||||||
|
@ -70,37 +71,27 @@ public override void OnConfigSave()
|
||||||
|
|
||||||
public override void OnDraw(Graphics g)
|
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))
|
DrawNumber(g, Number, ShadowColor, Rectangle.LocationOffset(ShadowOffset));
|
||||||
{
|
|
||||||
g.FillEllipse(brush, Rectangle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BorderSize > 0 && BorderColor.A > 0)
|
DrawNumber(g, Number, BorderColor, Rectangle);
|
||||||
{
|
|
||||||
//g.DrawEllipse(Pens.Black, Rectangle.LocationOffset(0, 1));
|
|
||||||
|
|
||||||
using (Pen pen = new Pen(BorderColor, BorderSize))
|
|
||||||
{
|
|
||||||
g.DrawEllipse(pen, Rectangle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g.SmoothingMode = SmoothingMode.None;
|
protected void DrawNumber(Graphics g, int number, Color textColor, Rectangle rect)
|
||||||
|
{
|
||||||
if (Rectangle.Width > 20 && Rectangle.Height > 20)
|
if (rect.Width > 20 && rect.Height > 20)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
if (Number > 99)
|
if (number > 99)
|
||||||
{
|
{
|
||||||
offset = 20;
|
offset = 20;
|
||||||
}
|
}
|
||||||
else if (Number > 9)
|
else if (number > 9)
|
||||||
{
|
{
|
||||||
offset = 15;
|
offset = 15;
|
||||||
}
|
}
|
||||||
|
@ -109,25 +100,19 @@ public override void OnDraw(Graphics g)
|
||||||
offset = 10;
|
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 (Font font = new Font(FontFamily.GenericSansSerif, fontSize, FontStyle.Bold, GraphicsUnit.Pixel))
|
||||||
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
|
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.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
||||||
//g.DrawString(Number.ToString(), font, Brushes.Black, Rectangle.LocationOffset(1, 1), sf);
|
g.DrawString(number.ToString(), font, textBrush, rect, sf);
|
||||||
g.DrawString(Number.ToString(), font, textBrush, Rectangle, sf);
|
|
||||||
g.TextRenderingHint = TextRenderingHint.SystemDefault;
|
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)
|
public override void Resize(int x, int y, bool fromBottomRight)
|
||||||
{
|
{
|
||||||
Move(x, y);
|
Move(x, y);
|
||||||
|
|
Loading…
Reference in a new issue