diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj
index 80447262a..4a5d15f33 100644
--- a/src/Artemis.Core/Artemis.Core.csproj
+++ b/src/Artemis.Core/Artemis.Core.csproj
@@ -57,8 +57,8 @@
..\packages\CS-Script.bin.3.28.2.0\lib\net46\CSScriptLibrary.dll
-
- ..\packages\HidSharp.1.5\lib\net35\HidSharp.dll
+
+ ..\packages\HidSharp.2.0.1\lib\net35\HidSharp.dll
..\packages\Microsoft.CodeAnalysis.Common.2.7.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll
@@ -118,40 +118,40 @@
..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll
- ..\packages\RGB.NET.Brushes.0.0.1.49\lib\net45\RGB.NET.Brushes.dll
+ ..\packages\RGB.NET.Brushes.0.0.1.51\lib\net45\RGB.NET.Brushes.dll
- ..\packages\RGB.NET.Core.0.0.1.49\lib\net45\RGB.NET.Core.dll
+ ..\packages\RGB.NET.Core.0.0.1.51\lib\net45\RGB.NET.Core.dll
- ..\packages\RGB.NET.Decorators.0.0.1.49\lib\net45\RGB.NET.Decorators.dll
+ ..\packages\RGB.NET.Decorators.0.0.1.51\lib\net45\RGB.NET.Decorators.dll
- ..\packages\RGB.NET.Devices.Asus.0.0.1.49\lib\net45\RGB.NET.Devices.Asus.dll
+ ..\packages\RGB.NET.Devices.Asus.0.0.1.51\lib\net45\RGB.NET.Devices.Asus.dll
- ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.49\lib\net45\RGB.NET.Devices.CoolerMaster.dll
+ ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.51\lib\net45\RGB.NET.Devices.CoolerMaster.dll
- ..\packages\RGB.NET.Devices.Corsair.0.0.1.49\lib\net45\RGB.NET.Devices.Corsair.dll
+ ..\packages\RGB.NET.Devices.Corsair.0.0.1.51\lib\net45\RGB.NET.Devices.Corsair.dll
- ..\packages\RGB.NET.Devices.DMX.0.0.1.49\lib\net45\RGB.NET.Devices.DMX.dll
+ ..\packages\RGB.NET.Devices.DMX.0.0.1.51\lib\net45\RGB.NET.Devices.DMX.dll
- ..\packages\RGB.NET.Devices.Logitech.0.0.1.49\lib\net45\RGB.NET.Devices.Logitech.dll
+ ..\packages\RGB.NET.Devices.Logitech.0.0.1.51\lib\net45\RGB.NET.Devices.Logitech.dll
- ..\packages\RGB.NET.Devices.Novation.0.0.1.49\lib\net45\RGB.NET.Devices.Novation.dll
+ ..\packages\RGB.NET.Devices.Novation.0.0.1.51\lib\net45\RGB.NET.Devices.Novation.dll
- ..\packages\RGB.NET.Devices.Razer.0.0.1.49\lib\net45\RGB.NET.Devices.Razer.dll
+ ..\packages\RGB.NET.Devices.Razer.0.0.1.51\lib\net45\RGB.NET.Devices.Razer.dll
- ..\packages\RGB.NET.Groups.0.0.1.49\lib\net45\RGB.NET.Groups.dll
+ ..\packages\RGB.NET.Groups.0.0.1.51\lib\net45\RGB.NET.Groups.dll
- ..\packages\Sanford.Multimedia.Midi.6.6.0\lib\net20\Sanford.Multimedia.Midi.dll
+ ..\packages\Sanford.Multimedia.Midi.Standard.6.6.0\lib\net35\Sanford.Multimedia.Midi.dll
..\packages\Stylet.1.1.21\lib\net45\Stylet.dll
@@ -186,6 +186,7 @@
..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll
True
+
..\packages\System.Interactive.Async.3.1.1\lib\net46\System.Interactive.Async.dll
@@ -282,6 +283,8 @@
+
+
@@ -293,6 +296,7 @@
+
diff --git a/src/Artemis.Core/Plugins/Abstract/ProfileModule.cs b/src/Artemis.Core/Plugins/Abstract/ProfileModule.cs
index 93208c413..3e35618b6 100644
--- a/src/Artemis.Core/Plugins/Abstract/ProfileModule.cs
+++ b/src/Artemis.Core/Plugins/Abstract/ProfileModule.cs
@@ -1,4 +1,5 @@
using System;
+using System.Drawing;
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.ProfileElements;
using RGB.NET.Core;
@@ -46,12 +47,12 @@ namespace Artemis.Core.Plugins.Abstract
}
///
- public virtual void Render(double deltaTime, RGBSurface surface)
+ public virtual void Render(double deltaTime, RGBSurface surface, Graphics graphics)
{
lock (this)
{
// Render the profile
- ActiveProfile?.Render(deltaTime, surface);
+ ActiveProfile?.Render(deltaTime, surface, graphics);
}
}
diff --git a/src/Artemis.Core/Plugins/Interfaces/ILayerType.cs b/src/Artemis.Core/Plugins/Interfaces/ILayerType.cs
index 9c55e4315..5391f2a10 100644
--- a/src/Artemis.Core/Plugins/Interfaces/ILayerType.cs
+++ b/src/Artemis.Core/Plugins/Interfaces/ILayerType.cs
@@ -1,4 +1,5 @@
-using Artemis.Core.ProfileElements;
+using System.Drawing;
+using Artemis.Core.ProfileElements;
using RGB.NET.Core;
namespace Artemis.Core.Plugins.Interfaces
@@ -18,6 +19,6 @@ namespace Artemis.Core.Plugins.Interfaces
///
/// Renders the layer type
///
- void Render(Layer device, RGBSurface surface);
+ void Render(Layer device, RGBSurface surface, Graphics graphics);
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Plugins/Interfaces/IModule.cs b/src/Artemis.Core/Plugins/Interfaces/IModule.cs
index f750590b9..2458e1fff 100644
--- a/src/Artemis.Core/Plugins/Interfaces/IModule.cs
+++ b/src/Artemis.Core/Plugins/Interfaces/IModule.cs
@@ -1,4 +1,5 @@
using System;
+using System.Drawing;
using RGB.NET.Core;
namespace Artemis.Core.Plugins.Interfaces
@@ -31,6 +32,7 @@ namespace Artemis.Core.Plugins.Interfaces
///
/// Time since the last render
/// The RGB Surface to render to
- void Render(double deltaTime, RGBSurface surface);
+ ///
+ void Render(double deltaTime, RGBSurface surface, Graphics graphics);
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/ProfileElements/Folder.cs b/src/Artemis.Core/ProfileElements/Folder.cs
index faacc6482..8d5113e47 100644
--- a/src/Artemis.Core/ProfileElements/Folder.cs
+++ b/src/Artemis.Core/ProfileElements/Folder.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Drawing;
using Artemis.Core.ProfileElements.Interfaces;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Entities;
@@ -26,11 +27,11 @@ namespace Artemis.Core.ProfileElements
profileElement.Update(deltaTime);
}
- public void Render(double deltaTime, RGBSurface surface)
+ public void Render(double deltaTime, RGBSurface surface, Graphics graphics)
{
// Folders don't render but their children do
foreach (var profileElement in Children)
- profileElement.Render(deltaTime, surface);
+ profileElement.Render(deltaTime, surface, graphics);
}
public static Folder FromFolderEntity(Profile profile, FolderEntity folderEntity, IPluginService pluginService)
diff --git a/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs b/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs
index 2371aa2a0..3188ff197 100644
--- a/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs
+++ b/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Drawing;
using RGB.NET.Core;
namespace Artemis.Core.ProfileElements.Interfaces
@@ -29,6 +30,6 @@ namespace Artemis.Core.ProfileElements.Interfaces
///
/// Renders the element
///
- void Render(double deltaTime, RGBSurface surface);
+ void Render(double deltaTime, RGBSurface surface, Graphics graphics);
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/ProfileElements/Layer.cs b/src/Artemis.Core/ProfileElements/Layer.cs
index 6ea7f138d..7cd3a612a 100644
--- a/src/Artemis.Core/ProfileElements/Layer.cs
+++ b/src/Artemis.Core/ProfileElements/Layer.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.ProfileElements.Interfaces;
using Artemis.Core.Services.Interfaces;
@@ -34,14 +35,14 @@ namespace Artemis.Core.ProfileElements
}
}
- public void Render(double deltaTime, RGBSurface surface)
+ public void Render(double deltaTime, RGBSurface surface, Graphics graphics)
{
if (LayerType == null)
return;
lock (LayerType)
{
- LayerType.Render(this, surface);
+ LayerType.Render(this, surface, graphics);
}
}
diff --git a/src/Artemis.Core/ProfileElements/Profile.cs b/src/Artemis.Core/ProfileElements/Profile.cs
index 4e542d324..1ee460042 100644
--- a/src/Artemis.Core/ProfileElements/Profile.cs
+++ b/src/Artemis.Core/ProfileElements/Profile.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.Models;
using Artemis.Core.ProfileElements.Interfaces;
@@ -34,7 +35,7 @@ namespace Artemis.Core.ProfileElements
}
}
- public void Render(double deltaTime, RGBSurface surface)
+ public void Render(double deltaTime, RGBSurface surface, Graphics graphics)
{
lock (this)
{
@@ -42,7 +43,7 @@ namespace Artemis.Core.ProfileElements
throw new ArtemisCoreException($"Cannot render inactive profile: {this}");
foreach (var profileElement in Children)
- profileElement.Render(deltaTime, surface);
+ profileElement.Render(deltaTime, surface, graphics);
}
}
diff --git a/src/Artemis.Core/RGB.NET/DirectBitmap.cs b/src/Artemis.Core/RGB.NET/DirectBitmap.cs
new file mode 100644
index 000000000..f5b1bc102
--- /dev/null
+++ b/src/Artemis.Core/RGB.NET/DirectBitmap.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
+
+namespace Artemis.Core.RGB.NET
+{
+ public class DirectBitmap : IDisposable
+ {
+ public Bitmap Bitmap { get; private set; }
+ public Int32[] Bits { get; private set; }
+ public bool Disposed { get; private set; }
+ public int Height { get; private set; }
+ public int Width { get; private set; }
+
+ protected GCHandle BitsHandle { get; private set; }
+
+ public DirectBitmap(int width, int height)
+ {
+ Width = width;
+ Height = height;
+ Bits = new Int32[width * height];
+ BitsHandle = GCHandle.Alloc(Bits, GCHandleType.Pinned);
+ Bitmap = new Bitmap(width, height, width * 4, PixelFormat.Format32bppPArgb, BitsHandle.AddrOfPinnedObject());
+ }
+
+ public void SetPixel(int x, int y, Color colour)
+ {
+ int index = x + (y * Width);
+ int col = colour.ToArgb();
+
+ Bits[index] = col;
+ }
+
+ public Color GetPixel(int x, int y)
+ {
+ int index = x + (y * Width);
+ int col = Bits[index];
+ Color result = Color.FromArgb(col);
+
+ return result;
+ }
+
+ public void Dispose()
+ {
+ if (Disposed) return;
+ Disposed = true;
+ Bitmap.Dispose();
+ BitsHandle.Free();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/RGB.NET/GraphicsDecorator.cs b/src/Artemis.Core/RGB.NET/GraphicsDecorator.cs
new file mode 100644
index 000000000..87ee3ce64
--- /dev/null
+++ b/src/Artemis.Core/RGB.NET/GraphicsDecorator.cs
@@ -0,0 +1,34 @@
+using System.Drawing;
+using System.Linq;
+using RGB.NET.Core;
+using RGB.NET.Groups;
+using Color = RGB.NET.Core.Color;
+using Rectangle = RGB.NET.Core.Rectangle;
+
+namespace Artemis.Core.RGB.NET
+{
+ public class GraphicsDecorator : AbstractDecorator, IBrushDecorator
+ {
+ private readonly DirectBitmap _bitmap;
+
+ public GraphicsDecorator(ListLedGroup ledGroup)
+ {
+// var width = ledGroup.GetLeds().Max(l => l.LedRectangle.X + l.LedRectangle.Width);
+// var height = ledGroup.GetLeds().Max(l => l.LedRectangle.Y + l.LedRectangle.Height);
+ var width = 500;
+ var height = 500;
+ _bitmap = new DirectBitmap((int) width, (int) height);
+ }
+
+ public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color)
+ {
+ var pixel = _bitmap.GetPixel((int) (renderTarget.Rectangle.X + renderTarget.Rectangle.Width / 2), (int) (renderTarget.Rectangle.Y + renderTarget.Rectangle.Height / 2));
+ return new Color(pixel.A, pixel.R, pixel.G, pixel.B);
+ }
+
+ public Graphics GetGraphics()
+ {
+ return Graphics.FromImage(_bitmap.Bitmap);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs
index cb17a0f81..44b921b0a 100644
--- a/src/Artemis.Core/Services/CoreService.cs
+++ b/src/Artemis.Core/Services/CoreService.cs
@@ -5,6 +5,7 @@ using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.Services.Interfaces;
using RGB.NET.Core;
+using Color = System.Drawing.Color;
namespace Artemis.Core.Services
{
@@ -19,6 +20,7 @@ namespace Artemis.Core.Services
_rgbService = rgbService;
_rgbService.Surface.Updating += SurfaceOnUpdating;
+
Task.Run(Initialize);
}
@@ -47,11 +49,20 @@ namespace Artemis.Core.Services
try
{
// Update all active modules
- foreach (var module in _pluginService.Plugins.OfType())
+ foreach (var module in _pluginService.Plugins.Select(p => p.Plugin).OfType())
module.Update(args.DeltaTime);
+
+ if (_rgbService.GraphicsDecorator == null)
+ return;
+
// Render all active modules
- foreach (var module in _pluginService.Plugins.OfType())
- module.Render(args.DeltaTime, _rgbService.Surface);
+ using (var g = _rgbService.GraphicsDecorator.GetGraphics())
+ {
+ g.Clear(Color.Red);
+
+ foreach (var module in _pluginService.Plugins.Select(p => p.Plugin).OfType())
+ module.Render(args.DeltaTime, _rgbService.Surface, g);
+ }
}
catch (Exception e)
{
diff --git a/src/Artemis.Core/Services/Interfaces/IRgbService.cs b/src/Artemis.Core/Services/Interfaces/IRgbService.cs
index ced041101..ed52287cb 100644
--- a/src/Artemis.Core/Services/Interfaces/IRgbService.cs
+++ b/src/Artemis.Core/Services/Interfaces/IRgbService.cs
@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using Artemis.Core.Events;
+using Artemis.Core.RGB.NET;
using RGB.NET.Core;
namespace Artemis.Core.Services.Interfaces
@@ -9,6 +10,7 @@ namespace Artemis.Core.Services.Interfaces
{
bool LoadingDevices { get; }
RGBSurface Surface { get; set; }
+ GraphicsDecorator GraphicsDecorator { get; }
Task LoadDevices();
void Dispose();
diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs
index 5cf158829..ed4173d1f 100644
--- a/src/Artemis.Core/Services/RgbService.cs
+++ b/src/Artemis.Core/Services/RgbService.cs
@@ -1,9 +1,12 @@
using System;
using System.Threading.Tasks;
using Artemis.Core.Events;
+using Artemis.Core.RGB.NET;
using Artemis.Core.Services.Interfaces;
+using RGB.NET.Brushes;
using RGB.NET.Core;
using RGB.NET.Devices.Corsair;
+using RGB.NET.Groups;
namespace Artemis.Core.Services
{
@@ -28,6 +31,7 @@ namespace Artemis.Core.Services
///
public RGBSurface Surface { get; set; }
+ public GraphicsDecorator GraphicsDecorator { get; private set; }
///
public async Task LoadDevices()
@@ -51,6 +55,11 @@ namespace Artemis.Core.Services
Surface.AlignDevices();
});
+ // Apply the application wide brush and decorator
+ var background = new ListLedGroup(Surface.Leds) { Brush = new SolidColorBrush(new Color(255, 255, 255, 255)) };
+ GraphicsDecorator = new GraphicsDecorator(background);
+ background.Brush.AddDecorator(GraphicsDecorator);
+
OnFinishedLoadedDevices();
}
diff --git a/src/Artemis.Core/UtilitiesRemoveMe.cs b/src/Artemis.Core/UtilitiesRemoveMe.cs
new file mode 100644
index 000000000..455944d7d
--- /dev/null
+++ b/src/Artemis.Core/UtilitiesRemoveMe.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+
+namespace Artemis.Core
+{
+ public static class ColorHelpers
+ {
+ private static readonly Random _rand = new Random();
+
+ ///
+ /// Comes up with a 'pure' psuedo-random color
+ ///
+ /// The color
+ public static Color GetRandomRainbowColor()
+ {
+ var colors = new List();
+ for (var i = 0; i < 3; i++)
+ colors.Add(_rand.Next(0, 256));
+
+ var highest = colors.Max();
+ var lowest = colors.Min();
+ colors[colors.FindIndex(c => c == highest)] = 255;
+ colors[colors.FindIndex(c => c == lowest)] = 0;
+
+ var returnColor = Color.FromArgb(255, colors[0], colors[1], colors[2]);
+
+ return returnColor;
+ }
+
+ public static Color GetRandomRainbowMediaColor()
+ {
+ var colors = new List();
+ for (var i = 0; i < 3; i++)
+ colors.Add((byte) _rand.Next(0, 256));
+
+ var highest = colors.Max();
+ var lowest = colors.Min();
+ colors[colors.FindIndex(c => c == highest)] = 255;
+ colors[colors.FindIndex(c => c == lowest)] = 0;
+
+ var returnColor = Color.FromArgb(255, colors[0], colors[1], colors[2]);
+
+ return returnColor;
+ }
+
+ public static Color ShiftColor(Color c, int shiftAmount)
+ {
+ int newRed = c.R;
+ int newGreen = c.G;
+ int newBlue = c.B;
+
+ // Red to purple
+ if (c.R == 255 && c.B < 255 && c.G == 0)
+ newBlue = newBlue + shiftAmount;
+ // Purple to blue
+ else if (c.B == 255 && c.R > 0)
+ newRed = newRed - shiftAmount;
+ // Blue to light-blue
+ else if (c.B == 255 && c.G < 255)
+ newGreen = newGreen + shiftAmount;
+ // Light-blue to green
+ else if (c.G == 255 && c.B > 0)
+ newBlue = newBlue - shiftAmount;
+ // Green to yellow
+ else if (c.G == 255 && c.R < 255)
+ newRed = newRed + shiftAmount;
+ // Yellow to red
+ else if (c.R == 255 && c.G > 0)
+ newGreen = newGreen - shiftAmount;
+
+ newRed = BringIntInColorRange(newRed);
+ newGreen = BringIntInColorRange(newGreen);
+ newBlue = BringIntInColorRange(newBlue);
+
+ return Color.FromArgb(c.A, newRed, newGreen, newBlue);
+ }
+
+ private static int BringIntInColorRange(int i)
+ {
+ if (i < 0)
+ return 0;
+ if (i > 255)
+ return 255;
+
+ return i;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/packages.config b/src/Artemis.Core/packages.config
index c9b8a56bc..0fe6f3d36 100644
--- a/src/Artemis.Core/packages.config
+++ b/src/Artemis.Core/packages.config
@@ -2,7 +2,7 @@
-
+
@@ -24,21 +24,21 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -50,6 +50,7 @@
+
diff --git a/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj b/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj
index 68ec145d8..796c787da 100644
--- a/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj
+++ b/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj
@@ -52,52 +52,53 @@
MinimumRecommendedRules.ruleset
-
- ..\packages\HidSharp.1.5\lib\net35\HidSharp.dll
+
+ ..\packages\HidSharp.2.0.1\lib\net35\HidSharp.dll
- ..\packages\RGB.NET.Brushes.0.0.1.49\lib\net45\RGB.NET.Brushes.dll
+ ..\packages\RGB.NET.Brushes.0.0.1.51\lib\net45\RGB.NET.Brushes.dll
- ..\packages\RGB.NET.Core.0.0.1.49\lib\net45\RGB.NET.Core.dll
+ ..\packages\RGB.NET.Core.0.0.1.51\lib\net45\RGB.NET.Core.dll
- ..\packages\RGB.NET.Decorators.0.0.1.49\lib\net45\RGB.NET.Decorators.dll
+ ..\packages\RGB.NET.Decorators.0.0.1.51\lib\net45\RGB.NET.Decorators.dll
- ..\packages\RGB.NET.Devices.Asus.0.0.1.49\lib\net45\RGB.NET.Devices.Asus.dll
+ ..\packages\RGB.NET.Devices.Asus.0.0.1.51\lib\net45\RGB.NET.Devices.Asus.dll
- ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.49\lib\net45\RGB.NET.Devices.CoolerMaster.dll
+ ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.51\lib\net45\RGB.NET.Devices.CoolerMaster.dll
- ..\packages\RGB.NET.Devices.Corsair.0.0.1.49\lib\net45\RGB.NET.Devices.Corsair.dll
+ ..\packages\RGB.NET.Devices.Corsair.0.0.1.51\lib\net45\RGB.NET.Devices.Corsair.dll
- ..\packages\RGB.NET.Devices.DMX.0.0.1.49\lib\net45\RGB.NET.Devices.DMX.dll
+ ..\packages\RGB.NET.Devices.DMX.0.0.1.51\lib\net45\RGB.NET.Devices.DMX.dll
- ..\packages\RGB.NET.Devices.Logitech.0.0.1.49\lib\net45\RGB.NET.Devices.Logitech.dll
+ ..\packages\RGB.NET.Devices.Logitech.0.0.1.51\lib\net45\RGB.NET.Devices.Logitech.dll
- ..\packages\RGB.NET.Devices.Novation.0.0.1.49\lib\net45\RGB.NET.Devices.Novation.dll
+ ..\packages\RGB.NET.Devices.Novation.0.0.1.51\lib\net45\RGB.NET.Devices.Novation.dll
- ..\packages\RGB.NET.Devices.Razer.0.0.1.49\lib\net45\RGB.NET.Devices.Razer.dll
+ ..\packages\RGB.NET.Devices.Razer.0.0.1.51\lib\net45\RGB.NET.Devices.Razer.dll
- ..\packages\RGB.NET.Groups.0.0.1.49\lib\net45\RGB.NET.Groups.dll
+ ..\packages\RGB.NET.Groups.0.0.1.51\lib\net45\RGB.NET.Groups.dll
- ..\packages\Sanford.Multimedia.Midi.6.6.0\lib\net20\Sanford.Multimedia.Midi.dll
+ ..\packages\Sanford.Multimedia.Midi.Standard.6.6.0\lib\net35\Sanford.Multimedia.Midi.dll
..\packages\Stylet.1.1.21\lib\net45\Stylet.dll
+
..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll
diff --git a/src/Artemis.Plugins.BuiltIn/LayerTypes/Brush/BrushLayerType.cs b/src/Artemis.Plugins.BuiltIn/LayerTypes/Brush/BrushLayerType.cs
index fa5ea1305..91308acbf 100644
--- a/src/Artemis.Plugins.BuiltIn/LayerTypes/Brush/BrushLayerType.cs
+++ b/src/Artemis.Plugins.BuiltIn/LayerTypes/Brush/BrushLayerType.cs
@@ -1,8 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Drawing;
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.ProfileElements;
using RGB.NET.Core;
@@ -30,8 +27,8 @@ namespace Artemis.Plugins.BuiltIn.LayerTypes.Brush
// Update the brush
}
- public void Render(Layer device, RGBSurface surface)
+ public void Render(Layer device, RGBSurface surface, Graphics graphics)
{
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs b/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs
index bf4f9e69e..01a43966e 100644
--- a/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs
+++ b/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs
@@ -2,34 +2,94 @@
//css_inc GeneralDataModel.cs;
using System;
-using Artemis.Core.Plugins.Abstract;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using Artemis.Core;
+using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.Services.Interfaces;
using RGB.NET.Core;
+using Color = System.Drawing.Color;
+using Rectangle = System.Drawing.Rectangle;
namespace Artemis.Plugins.BuiltIn.Modules.General
{
- public class GeneralModule : ProfileModule
+ public class GeneralModule : IModule
{
private readonly IRgbService _rgbService;
- private RGBSurface _surface;
+ private readonly RGBSurface _surface;
+ private Dictionary _colors;
public GeneralModule(IRgbService rgbService)
{
+ Debugger.Break();
_rgbService = rgbService;
_surface = _rgbService.Surface;
+ _colors = new Dictionary();
-
+ _rgbService.FinishedLoadedDevices += (sender, args) => PopulateColors();
}
- public override Type ViewModelType
+ public Type ViewModelType
{
get { return typeof(GeneralViewModel); }
}
// True since the main data model is all this module shows
- public override bool ExpandsMainDataModel
+ public bool ExpandsMainDataModel
{
get { return true; }
}
+
+ public void Update(double deltaTime)
+ {
+ if (_colors == null)
+ return;
+
+ foreach (var surfaceLed in _surface.Leds)
+ UpdateLedColor(surfaceLed, deltaTime);
+
+
+ }
+
+ private void UpdateLedColor(Led led, double deltaTime)
+ {
+ if (_colors.ContainsKey(led))
+ _colors[led] = ColorHelpers.ShiftColor(_colors[led], (int) (deltaTime * 1000));
+ else
+ _colors[led] = ColorHelpers.GetRandomRainbowColor();
+ }
+
+ public void Render(double deltaTime, RGBSurface surface, Graphics graphics)
+ {
+ foreach (var surfaceLed in _surface.Leds)
+ {
+ if (!_colors.ContainsKey(surfaceLed))
+ continue;
+
+ var brush = new SolidBrush(_colors[surfaceLed]);
+ var rectangle = new Rectangle((int) surfaceLed.LedRectangle.X, (int) surfaceLed.LedRectangle.Y, (int) surfaceLed.LedRectangle.Width, (int) surfaceLed.LedRectangle.Height);
+ graphics.FillRectangle(brush, rectangle);
+ UpdateLedColor(surfaceLed, deltaTime);
+ }
+ }
+
+ public void Dispose()
+ {
+ _colors = null;
+ }
+
+ public void LoadPlugin()
+ {
+ PopulateColors();
+ }
+
+ private void PopulateColors()
+ {
+ _colors = new Dictionary();
+ foreach (var surfaceLed in _surface.Leds)
+ _colors.Add(surfaceLed, ColorHelpers.GetRandomRainbowColor());
+ }
}
}
\ No newline at end of file
diff --git a/src/Artemis.Plugins.BuiltIn/packages.config b/src/Artemis.Plugins.BuiltIn/packages.config
index 8fd1e9d7b..1da8e04a0 100644
--- a/src/Artemis.Plugins.BuiltIn/packages.config
+++ b/src/Artemis.Plugins.BuiltIn/packages.config
@@ -1,23 +1,23 @@
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -29,6 +29,7 @@
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index fb58d2deb..d2ed5d1ef 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -63,8 +63,8 @@
..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll
-
- ..\packages\HidSharp.1.5\lib\net35\HidSharp.dll
+
+ ..\packages\HidSharp.2.0.1\lib\net35\HidSharp.dll
..\packages\MahApps.Metro.1.6.1\lib\net45\MahApps.Metro.dll
@@ -87,44 +87,44 @@
..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll
-
- ..\packages\PropertyChanged.Fody.2.4.0\lib\net452\PropertyChanged.dll
+
+ ..\packages\PropertyChanged.Fody.2.5.3\lib\net452\PropertyChanged.dll
- ..\packages\RGB.NET.Brushes.0.0.1.49\lib\net45\RGB.NET.Brushes.dll
+ ..\packages\RGB.NET.Brushes.0.0.1.51\lib\net45\RGB.NET.Brushes.dll
- ..\packages\RGB.NET.Core.0.0.1.49\lib\net45\RGB.NET.Core.dll
+ ..\packages\RGB.NET.Core.0.0.1.51\lib\net45\RGB.NET.Core.dll
- ..\packages\RGB.NET.Decorators.0.0.1.49\lib\net45\RGB.NET.Decorators.dll
+ ..\packages\RGB.NET.Decorators.0.0.1.51\lib\net45\RGB.NET.Decorators.dll
- ..\packages\RGB.NET.Devices.Asus.0.0.1.49\lib\net45\RGB.NET.Devices.Asus.dll
+ ..\packages\RGB.NET.Devices.Asus.0.0.1.51\lib\net45\RGB.NET.Devices.Asus.dll
- ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.49\lib\net45\RGB.NET.Devices.CoolerMaster.dll
+ ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.51\lib\net45\RGB.NET.Devices.CoolerMaster.dll
- ..\packages\RGB.NET.Devices.Corsair.0.0.1.49\lib\net45\RGB.NET.Devices.Corsair.dll
+ ..\packages\RGB.NET.Devices.Corsair.0.0.1.51\lib\net45\RGB.NET.Devices.Corsair.dll
- ..\packages\RGB.NET.Devices.DMX.0.0.1.49\lib\net45\RGB.NET.Devices.DMX.dll
+ ..\packages\RGB.NET.Devices.DMX.0.0.1.51\lib\net45\RGB.NET.Devices.DMX.dll
- ..\packages\RGB.NET.Devices.Logitech.0.0.1.49\lib\net45\RGB.NET.Devices.Logitech.dll
+ ..\packages\RGB.NET.Devices.Logitech.0.0.1.51\lib\net45\RGB.NET.Devices.Logitech.dll
- ..\packages\RGB.NET.Devices.Novation.0.0.1.49\lib\net45\RGB.NET.Devices.Novation.dll
+ ..\packages\RGB.NET.Devices.Novation.0.0.1.51\lib\net45\RGB.NET.Devices.Novation.dll
- ..\packages\RGB.NET.Devices.Razer.0.0.1.49\lib\net45\RGB.NET.Devices.Razer.dll
+ ..\packages\RGB.NET.Devices.Razer.0.0.1.51\lib\net45\RGB.NET.Devices.Razer.dll
- ..\packages\RGB.NET.Groups.0.0.1.49\lib\net45\RGB.NET.Groups.dll
+ ..\packages\RGB.NET.Groups.0.0.1.51\lib\net45\RGB.NET.Groups.dll
- ..\packages\Sanford.Multimedia.Midi.6.6.0\lib\net20\Sanford.Multimedia.Midi.dll
+ ..\packages\Sanford.Multimedia.Midi.Standard.6.6.0\lib\net35\Sanford.Multimedia.Midi.dll
..\packages\Stylet.1.1.21\lib\net45\Stylet.dll
@@ -273,7 +273,7 @@ xcopy /s /y /q $(SolutionDir)Artemis.Plugins.BuiltIn\Modules %25ProgramData%25\A
-
+
@@ -281,5 +281,5 @@ xcopy /s /y /q $(SolutionDir)Artemis.Plugins.BuiltIn\Modules %25ProgramData%25\A
-
+
\ No newline at end of file
diff --git a/src/Artemis.UI/packages.config b/src/Artemis.UI/packages.config
index 23ff11d46..68d0ae29e 100644
--- a/src/Artemis.UI/packages.config
+++ b/src/Artemis.UI/packages.config
@@ -2,8 +2,8 @@
-
-
+
+
@@ -11,24 +11,24 @@
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -40,6 +40,7 @@
+
\ No newline at end of file