mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
add a hatch pattern to the crop selection rectangle
This commit is contained in:
parent
e31e63a632
commit
b35c436e3f
1 changed files with 12 additions and 3 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Greenshot.Base.Interfaces;
|
using Greenshot.Base.Interfaces;
|
||||||
using Greenshot.Base.Interfaces.Drawing;
|
using Greenshot.Base.Interfaces.Drawing;
|
||||||
|
@ -161,25 +162,33 @@ namespace Greenshot.Editor.Drawing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
using Brush cropBrush = new SolidBrush(Color.FromArgb(100, 150, 150, 100));
|
|
||||||
Rectangle cropRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
Rectangle cropRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
||||||
Rectangle selectionRect = new Rectangle(cropRectangle.Left - 1, cropRectangle.Top - 1, cropRectangle.Width + 1, cropRectangle.Height + 1);
|
Rectangle selectionRect = new Rectangle(cropRectangle.Left - 1, cropRectangle.Top - 1, cropRectangle.Width + 1, cropRectangle.Height + 1);
|
||||||
Size imageSize = _parent.Image.Size;
|
Size imageSize = _parent.Image.Size;
|
||||||
|
var foreColor = Color.FromArgb(80, 100, 100, 100);
|
||||||
|
var backColor = Color.FromArgb(100, 150, 150, 100);
|
||||||
|
|
||||||
DrawSelectionBorder(g, selectionRect);
|
DrawSelectionBorder(g, selectionRect);
|
||||||
|
|
||||||
switch (GetFieldValue(FieldType.CROPMODE))
|
switch (GetFieldValue(FieldType.CROPMODE))
|
||||||
{
|
{
|
||||||
case CropModes.Horizontal:
|
case CropModes.Horizontal:
|
||||||
|
{
|
||||||
|
using HatchBrush hBrush = new HatchBrush(HatchStyle.Horizontal, foreColor, backColor);
|
||||||
|
//draw inside
|
||||||
|
g.FillRectangle(hBrush, cropRectangle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CropModes.Vertical:
|
case CropModes.Vertical:
|
||||||
{
|
{
|
||||||
|
using HatchBrush hBrush = new HatchBrush(HatchStyle.Vertical, foreColor, backColor);
|
||||||
//draw inside
|
//draw inside
|
||||||
g.FillRectangle(cropBrush, cropRectangle);
|
g.FillRectangle(hBrush, cropRectangle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
using Brush cropBrush = new HatchBrush(HatchStyle.Cross, foreColor, backColor);
|
||||||
//draw outside
|
//draw outside
|
||||||
// top
|
// top
|
||||||
g.FillRectangle(cropBrush, new Rectangle(0, 0, imageSize.Width, cropRectangle.Top));
|
g.FillRectangle(cropBrush, new Rectangle(0, 0, imageSize.Width, cropRectangle.Top));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue