Added shape category

This commit is contained in:
Jaex 2016-09-02 10:09:24 +03:00
parent e3232dee70
commit d3271e597b
5 changed files with 15 additions and 4 deletions

View file

@ -166,6 +166,13 @@ public enum RegionCaptureAction // Localized
CaptureActiveMonitor
}
public enum ShapeCategory
{
Region,
Drawing,
Effect
}
public enum ShapeType // Localized
{
RegionRectangle,

View file

@ -35,6 +35,8 @@ public abstract class BaseShape : IDisposable
{
protected const int MinimumSize = 3;
public abstract ShapeCategory ShapeCategory { get; }
public abstract ShapeType ShapeType { get; }
public Rectangle Rectangle { get; set; }
@ -73,8 +75,6 @@ public Point EndPosition
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
public virtual bool IsRegionShape { get; } = false;
internal ShapeManager Manager { get; set; }
protected RegionCaptureOptions Options => Manager.Config;
@ -136,7 +136,7 @@ public virtual void OnCreating()
{
Point pos = InputManager.MousePosition0Based;
if (Options.IsFixedSize && IsRegionShape)
if (Options.IsFixedSize && ShapeCategory == ShapeCategory.Region)
{
Manager.IsMoving = true;
Rectangle = new Rectangle(new Point(pos.X - Options.FixedSize.Width / 2, pos.Y - Options.FixedSize.Height / 2), Options.FixedSize);

View file

@ -29,6 +29,8 @@ namespace ShareX.ScreenCaptureLib
{
public abstract class BaseDrawingShape : BaseShape
{
public override ShapeCategory ShapeCategory { get; } = ShapeCategory.Drawing;
public Color BorderColor { get; set; }
public int BorderSize { get; set; }
public Color FillColor { get; set; }

View file

@ -29,6 +29,8 @@ namespace ShareX.ScreenCaptureLib
{
public abstract class BaseEffectShape : BaseShape
{
public override ShapeCategory ShapeCategory { get; } = ShapeCategory.Effect;
public abstract void OnDraw(Graphics g);
public virtual void OnDrawFinal(Graphics g, Bitmap bmp)

View file

@ -27,6 +27,6 @@ namespace ShareX.ScreenCaptureLib
{
public abstract class BaseRegionShape : BaseShape
{
public override bool IsRegionShape { get; } = true;
public override ShapeCategory ShapeCategory { get; } = ShapeCategory.Region;
}
}