Changed color-control to brushes, improved keygroups

This commit is contained in:
DarthAffe committed 2015-09-22 21:34:36 +02:00
1 parent 02aaf24c41
commit 0a47642c38
11 files changed
+106 -73

No files matched your search

+24
View File
@@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;
using System.Drawing;
namespace CUE.NET.Helper
{
public static class RectangleHelper
{
public static PointF GetCenter(this RectangleF rectangle)
{
return new PointF(rectangle.Left + rectangle.Width / 2f, rectangle.Top + rectangle.Height / 2f);
}
public static RectangleF CreateRectangleFromPoints(PointF point1, PointF point2)
{
float posX = Math.Min(point1.X, point2.X);
@@ -25,6 +31,24 @@ namespace CUE.NET.Helper
return new RectangleF(posX, posY, width, height);
}
public static RectangleF CreateRectangleFromRectangles(IEnumerable<RectangleF> rectangles)
{
float posX = float.MaxValue;
float posY = float.MaxValue;
float posX2 = float.MinValue;
float posY2 = float.MinValue;
foreach (RectangleF rectangle in rectangles)
{
posX = Math.Min(posX, rectangle.X);
posY = Math.Min(posY, rectangle.Y);
posX2 = Math.Max(posX2, rectangle.X + rectangle.Width);
posY2 = Math.Max(posY2, rectangle.Y + rectangle.Height);
}
return CreateRectangleFromPoints(new PointF(posX, posY), new PointF(posX2, posY2));
}
public static float CalculateIntersectPercentage(RectangleF rect, RectangleF referenceRect)
{
if (rect.IsEmpty || referenceRect.IsEmpty) return 0;