Implemented most of the rendering pipeline in SkiaSharp

This commit is contained in:
SpoinkyNL committed 2019-12-03 00:09:32 +01:00
1 parent 0e3afef6ca
commit 07b2ad87c4
35 files changed
+234 -274

No files matched your search

@@ -1,6 +1,5 @@
using System;
using System.Collections.ObjectModel;
using System.Drawing.Drawing2D;
using System.Linq;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.Abstract;
@@ -8,7 +7,6 @@ using Artemis.Storage.Entities.Surface;
using RGB.NET.Core;
using SkiaSharp;
using Stylet;
using Rectangle = System.Drawing.Rectangle;
namespace Artemis.Core.Models.Surface
{
@@ -99,14 +97,8 @@ namespace Artemis.Core.Models.Surface
RenderRectangle = SKRect.Create(
(RgbDevice.Location.X * Surface.Scale).RoundToInt(),
(RgbDevice.Location.Y * Surface.Scale).RoundToInt(),
(RgbDevice.Location.X * Surface.Scale).RoundToInt(),
(RgbDevice.Location.X * Surface.Scale).RoundToInt()
);
RenderRectangle = new Rectangle(
(int) Math.Round(RgbDevice.Location.X * Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbDevice.Location.Y * Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbDevice.DeviceRectangle.Size.Width * Surface.Scale, MidpointRounding.AwayFromZero),
(int) Math.Round(RgbDevice.DeviceRectangle.Size.Height * Surface.Scale, MidpointRounding.AwayFromZero)
(RgbDevice.DeviceRectangle.Size.Width * Surface.Scale).RoundToInt(),
(RgbDevice.DeviceRectangle.Size.Height * Surface.Scale).RoundToInt()
);
if (!Leds.Any())
@@ -115,9 +107,10 @@ namespace Artemis.Core.Models.Surface
foreach (var led in Leds)
led.CalculateRenderRectangle();
var path = new GraphicsPath();
path.AddRectangles(Leds.Select(l => l.AbsoluteRenderRectangle).ToArray());
path.FillMode = FillMode.Winding;
var path = new SKPath {FillType = SKPathFillType.Winding};
foreach (var artemisLed in Leds)
path.AddRect(artemisLed.AbsoluteRenderRectangle);
RenderPath = path;
}