mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added a centralised ProfileEditorSurface for communication between VMs Prefixed Surface, Device and Led with Artemis to differentiate them better
39 lines
1.7 KiB
C#
39 lines
1.7 KiB
C#
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)
|
|
);
|
|
}
|
|
}
|
|
} |