mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Show nodes on drawing shapes, added border size
This commit is contained in:
parent
db15ee55cb
commit
a568e98617
7 changed files with 37 additions and 19 deletions
|
@ -218,11 +218,11 @@ protected override void Draw(Graphics g)
|
|||
List<BaseShape> areas = AreaManager.ValidRegions.ToList();
|
||||
bool drawAreaExist = areas.Count > 0;
|
||||
|
||||
/*if (AreaManager.IsCurrentHoverAreaValid && areas.All(area => area.Rectangle != AreaManager.CurrentHoverRectangle))
|
||||
if (AreaManager.IsCurrentShapeTypeRegion && AreaManager.IsCurrentHoverAreaValid && areas.All(area => area.Rectangle != AreaManager.CurrentHoverRectangle))
|
||||
{
|
||||
BaseShape shape = AreaManager.CreateRegionShape(AreaManager.CurrentHoverRectangle);
|
||||
areas.Add(shape);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (areas.Count > 0)
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ protected override void Draw(Graphics g)
|
|||
drawingShape.Draw(g);
|
||||
}
|
||||
|
||||
if (areas.Count > 0)
|
||||
if (areas.Count > 0 && AreaManager.IsCurrentShapeTypeRegion)
|
||||
{
|
||||
if (AreaManager.IsCurrentHoverAreaValid)
|
||||
{
|
||||
|
@ -283,7 +283,6 @@ protected override void Draw(Graphics g)
|
|||
{
|
||||
g.DrawRectangleProper(borderPen, AreaManager.CurrentRectangle);
|
||||
g.DrawRectangleProper(borderDotPen, AreaManager.CurrentRectangle);
|
||||
DrawObjects(g);
|
||||
|
||||
if (RulerMode)
|
||||
{
|
||||
|
@ -310,6 +309,8 @@ protected override void Draw(Graphics g)
|
|||
}
|
||||
}
|
||||
|
||||
DrawObjects(g);
|
||||
|
||||
if (Config.ShowTips)
|
||||
{
|
||||
DrawTips(g, 10, 10);
|
||||
|
|
|
@ -102,6 +102,15 @@ public bool IsCurrentHoverAreaValid
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsCurrentShapeTypeRegion
|
||||
{
|
||||
get
|
||||
{
|
||||
return CurrentShapeType == ShapeType.RegionRectangle || CurrentShapeType == ShapeType.RegionRoundedRectangle || CurrentShapeType == ShapeType.RegionEllipse ||
|
||||
CurrentShapeType == ShapeType.RegionTriangle || CurrentShapeType == ShapeType.RegionDiamond;
|
||||
}
|
||||
}
|
||||
|
||||
public float RoundedRectangleRadius { get; set; } = 25;
|
||||
public int RoundedRectangleRadiusIncrement { get; set; } = 3;
|
||||
public TriangleAngle TriangleAngle { get; set; } = TriangleAngle.Top;
|
||||
|
|
|
@ -29,7 +29,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class BaseShape
|
||||
public abstract class BaseShape
|
||||
{
|
||||
public Rectangle Rectangle { get; set; }
|
||||
|
||||
|
@ -42,10 +42,7 @@ public BaseShape(Rectangle rect)
|
|||
Rectangle = rect;
|
||||
}
|
||||
|
||||
public virtual void AddShapePath(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddRectangle(rect);
|
||||
}
|
||||
public abstract void AddShapePath(GraphicsPath gp, Rectangle rect);
|
||||
|
||||
public void AddShapePath(GraphicsPath gp)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ You should have received a copy of the GNU General Public License
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
@ -34,9 +35,15 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public abstract class BaseDrawingShape : BaseShape
|
||||
{
|
||||
public Color ForegroundColor { get; set; } = Color.Red;
|
||||
public Color BackgroundColor { get; set; } = Color.Transparent;
|
||||
public Color BorderColor { get; set; } = Color.Red;
|
||||
public Color FillColor { get; set; } = Color.Transparent;
|
||||
public int BorderSize { get; set; } = 2;
|
||||
|
||||
public abstract void Draw(Graphics g);
|
||||
|
||||
public override void AddShapePath(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddRectangle(rect);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,17 +36,17 @@ public class RectangleDrawingShape : BaseDrawingShape
|
|||
{
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
if (BackgroundColor != Color.Transparent)
|
||||
if (FillColor != Color.Transparent)
|
||||
{
|
||||
using (Brush brush = new SolidBrush(BackgroundColor))
|
||||
using (Brush brush = new SolidBrush(FillColor))
|
||||
{
|
||||
g.FillRectangle(brush, Rectangle);
|
||||
}
|
||||
}
|
||||
|
||||
if (ForegroundColor != Color.Transparent)
|
||||
if (BorderColor != Color.Transparent)
|
||||
{
|
||||
using (Pen pen = new Pen(ForegroundColor))
|
||||
using (Pen pen = new Pen(BorderColor, BorderSize))
|
||||
{
|
||||
g.DrawRectangleProper(pen, Rectangle);
|
||||
}
|
||||
|
|
|
@ -43,14 +43,14 @@ public override void Draw(Graphics g)
|
|||
|
||||
try
|
||||
{
|
||||
if (BackgroundColor != Color.Transparent)
|
||||
if (FillColor != Color.Transparent)
|
||||
{
|
||||
brush = new SolidBrush(BackgroundColor);
|
||||
brush = new SolidBrush(FillColor);
|
||||
}
|
||||
|
||||
if (ForegroundColor != Color.Transparent)
|
||||
if (BorderColor != Color.Transparent)
|
||||
{
|
||||
pen = new Pen(ForegroundColor);
|
||||
pen = new Pen(BorderColor, BorderSize);
|
||||
}
|
||||
|
||||
g.DrawRoundedRectangle(brush, pen, Rectangle, Radius);
|
||||
|
|
|
@ -34,5 +34,9 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public class RectangleRegionShape : BaseRegionShape
|
||||
{
|
||||
public override void AddShapePath(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddRectangle(rect);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue