1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Surface editor - Improved device color overlay method

This commit is contained in:
Robert 2021-03-16 00:15:50 +01:00
parent c51016f8f2
commit f646f64648
2 changed files with 4 additions and 4 deletions

View File

@ -66,6 +66,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
{ {
Execute.PostToUIThread(() => Execute.PostToUIThread(() =>
{ {
// TODO: Remove, frames shouldn't even be rendered if this is the case
if (e.Texture.Bitmap.Pixels.Length == 0) if (e.Texture.Bitmap.Pixels.Length == 0)
return; return;

View File

@ -136,16 +136,15 @@ namespace Artemis.UI.Screens.SurfaceEditor
if (!ColorDevices) if (!ColorDevices)
return; return;
e.Canvas.Clear(new SKColor(0, 0, 0));
foreach (ListDeviceViewModel listDeviceViewModel in ListDeviceViewModels) foreach (ListDeviceViewModel listDeviceViewModel in ListDeviceViewModels)
{ {
// Order by position to accurately get the first LED // Order by position to accurately get the first LED
List<ArtemisLed> leds = listDeviceViewModel.Device.Leds.OrderBy(l => l.Rectangle.Left).ThenBy(l => l.Rectangle.Top).ToList(); List<ArtemisLed> leds = listDeviceViewModel.Device.Leds.OrderBy(l => l.RgbLed.Location.Y).ThenBy(l => l.RgbLed.Location.X).ToList();
for (int index = 0; index < leds.Count; index++) for (int index = 0; index < leds.Count; index++)
{ {
ArtemisLed artemisLed = leds[index]; ArtemisLed artemisLed = leds[index];
if (ColorFirstLedOnly && index > 0) if (ColorFirstLedOnly && index == 0 || !ColorFirstLedOnly)
e.Canvas.DrawRect(artemisLed.AbsoluteRectangle, new SKPaint {Color = new SKColor(0, 0, 0)});
else
e.Canvas.DrawRect(artemisLed.AbsoluteRectangle, new SKPaint {Color = listDeviceViewModel.Color}); e.Canvas.DrawRect(artemisLed.AbsoluteRectangle, new SKPaint {Color = listDeviceViewModel.Color});
} }
} }