mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Interim commit for region capture drawing support and shape system, currently just made it compile and will require many changes to support drawing shapes
This commit is contained in:
parent
8149340db7
commit
0709035daf
14 changed files with 487 additions and 114 deletions
|
@ -215,10 +215,10 @@ protected override void Draw(Graphics g)
|
|||
}
|
||||
}
|
||||
|
||||
List<RegionInfo> areas = AreaManager.ValidAreas.ToList();
|
||||
List<BaseRegionShape> areas = AreaManager.ValidRegionAreas.ToList();
|
||||
bool drawAreaExist = areas.Count > 0;
|
||||
|
||||
if (AreaManager.IsCurrentHoverAreaValid && areas.All(area => area.Area != AreaManager.CurrentHoverArea))
|
||||
if (AreaManager.IsCurrentHoverAreaValid && areas.All(area => area.Rectangle != AreaManager.CurrentHoverArea))
|
||||
{
|
||||
areas.Add(AreaManager.GetRegionInfo(AreaManager.CurrentHoverArea));
|
||||
}
|
||||
|
@ -290,12 +290,12 @@ protected override void Draw(Graphics g)
|
|||
|
||||
if (Config.ShowInfo)
|
||||
{
|
||||
foreach (RegionInfo regionInfo in areas)
|
||||
foreach (BaseShape regionInfo in areas)
|
||||
{
|
||||
if (regionInfo.Area.IsValid())
|
||||
if (regionInfo.Rectangle.IsValid())
|
||||
{
|
||||
string areaText = GetAreaText(regionInfo.Area);
|
||||
DrawAreaText(g, areaText, regionInfo.Area);
|
||||
string areaText = GetAreaText(regionInfo.Rectangle);
|
||||
DrawAreaText(g, areaText, regionInfo.Rectangle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ protected virtual void WriteTips(StringBuilder sb)
|
|||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Right_click___Esc__Cancel_capture);
|
||||
}
|
||||
|
||||
if (!Config.QuickCrop && AreaManager.Areas.Count > 0)
|
||||
if (!Config.QuickCrop && AreaManager.Regions.Length > 0)
|
||||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Double_Left_click___Enter__Capture_regions);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ protected virtual void WriteTips(StringBuilder sb)
|
|||
|
||||
sb.AppendLine();
|
||||
|
||||
if (Config.CurrentRegionShape == RegionShape.Rectangle) sb.Append("-> ");
|
||||
/*if (Config.CurrentRegionShape == RegionShape.Rectangle) sb.Append("-> ");
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Numpad_1__Rectangle_shape);
|
||||
if (Config.CurrentRegionShape == RegionShape.RoundedRectangle) sb.Append("-> ");
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Numpad_2__Rounded_rectangle_shape);
|
||||
|
@ -476,7 +476,7 @@ protected virtual void WriteTips(StringBuilder sb)
|
|||
case RegionShape.Triangle:
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Numpad___or____Change_triangle_angle);
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private string GetAreaText(Rectangle area)
|
||||
|
@ -696,14 +696,14 @@ public void UpdateRegionPath()
|
|||
regionDrawPath = null;
|
||||
}
|
||||
|
||||
RegionInfo[] areas = AreaManager.ValidAreas;
|
||||
BaseShape[] areas = AreaManager.ValidRegionAreas;
|
||||
|
||||
if (areas != null && areas.Length > 0)
|
||||
{
|
||||
regionFillPath = new GraphicsPath { FillMode = FillMode.Winding };
|
||||
regionDrawPath = new GraphicsPath { FillMode = FillMode.Winding };
|
||||
|
||||
foreach (RegionInfo regionInfo in AreaManager.ValidAreas)
|
||||
foreach (BaseRegionShape regionInfo in AreaManager.ValidRegionAreas)
|
||||
{
|
||||
AddShapePath(regionFillPath, regionInfo);
|
||||
AddShapePath(regionDrawPath, regionInfo, -1);
|
||||
|
@ -711,29 +711,10 @@ public void UpdateRegionPath()
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual void AddShapePath(GraphicsPath graphicsPath, RegionInfo regionInfo, int sizeOffset = 0)
|
||||
protected virtual void AddShapePath(GraphicsPath gp, BaseRegionShape shape, int sizeOffset = 0)
|
||||
{
|
||||
Rectangle area = regionInfo.Area.SizeOffset(sizeOffset);
|
||||
|
||||
switch (regionInfo.Shape)
|
||||
{
|
||||
default:
|
||||
case RegionShape.Rectangle:
|
||||
graphicsPath.AddRectangle(area);
|
||||
break;
|
||||
case RegionShape.RoundedRectangle:
|
||||
graphicsPath.AddRoundedRectangle(area, regionInfo.RoundedRectangleRadius);
|
||||
break;
|
||||
case RegionShape.Ellipse:
|
||||
graphicsPath.AddEllipse(area);
|
||||
break;
|
||||
case RegionShape.Triangle:
|
||||
graphicsPath.AddTriangle(area, regionInfo.TriangleAngle);
|
||||
break;
|
||||
case RegionShape.Diamond:
|
||||
graphicsPath.AddDiamond(area);
|
||||
break;
|
||||
}
|
||||
Rectangle rect = shape.Rectangle.SizeOffset(sizeOffset);
|
||||
shape.AddShape(gp, rect);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
|
|
@ -34,25 +34,33 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public class AreaManager
|
||||
{
|
||||
public List<RegionInfo> Areas { get; private set; }
|
||||
public List<BaseShape> Shapesa { get; private set; }
|
||||
|
||||
public RegionInfo[] ValidAreas
|
||||
public BaseRegionShape[] Regions
|
||||
{
|
||||
get
|
||||
{
|
||||
return Areas.Where(x => IsAreaValid(x.Area)).ToArray();
|
||||
return Shapesa.OfType<BaseRegionShape>().ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public BaseRegionShape[] ValidRegionAreas
|
||||
{
|
||||
get
|
||||
{
|
||||
return Regions.Where(x => IsAreaValid(x.Rectangle)).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public int SelectedAreaIndex { get; private set; }
|
||||
|
||||
public RegionInfo CurrentRegionInfo
|
||||
public BaseRegionShape CurrentRegionInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SelectedAreaIndex > -1)
|
||||
{
|
||||
return Areas[SelectedAreaIndex];
|
||||
return Regions[SelectedAreaIndex];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -65,7 +73,7 @@ public Rectangle CurrentArea
|
|||
{
|
||||
if (SelectedAreaIndex > -1)
|
||||
{
|
||||
return Areas[SelectedAreaIndex].Area;
|
||||
return Regions[SelectedAreaIndex].Rectangle;
|
||||
}
|
||||
|
||||
return Rectangle.Empty;
|
||||
|
@ -74,7 +82,7 @@ public Rectangle CurrentArea
|
|||
{
|
||||
if (SelectedAreaIndex > -1)
|
||||
{
|
||||
Areas[SelectedAreaIndex].Area = value;
|
||||
Regions[SelectedAreaIndex].Rectangle = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +139,7 @@ public AreaManager(RectangleRegion surface)
|
|||
this.surface = surface;
|
||||
ResizeManager = new ResizeManager(surface, this);
|
||||
|
||||
Areas = new List<RegionInfo>();
|
||||
Shapesa = new List<BaseShape>();
|
||||
SelectedAreaIndex = -1;
|
||||
RoundedRectangleRadius = 25;
|
||||
RoundedRectangleRadiusIncrement = 3;
|
||||
|
@ -173,58 +181,58 @@ private void surface_KeyDown(object sender, KeyEventArgs e)
|
|||
IsSnapResizing = true;
|
||||
break;
|
||||
case Keys.NumPad1:
|
||||
ChangeCurrentShape(RegionShape.Rectangle);
|
||||
//ChangeCurrentShape(RegionShape.Rectangle);
|
||||
break;
|
||||
case Keys.NumPad2:
|
||||
ChangeCurrentShape(RegionShape.RoundedRectangle);
|
||||
//ChangeCurrentShape(RegionShape.RoundedRectangle);
|
||||
break;
|
||||
case Keys.NumPad3:
|
||||
ChangeCurrentShape(RegionShape.Ellipse);
|
||||
//ChangeCurrentShape(RegionShape.Ellipse);
|
||||
break;
|
||||
case Keys.NumPad4:
|
||||
ChangeCurrentShape(RegionShape.Triangle);
|
||||
//ChangeCurrentShape(RegionShape.Triangle);
|
||||
break;
|
||||
case Keys.NumPad5:
|
||||
ChangeCurrentShape(RegionShape.Diamond);
|
||||
break;
|
||||
case Keys.Add:
|
||||
switch (surface.Config.CurrentRegionShape)
|
||||
{
|
||||
case RegionShape.RoundedRectangle:
|
||||
RoundedRectangleRadius += RoundedRectangleRadiusIncrement;
|
||||
break;
|
||||
case RegionShape.Triangle:
|
||||
if (TriangleAngle == TriangleAngle.Left)
|
||||
{
|
||||
TriangleAngle = TriangleAngle.Top;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriangleAngle++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateCurrentRegionInfo();
|
||||
break;
|
||||
case Keys.Subtract:
|
||||
switch (surface.Config.CurrentRegionShape)
|
||||
{
|
||||
case RegionShape.RoundedRectangle:
|
||||
RoundedRectangleRadius = Math.Max(0, RoundedRectangleRadius - RoundedRectangleRadiusIncrement);
|
||||
break;
|
||||
case RegionShape.Triangle:
|
||||
if (TriangleAngle == TriangleAngle.Top)
|
||||
{
|
||||
TriangleAngle = TriangleAngle.Left;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriangleAngle--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateCurrentRegionInfo();
|
||||
//ChangeCurrentShape(RegionShape.Diamond);
|
||||
break;
|
||||
/*case Keys.Add:
|
||||
switch (surface.Config.CurrentRegionShape)
|
||||
{
|
||||
case RegionShape.RoundedRectangle:
|
||||
RoundedRectangleRadius += RoundedRectangleRadiusIncrement;
|
||||
break;
|
||||
case RegionShape.Triangle:
|
||||
if (TriangleAngle == TriangleAngle.Left)
|
||||
{
|
||||
TriangleAngle = TriangleAngle.Top;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriangleAngle++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateCurrentRegionInfo();
|
||||
break;
|
||||
case Keys.Subtract:
|
||||
switch (surface.Config.CurrentRegionShape)
|
||||
{
|
||||
case RegionShape.RoundedRectangle:
|
||||
RoundedRectangleRadius = Math.Max(0, RoundedRectangleRadius - RoundedRectangleRadiusIncrement);
|
||||
break;
|
||||
case RegionShape.Triangle:
|
||||
if (TriangleAngle == TriangleAngle.Top)
|
||||
{
|
||||
TriangleAngle = TriangleAngle.Left;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriangleAngle--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateCurrentRegionInfo();
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,7 +477,7 @@ private void CancelRegionSelection()
|
|||
|
||||
if (areaIndex > -1)
|
||||
{
|
||||
Areas.RemoveAt(areaIndex);
|
||||
//Areas.RemoveAt(areaIndex);
|
||||
DeselectArea();
|
||||
}
|
||||
else
|
||||
|
@ -478,7 +486,7 @@ private void CancelRegionSelection()
|
|||
}
|
||||
}
|
||||
|
||||
private void ChangeCurrentShape(RegionShape shape)
|
||||
private void ChangeCurrentShape(BaseShape shape)
|
||||
{
|
||||
surface.Config.CurrentRegionShape = shape;
|
||||
UpdateCurrentRegionInfo();
|
||||
|
@ -486,27 +494,31 @@ private void ChangeCurrentShape(RegionShape shape)
|
|||
|
||||
private void AddRegionInfo(Rectangle rect)
|
||||
{
|
||||
Areas.Add(GetRegionInfo(rect));
|
||||
SelectedAreaIndex = Areas.Count - 1;
|
||||
Shapesa.Add(GetRegionInfo(rect));
|
||||
SelectedAreaIndex = Regions.Length - 1;
|
||||
}
|
||||
|
||||
public RegionInfo GetRegionInfo(Rectangle rect)
|
||||
public BaseRegionShape GetRegionInfo(Rectangle rect)
|
||||
{
|
||||
RegionInfo regionInfo = new RegionInfo(rect, surface.Config.CurrentRegionShape);
|
||||
regionInfo.RoundedRectangleRadius = RoundedRectangleRadius;
|
||||
regionInfo.TriangleAngle = TriangleAngle;
|
||||
BaseRegionShape regionInfo = new RectangleRegionShape()
|
||||
{
|
||||
Rectangle = rect
|
||||
};
|
||||
//surface.Config.CurrentRegionShape
|
||||
//regionInfo.RoundedRectangleRadius = RoundedRectangleRadius;
|
||||
//regionInfo.TriangleAngle = TriangleAngle;
|
||||
return regionInfo;
|
||||
}
|
||||
|
||||
private void UpdateCurrentRegionInfo()
|
||||
{
|
||||
RegionInfo regionInfo = CurrentRegionInfo;
|
||||
BaseShape regionInfo = CurrentRegionInfo;
|
||||
|
||||
if (regionInfo != null)
|
||||
{
|
||||
regionInfo.Shape = surface.Config.CurrentRegionShape;
|
||||
/*regionInfo.Shape = surface.Config.CurrentRegionShape;
|
||||
regionInfo.RoundedRectangleRadius = RoundedRectangleRadius;
|
||||
regionInfo.TriangleAngle = TriangleAngle;
|
||||
regionInfo.TriangleAngle = TriangleAngle;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,9 +538,11 @@ private void DeselectArea()
|
|||
|
||||
private void RemoveCurrentArea()
|
||||
{
|
||||
if (SelectedAreaIndex > -1)
|
||||
BaseShape shape = CurrentRegionInfo;
|
||||
|
||||
if (shape != null)
|
||||
{
|
||||
Areas.RemoveAt(SelectedAreaIndex);
|
||||
Shapesa.Remove(shape);
|
||||
DeselectArea();
|
||||
}
|
||||
}
|
||||
|
@ -540,9 +554,9 @@ private bool IsAreaValid(Rectangle rect)
|
|||
|
||||
public int AreaIntersect(Point mousePosition)
|
||||
{
|
||||
for (int i = Areas.Count - 1; i >= 0; i--)
|
||||
for (int i = Regions.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (Areas[i].Area.Contains(mousePosition))
|
||||
if (Regions[i].Rectangle.Contains(mousePosition))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -562,7 +576,7 @@ public Rectangle GetAreaIntersectWithMouse()
|
|||
|
||||
if (areaIndex > -1)
|
||||
{
|
||||
return Areas[areaIndex].Area;
|
||||
return Regions[areaIndex].Rectangle;
|
||||
}
|
||||
|
||||
return Rectangle.Empty;
|
||||
|
@ -575,15 +589,15 @@ public bool IsAreaIntersect()
|
|||
|
||||
public Rectangle CombineAreas()
|
||||
{
|
||||
RegionInfo[] areas = ValidAreas;
|
||||
BaseShape[] areas = ValidRegionAreas;
|
||||
|
||||
if (areas.Length > 0)
|
||||
{
|
||||
Rectangle rect = areas[0].Area;
|
||||
Rectangle rect = areas[0].Rectangle;
|
||||
|
||||
for (int i = 1; i < areas.Length; i++)
|
||||
{
|
||||
rect = Rectangle.Union(rect, areas[i].Area);
|
||||
rect = Rectangle.Union(rect, areas[i].Rectangle);
|
||||
}
|
||||
|
||||
return rect;
|
||||
|
|
43
ShareX.ScreenCaptureLib/Shapes/BaseShape.cs
Normal file
43
ShareX.ScreenCaptureLib/Shapes/BaseShape.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
#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 System.Drawing;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class BaseShape
|
||||
{
|
||||
public Rectangle Rectangle { get; set; }
|
||||
|
||||
public BaseShape()
|
||||
{
|
||||
}
|
||||
|
||||
public BaseShape(Rectangle rect)
|
||||
{
|
||||
Rectangle = rect;
|
||||
}
|
||||
}
|
||||
}
|
36
ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs
Normal file
36
ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
#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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class BaseDrawingShape : BaseShape
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class RectangleDrawingShape : BaseDrawingShape
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class RoundedRectangleDrawingShape : BaseDrawingShape
|
||||
{
|
||||
}
|
||||
}
|
44
ShareX.ScreenCaptureLib/Shapes/Region/BaseRegionShape.cs
Normal file
44
ShareX.ScreenCaptureLib/Shapes/Region/BaseRegionShape.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
#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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public abstract class BaseRegionShape : BaseShape
|
||||
{
|
||||
public abstract void AddShape(GraphicsPath gp, Rectangle rect);
|
||||
|
||||
public void AddShape(GraphicsPath gp)
|
||||
{
|
||||
AddShape(gp, Rectangle);
|
||||
}
|
||||
}
|
||||
}
|
43
ShareX.ScreenCaptureLib/Shapes/Region/DiamondRegionShape.cs
Normal file
43
ShareX.ScreenCaptureLib/Shapes/Region/DiamondRegionShape.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
#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;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class DiamondRegionShape : BaseRegionShape
|
||||
{
|
||||
public override void AddShape(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddDiamond(rect);
|
||||
}
|
||||
}
|
||||
}
|
42
ShareX.ScreenCaptureLib/Shapes/Region/EllipseRegionShape.cs
Normal file
42
ShareX.ScreenCaptureLib/Shapes/Region/EllipseRegionShape.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
#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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class EllipseRegionShape : BaseRegionShape
|
||||
{
|
||||
public override void AddShape(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddEllipse(rect);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class RectangleRegionShape : BaseRegionShape
|
||||
{
|
||||
public override void AddShape(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddRectangle(rect);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,21 +24,22 @@ You should have received a copy of the GNU General Public License
|
|||
#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;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class RegionInfo
|
||||
public class RoundedRectangleRegionShape : BaseRegionShape
|
||||
{
|
||||
public Rectangle Area { get; set; }
|
||||
public RegionShape Shape { get; set; }
|
||||
public float RoundedRectangleRadius { get; set; }
|
||||
public TriangleAngle TriangleAngle { get; set; }
|
||||
public float Radius { get; set; }
|
||||
|
||||
public RegionInfo(Rectangle area, RegionShape shape)
|
||||
public override void AddShape(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
Area = area;
|
||||
Shape = shape;
|
||||
gp.AddRoundedRectangle(rect, Radius);
|
||||
}
|
||||
}
|
||||
}
|
45
ShareX.ScreenCaptureLib/Shapes/Region/TriangleRegionShape.cs
Normal file
45
ShareX.ScreenCaptureLib/Shapes/Region/TriangleRegionShape.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
#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;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
public class TriangleRegionShape : BaseRegionShape
|
||||
{
|
||||
public TriangleAngle Angle { get; set; }
|
||||
|
||||
public override void AddShape(GraphicsPath gp, Rectangle rect)
|
||||
{
|
||||
gp.AddTriangle(rect, Angle);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -80,7 +80,14 @@
|
|||
</Compile>
|
||||
<Compile Include="RectangleAnnotateOptions.cs" />
|
||||
<Compile Include="RegionHelpers\ColorBlinkAnimation.cs" />
|
||||
<Compile Include="RegionHelpers\RegionInfo.cs" />
|
||||
<Compile Include="Shapes\BaseShape.cs" />
|
||||
<Compile Include="Shapes\Drawing\BaseDrawingShape.cs" />
|
||||
<Compile Include="Shapes\Drawing\RectangleDrawingShape.cs" />
|
||||
<Compile Include="Shapes\Drawing\RoundedRectangleDrawingShape.cs" />
|
||||
<Compile Include="Shapes\Region\DiamondRegionShape.cs" />
|
||||
<Compile Include="Shapes\Region\EllipseRegionShape.cs" />
|
||||
<Compile Include="Shapes\Region\RectangleRegionShape.cs" />
|
||||
<Compile Include="Shapes\Region\BaseRegionShape.cs" />
|
||||
<Compile Include="Screencast\FFmpegOptions.cs" />
|
||||
<Compile Include="Screencast\FFmpegHelper.cs" />
|
||||
<Compile Include="Screencast\FFmpegOptionsForm.cs">
|
||||
|
@ -120,6 +127,8 @@
|
|||
<Compile Include="RegionHelpers\ResizeManager.cs" />
|
||||
<Compile Include="RegionHelpers\ShapeCaptureHelpers.cs" />
|
||||
<Compile Include="ScrollingCaptureOptions.cs" />
|
||||
<Compile Include="Shapes\Region\RoundedRectangleRegionShape.cs" />
|
||||
<Compile Include="Shapes\Region\TriangleRegionShape.cs" />
|
||||
<Compile Include="SimpleWindowInfo.cs" />
|
||||
<Compile Include="SnapSize.cs" />
|
||||
<Compile Include="SurfaceOptions.cs" />
|
||||
|
@ -262,6 +271,7 @@
|
|||
<DependentUpon>FFmpegOptionsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
@ -98,8 +98,8 @@ public class SurfaceOptions
|
|||
[Description("How close to a snap size you must be for it to snap.")]
|
||||
public List<SnapSize> SnapSizes { get; set; }
|
||||
|
||||
[DefaultValue(RegionShape.Rectangle), Description("Current region shape.")]
|
||||
public RegionShape CurrentRegionShape { get; set; }
|
||||
[Description("Current region shape.")]
|
||||
public BaseShape CurrentRegionShape { get; set; } = new RectangleRegionShape();
|
||||
|
||||
public SurfaceOptions()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue