Added ellipse drawing

This commit is contained in:
Jaex 2016-05-05 20:42:56 +03:00
parent a9b446e15e
commit 90bb7e8b99
5 changed files with 72 additions and 2 deletions

View file

@ -144,6 +144,8 @@ public enum ShapeType
DrawingRectangle,
[Description("Drawing: Rounded rectangle")]
DrawingRoundedRectangle,
[Description("Drawing: Ellipse")]
DrawingEllipse,
[Description("Drawing: Line")]
DrawingLine,
[Description("Drawing: Arrow")]

View file

@ -728,6 +728,9 @@ public BaseShape CreateRegionShape(Rectangle rect)
Radius = RoundedRectangleRadius
};
break;
case ShapeType.DrawingEllipse:
shape = new EllipseDrawingShape();
break;
case ShapeType.DrawingArrow:
shape = new ArrowDrawingShape();
break;

View file

@ -0,0 +1,64 @@
#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 <http://www.gnu.org/licenses/>.
*/
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ShareX.ScreenCaptureLib
{
public class EllipseDrawingShape : BaseDrawingShape
{
public override ShapeType ShapeType { get; } = ShapeType.DrawingEllipse;
public override void Draw(Graphics g)
{
g.SmoothingMode = SmoothingMode.HighQuality;
if (FillColor != Color.Transparent)
{
using (Brush brush = new SolidBrush(FillColor))
{
g.FillEllipse(brush, Rectangle);
}
}
if (BorderColor != Color.Transparent && BorderSize > 0)
{
using (Pen pen = new Pen(BorderColor, BorderSize))
{
g.DrawEllipse(pen, Rectangle);
}
}
g.SmoothingMode = SmoothingMode.None;
}
}
}

View file

@ -83,6 +83,7 @@
<Compile Include="Shapes\BaseShape.cs" />
<Compile Include="Shapes\Drawing\ArrowDrawingShape.cs" />
<Compile Include="Shapes\Drawing\BaseDrawingShape.cs" />
<Compile Include="Shapes\Drawing\EllipseDrawingShape.cs" />
<Compile Include="Shapes\Drawing\LineDrawingShape.cs" />
<Compile Include="Shapes\Drawing\RectangleDrawingShape.cs" />
<Compile Include="Shapes\Drawing\RoundedRectangleDrawingShape.cs" />

View file

@ -11,5 +11,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("82E6AC09-0FEF-4390-AD9F-0DD3F5561EFC")]
[assembly: AssemblyVersion("10.9.1")]
[assembly: AssemblyFileVersion("10.9.1")]
[assembly: AssemblyVersion("11.0.0")]
[assembly: AssemblyFileVersion("11.0.0")]