mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
fixed #231: When doing recording selection proper even size handling
This commit is contained in:
parent
e0634cfc4a
commit
7ed08a007a
6 changed files with 21 additions and 9 deletions
|
@ -63,6 +63,15 @@ public static void DrawRoundedRectangle(this Graphics g, Brush brush, Pen pen, i
|
|||
DrawRoundedRectangle(g, brush, pen, new Rectangle(x, y, width, height), radius);
|
||||
}
|
||||
|
||||
public static void DrawDiamond(this Graphics g, Pen pen, Rectangle rect)
|
||||
{
|
||||
using (GraphicsPath gp = new GraphicsPath())
|
||||
{
|
||||
gp.AddDiamond(rect);
|
||||
g.DrawPath(pen, gp);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawCrossRectangle(this Graphics g, Pen pen, Rectangle rect, int crossSize)
|
||||
{
|
||||
rect = rect.SizeOffset(-1);
|
||||
|
|
|
@ -311,8 +311,8 @@ public static Rectangle GetWindowRectangle(IntPtr handle, bool maximizeFix = tru
|
|||
|
||||
public static Rectangle EvenRectangleSize(Rectangle rect)
|
||||
{
|
||||
rect.Width += rect.Width & 1;
|
||||
rect.Height += rect.Height & 1;
|
||||
rect.Width -= rect.Width & 1;
|
||||
rect.Height -= rect.Height & 1;
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ internal enum NodePosition
|
|||
|
||||
internal enum NodeShape
|
||||
{
|
||||
Square, Circle
|
||||
Square, Circle, Diamond
|
||||
}
|
||||
|
||||
public enum FFmpegVideoCodec
|
||||
|
|
|
@ -145,7 +145,7 @@ protected override void Draw(Graphics g)
|
|||
|
||||
private void CreateNode()
|
||||
{
|
||||
NodeObject newNode = new NodeObject() { Shape = NodeShape.Circle };
|
||||
NodeObject newNode = new NodeObject() { Shape = NodeShape.Diamond };
|
||||
ActivateNode(newNode);
|
||||
nodes.Add(newNode);
|
||||
DrawableObjects.Add(newNode);
|
||||
|
|
|
@ -70,6 +70,10 @@ public override void Draw(Graphics g)
|
|||
g.DrawEllipse(Pens.White, rect.RectangleOffset(-1));
|
||||
g.DrawEllipse(Pens.Black, rect);
|
||||
break;
|
||||
case NodeShape.Diamond:
|
||||
g.DrawDiamond(Pens.White, rect.RectangleOffset(-1));
|
||||
g.DrawDiamond(Pens.Black, rect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,10 +75,7 @@ private void TrayIcon_MouseClick(object sender, MouseEventArgs e)
|
|||
|
||||
private void SelectRegion()
|
||||
{
|
||||
if (TaskHelpers.SelectRegion(out captureRectangle) && !captureRectangle.IsEmpty)
|
||||
{
|
||||
captureRectangle = CaptureHelpers.EvenRectangleSize(captureRectangle);
|
||||
}
|
||||
TaskHelpers.SelectRegion(out captureRectangle);
|
||||
}
|
||||
|
||||
private void ActiveWindowRegion(TaskSettings taskSettings)
|
||||
|
@ -147,7 +144,9 @@ public void StartRecording(TaskSettings taskSettings)
|
|||
SelectRegion();
|
||||
}
|
||||
|
||||
if (IsRecording || captureRectangle.IsEmpty || screenRecorder != null)
|
||||
captureRectangle = CaptureHelpers.EvenRectangleSize(captureRectangle);
|
||||
|
||||
if (IsRecording || !captureRectangle.IsValid() || screenRecorder != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue