diff --git a/Brushes/BrushRenderTarget.cs b/Brushes/BrushRenderTarget.cs
index 1ef5996..b381240 100644
--- a/Brushes/BrushRenderTarget.cs
+++ b/Brushes/BrushRenderTarget.cs
@@ -3,6 +3,7 @@
using System.Drawing;
using CUE.NET.Devices.Generic.Enums;
+using CUE.NET.Helper;
namespace CUE.NET.Brushes
{
@@ -18,6 +19,11 @@ namespace CUE.NET.Brushes
///
public CorsairLedId LedId { get; }
+ ///
+ /// Gets the rectangle representing the area to render the target-LED.
+ ///
+ public RectangleF Rectangle { get; }
+
///
/// Gets the point representing the position to render the target-LED.
///
@@ -31,11 +37,13 @@ namespace CUE.NET.Brushes
/// Initializes a new instance of the class.
///
/// The ID of the target-LED.
- /// The point representing the position to render the target-LED.
- public BrushRenderTarget(CorsairLedId ledId, PointF point)
+ /// The rectangle representing the area to render the target-LED.
+ public BrushRenderTarget(CorsairLedId ledId, RectangleF rectangle)
{
- this.Point = point;
+ this.Rectangle = rectangle;
this.LedId = ledId;
+
+ Point = rectangle.GetCenter();
}
#endregion
diff --git a/Devices/Generic/AbstractCueDevice.cs b/Devices/Generic/AbstractCueDevice.cs
index c33c29a..6265ef1 100644
--- a/Devices/Generic/AbstractCueDevice.cs
+++ b/Devices/Generic/AbstractCueDevice.cs
@@ -239,10 +239,10 @@ namespace CUE.NET.Devices.Generic
float offsetY = -brushRectangle.Y;
brushRectangle.X = 0;
brushRectangle.Y = 0;
- brush.PerformRender(brushRectangle, leds.Select(x => new BrushRenderTarget(x.Id, x.LedRectangle.GetCenter(offsetX, offsetY))));
+ brush.PerformRender(brushRectangle, leds.Select(x => new BrushRenderTarget(x.Id, x.LedRectangle.Move(offsetX, offsetY))));
break;
case BrushCalculationMode.Absolute:
- brush.PerformRender(DeviceRectangle, leds.Select(x => new BrushRenderTarget(x.Id, x.LedRectangle.GetCenter())));
+ brush.PerformRender(DeviceRectangle, leds.Select(x => new BrushRenderTarget(x.Id, x.LedRectangle)));
break;
default:
throw new ArgumentException();
diff --git a/Helper/RectangleHelper.cs b/Helper/RectangleHelper.cs
index cb360fd..c373ee1 100644
--- a/Helper/RectangleHelper.cs
+++ b/Helper/RectangleHelper.cs
@@ -10,7 +10,19 @@ namespace CUE.NET.Helper
public static class RectangleHelper
{
///
- /// Calculates the center-point of a rectangle adding a offset.
+ /// Moves a rectangle by a adding an offset.
+ ///
+ /// The rectangle.
+ /// The offset for the x-value
+ /// The offset for the y-value
+ /// The moved rectangle.
+ public static RectangleF Move(this RectangleF rectangle, float offsetX = 0f, float offsetY = 0f)
+ {
+ return new RectangleF(rectangle.X + offsetX, rectangle.Y + offsetY, rectangle.Width, rectangle.Height);
+ }
+
+ ///
+ /// Calculates the center-point of a rectangle adding an offset.
///
/// The rectangle.
/// The offset for the x-value