Implemented layer LED assignment

Added a centralised ProfileEditorSurface for communication between VMs
Prefixed Surface, Device and Led with Artemis to differentiate them better
This commit is contained in:
Robert committed 2019-11-29 17:37:22 +01:00
1 parent c7a5532c34
commit 16decaae42
50 files changed
+556 -662

No files matched your search

@@ -0,0 +1,39 @@
using System;
using RGB.NET.Core;
using Stylet;
using Rectangle = System.Drawing.Rectangle;
namespace Artemis.Core.Models.Surface
{
public class ArtemisLed : PropertyChangedBase
{
public ArtemisLed(Led led, ArtemisDevice device)
{
RgbLed = led;
Device = device;
CalculateRenderRectangle();
}
public Led RgbLed { get; }
public ArtemisDevice Device { get; }
public Rectangle RenderRectangle { get; private set; }
public Rectangle AbsoluteRenderRectangle { get; private set; }
public void CalculateRenderRectangle()
{
RenderRectangle = new Rectangle(
(int) Math.Round(RgbLed.LedRectangle.Location.X * Device.Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbLed.LedRectangle.Location.Y * Device.Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbLed.LedRectangle.Size.Width * Device.Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbLed.LedRectangle.Size.Height * Device.Surface.Scale, MidpointRounding.AwayFromZero)
);
AbsoluteRenderRectangle = new Rectangle(
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Location.X * Device.Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Location.Y * Device.Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Size.Width * Device.Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbLed.AbsoluteLedRectangle.Size.Height * Device.Surface.Scale, MidpointRounding.AwayFromZero)
);
}
}
}