mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Darthified code
This commit is contained in:
1 parent
5b80c1e4fe
commit
ae64db8a13
198 files changed
+1339
-1305
No files matched your search
@@ -62,7 +62,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
if (layer.LayerBrush != null)
|
||||
throw new ArtemisCoreException("Layer already has an instantiated layer brush");
|
||||
|
||||
var brush = (BaseLayerBrush) LayerBrushProvider.PluginInfo.Kernel.Get(LayerBrushType);
|
||||
BaseLayerBrush brush = (BaseLayerBrush) LayerBrushProvider.PluginInfo.Kernel.Get(LayerBrushType);
|
||||
brush.Layer = layer;
|
||||
brush.Descriptor = this;
|
||||
brush.Initialize();
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
if (!Enabled)
|
||||
throw new ArtemisPluginException(PluginInfo, "Can only add a layer brush descriptor when the plugin is enabled");
|
||||
|
||||
var descriptor = new LayerBrushDescriptor(displayName, description, icon, typeof(T), this);
|
||||
LayerBrushDescriptor descriptor = new LayerBrushDescriptor(displayName, description, icon, typeof(T), this);
|
||||
_layerBrushDescriptors.Add(descriptor);
|
||||
LayerBrushStore.Add(descriptor);
|
||||
}
|
||||
|
||||
@@ -36,14 +36,14 @@ namespace Artemis.Core.LayerBrushes
|
||||
if (Layer.General.ResizeMode == LayerResizeMode.Normal)
|
||||
{
|
||||
// Apply a translated version of the shape as the clipping mask
|
||||
var shapePath = new SKPath(Layer.LayerShape.Path);
|
||||
SKPath shapePath = new SKPath(Layer.LayerShape.Path);
|
||||
Layer.IncludePathInTranslation(shapePath, true);
|
||||
canvas.ClipPath(shapePath);
|
||||
}
|
||||
|
||||
using var pointsPath = new SKPath();
|
||||
using var ledPaint = new SKPaint();
|
||||
foreach (var artemisLed in Layer.Leds)
|
||||
using SKPath pointsPath = new SKPath();
|
||||
using SKPaint ledPaint = new SKPaint();
|
||||
foreach (ArtemisLed artemisLed in Layer.Leds)
|
||||
{
|
||||
pointsPath.AddPoly(new[]
|
||||
{
|
||||
@@ -53,18 +53,18 @@ namespace Artemis.Core.LayerBrushes
|
||||
}
|
||||
|
||||
Layer.ExcludePathFromTranslation(pointsPath, true);
|
||||
var points = pointsPath.Points;
|
||||
for (var index = 0; index < Layer.Leds.Count; index++)
|
||||
SKPoint[] points = pointsPath.Points;
|
||||
for (int index = 0; index < Layer.Leds.Count; index++)
|
||||
{
|
||||
var artemisLed = Layer.Leds[index];
|
||||
var renderPoint = points[index * 2 + 1];
|
||||
ArtemisLed artemisLed = Layer.Leds[index];
|
||||
SKPoint renderPoint = points[index * 2 + 1];
|
||||
if (!float.IsFinite(renderPoint.X) || !float.IsFinite(renderPoint.Y))
|
||||
continue;
|
||||
|
||||
// Let the brush determine the color
|
||||
ledPaint.Color = GetColor(artemisLed, renderPoint);
|
||||
|
||||
var ledRectangle = SKRect.Create(
|
||||
SKRect ledRectangle = SKRect.Create(
|
||||
artemisLed.AbsoluteRenderRectangle.Left - Layer.Bounds.Left,
|
||||
artemisLed.AbsoluteRenderRectangle.Top - Layer.Bounds.Top,
|
||||
artemisLed.AbsoluteRenderRectangle.Width,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Services;
|
||||
using RGB.NET.Core;
|
||||
@@ -39,8 +40,8 @@ namespace Artemis.Core.LayerBrushes
|
||||
// TODO: This simply renders it on top of the rest, get a ZIndex based on layer position
|
||||
LedGroup.ZIndex = 1;
|
||||
|
||||
var missingLeds = Layer.Leds.Where(l => !LedGroup.ContainsLed(l.RgbLed)).Select(l => l.RgbLed).ToList();
|
||||
var extraLeds = LedGroup.GetLeds().Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
||||
List<Led> missingLeds = Layer.Leds.Where(l => !LedGroup.ContainsLed(l.RgbLed)).Select(l => l.RgbLed).ToList();
|
||||
List<Led> extraLeds = LedGroup.GetLeds().Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
||||
LedGroup.AddLeds(missingLeds);
|
||||
LedGroup.RemoveLeds(extraLeds);
|
||||
LedGroup.Brush = GetBrush();
|
||||
|
||||
Reference in new issue
Block a user