1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 02:03:32 +00:00

RGB.NET - Updated for latest development branch

This commit is contained in:
Robert 2021-02-10 00:19:45 +01:00
parent 606c1b80f2
commit 7792b662e0
8 changed files with 23 additions and 12 deletions

View File

@ -300,7 +300,7 @@ namespace Artemis.Core
internal void CalculateRenderProperties() internal void CalculateRenderProperties()
{ {
Rectangle = RgbDevice.DeviceRectangle.ToSKRect(); Rectangle = RgbDevice.Boundary.ToSKRect();
if (!Leds.Any()) if (!Leds.Any())
return; return;

View File

@ -46,10 +46,12 @@ namespace Artemis.Core
private set => SetAndNotify(ref _absoluteRectangle, value); private set => SetAndNotify(ref _absoluteRectangle, value);
} }
public ArtemisLedLayout? Layout { get; set; }
internal void CalculateRectangles() internal void CalculateRectangles()
{ {
Rectangle = RgbLed.LedRectangle.ToSKRect(); Rectangle = RgbLed.Boundary.ToSKRect();
AbsoluteRectangle = RgbLed.AbsoluteLedRectangle.ToSKRect(); AbsoluteRectangle = RgbLed.AbsoluteBoundary.ToSKRect();
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -0,0 +1,10 @@
using System;
namespace Artemis.Core
{
public class ArtemisLedLayout
{
public ArtemisLed Led { get; set; }
public Uri Image { get; set; }
}
}

View File

@ -66,7 +66,7 @@ namespace Artemis.Core.Services.Models
{ {
HorizontalArrangementPosition.Left => devices.Min(d => d.RgbDevice.Location.X) - (AppliedConfiguration?.MarginLeft ?? 0.0), HorizontalArrangementPosition.Left => devices.Min(d => d.RgbDevice.Location.X) - (AppliedConfiguration?.MarginLeft ?? 0.0),
HorizontalArrangementPosition.Right => devices.Max(d => d.RgbDevice.Location.X + d.RgbDevice.Size.Width) + (AppliedConfiguration?.MarginRight ?? 0.0), HorizontalArrangementPosition.Right => devices.Max(d => d.RgbDevice.Location.X + d.RgbDevice.Size.Width) + (AppliedConfiguration?.MarginRight ?? 0.0),
HorizontalArrangementPosition.Center => devices.First().RgbDevice.DeviceRectangle.Center.X, HorizontalArrangementPosition.Center => devices.First().RgbDevice.Boundary.Center.X,
HorizontalArrangementPosition.Equal => devices.First().RgbDevice.Location.X, HorizontalArrangementPosition.Equal => devices.First().RgbDevice.Location.X,
_ => throw new ArgumentOutOfRangeException(nameof(horizontalPosition), horizontalPosition, null) _ => throw new ArgumentOutOfRangeException(nameof(horizontalPosition), horizontalPosition, null)
}; };
@ -74,7 +74,7 @@ namespace Artemis.Core.Services.Models
{ {
VerticalArrangementPosition.Top => devices.Min(d => d.RgbDevice.Location.Y) - (AppliedConfiguration?.MarginTop ?? 0.0), VerticalArrangementPosition.Top => devices.Min(d => d.RgbDevice.Location.Y) - (AppliedConfiguration?.MarginTop ?? 0.0),
VerticalArrangementPosition.Bottom => devices.Max(d => d.RgbDevice.Location.Y + d.RgbDevice.Size.Height) + (AppliedConfiguration?.MarginBottom ?? 0.0), VerticalArrangementPosition.Bottom => devices.Max(d => d.RgbDevice.Location.Y + d.RgbDevice.Size.Height) + (AppliedConfiguration?.MarginBottom ?? 0.0),
VerticalArrangementPosition.Center => devices.First().RgbDevice.DeviceRectangle.Center.Y, VerticalArrangementPosition.Center => devices.First().RgbDevice.Boundary.Center.Y,
VerticalArrangementPosition.Equal => devices.First().RgbDevice.Location.Y, VerticalArrangementPosition.Equal => devices.First().RgbDevice.Location.Y,
_ => throw new ArgumentOutOfRangeException(nameof(verticalPosition), verticalPosition, null) _ => throw new ArgumentOutOfRangeException(nameof(verticalPosition), verticalPosition, null)
}; };

View File

@ -21,8 +21,8 @@ namespace Artemis.UI.Shared
Led.RgbLed.Size.Height Led.RgbLed.Size.Height
); );
if (Led.RgbLed.Image != null && File.Exists(Led.RgbLed.Image.AbsolutePath)) if (Led.Layout?.Image != null && File.Exists(Led.Layout.Image.AbsolutePath))
LedImage = new BitmapImage(Led.RgbLed.Image); LedImage = new BitmapImage(Led.Layout.Image);
CreateLedGeometry(); CreateLedGeometry();
} }

View File

@ -57,7 +57,6 @@
<!-- TODO: Remove when moving to Nuget, this is so the plugin templates have the DLL to reference --> <!-- TODO: Remove when moving to Nuget, this is so the plugin templates have the DLL to reference -->
<Reference Include="RGB.NET.Brushes"> <Reference Include="RGB.NET.Brushes">
<HintPath>..\..\..\RGB.NET\bin\net5.0\RGB.NET.Brushes.dll</HintPath> <HintPath>..\..\..\RGB.NET\bin\net5.0\RGB.NET.Brushes.dll</HintPath>
<Private>true</Private>
</Reference> </Reference>
<Reference Include="RGB.NET.Core"> <Reference Include="RGB.NET.Core">
<HintPath>..\..\..\RGB.NET\bin\net5.0\RGB.NET.Core.dll</HintPath> <HintPath>..\..\..\RGB.NET\bin\net5.0\RGB.NET.Core.dll</HintPath>

View File

@ -134,19 +134,19 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
private Geometry CreateRectangleGeometry(ArtemisLed led) private Geometry CreateRectangleGeometry(ArtemisLed led)
{ {
Rect rect = led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1); Rect rect = led.RgbLed.AbsoluteBoundary.ToWindowsRect(1);
return new RectangleGeometry(rect); return new RectangleGeometry(rect);
} }
private Geometry CreateCircleGeometry(ArtemisLed led) private Geometry CreateCircleGeometry(ArtemisLed led)
{ {
Rect rect = led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1); Rect rect = led.RgbLed.AbsoluteBoundary.ToWindowsRect(1);
return new EllipseGeometry(rect); return new EllipseGeometry(rect);
} }
private Geometry CreateCustomGeometry(ArtemisLed led, double deflateAmount) private Geometry CreateCustomGeometry(ArtemisLed led, double deflateAmount)
{ {
Rect rect = led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1); Rect rect = led.RgbLed.AbsoluteBoundary.ToWindowsRect(1);
try try
{ {
PathGeometry geometry = Geometry.Combine( PathGeometry geometry = Geometry.Combine(

View File

@ -48,7 +48,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization
public Rect DeviceRectangle => Device.RgbDevice == null public Rect DeviceRectangle => Device.RgbDevice == null
? new Rect() ? new Rect()
: new Rect(Device.X, Device.Y, Device.RgbDevice.DeviceRectangle.Size.Width, Device.RgbDevice.DeviceRectangle.Size.Height); : new Rect(Device.X, Device.Y, Device.RgbDevice.Boundary.Size.Width, Device.RgbDevice.Boundary.Size.Height);
public bool CanDetectInput => Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard || public bool CanDetectInput => Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard ||
Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse; Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse;