Plugins - Added optional configuration window

Plugins - Moved plugins to their own directory
Device providers - Added all RGB.NET device providers
This commit is contained in:
Robert committed 2020-02-27 13:25:38 +01:00
1 parent e15bf3688b
commit 2bcee30e11
752 files changed
+2198 -73

No files matched your search

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
<AssemblyTitle>Artemis.Plugins.LayerBrushes.Color</AssemblyTitle>
<Product>Artemis</Product>
<Copyright>Copyright © Robert Beekman - 2019</Copyright>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<UseWPF>true</UseWPF>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugType>full</DebugType>
<LangVersion>7</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugType>pdbonly</DebugType>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\x64\Debug\ColorBrushView.g.i.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<Exec Command="echo Copying resources to plugin output directory&#xD;&#xA;XCOPY &quot;$(ProjectDir)Images&quot; &quot;$(TargetDir)Images&quot; /s /q /i /y&#xD;&#xA;XCOPY &quot;$(ProjectDir)Layouts&quot; &quot;$(TargetDir)Layouts&quot; /s /q /i /y&#xD;&#xA;echo Copying plugin to Artemis.UI output directory&#xD;&#xA;XCOPY &quot;$(TargetDir.TrimEnd('\'))&quot; &quot;$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)&quot; /s /q /i /y" />
</Target>
</Project>
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Plugins.LayerBrush;
using SkiaSharp;
namespace Artemis.Plugins.LayerBrushes.Color
{
public class ColorBrush : LayerBrush
{
private readonly List<SKColor> _testColors;
private SKColor _color;
private SKPaint _paint;
private SKShader _shader;
private SKRect _shaderBounds;
public ColorBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
{
ColorProperty = RegisterLayerProperty("Brush.Color", "Color", "The color of the brush", new SKColor(255,0,0));
GradientTypeProperty = RegisterLayerProperty<GradientType>("Brush.GradientType", "Gradient type", "The type of color brush to draw");
GradientTypeProperty.CanUseKeyframes = false;
_testColors = new List<SKColor>();
for (var i = 0; i < 9; i++)
{
if (i != 8)
_testColors.Add(SKColor.FromHsv(i * 32, 100, 100));
else
_testColors.Add(SKColor.FromHsv(0, 100, 100));
}
CreateShader(_shaderBounds);
Layer.RenderPropertiesUpdated += (sender, args) => CreateShader(_shaderBounds);
GradientTypeProperty.ValueChanged += (sender, args) => CreateShader(_shaderBounds);
}
public LayerProperty<SKColor> ColorProperty { get; set; }
public LayerProperty<GradientType> GradientTypeProperty { get; set; }
public override void Update(double deltaTime)
{
// Only recreate the shader if the color changed
if (_color != ColorProperty.CurrentValue)
{
_color = ColorProperty.CurrentValue;
CreateShader(_shaderBounds);
}
base.Update(deltaTime);
}
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
{
if (path.Bounds != _shaderBounds)
CreateShader(path.Bounds);
paint.Shader = _shader;
canvas.DrawPath(path, paint);
}
private void CreateShader(SKRect pathBounds)
{
var center = new SKPoint(Layer.Bounds.MidX, Layer.Bounds.MidY);
SKShader shader;
switch (GradientTypeProperty.CurrentValue)
{
case GradientType.Solid:
shader = SKShader.CreateColor(_color);
break;
case GradientType.LinearGradient:
shader = SKShader.CreateLinearGradient(new SKPoint(0, 0), new SKPoint(pathBounds.Width, 0), _testColors.ToArray(), SKShaderTileMode.Repeat);
break;
case GradientType.RadialGradient:
shader = SKShader.CreateRadialGradient(center, Math.Min(pathBounds.Width, pathBounds.Height), _testColors.ToArray(), SKShaderTileMode.Repeat);
break;
case GradientType.SweepGradient:
shader = SKShader.CreateSweepGradient(center, _testColors.ToArray(), null, SKShaderTileMode.Clamp, 0, 360);
break;
default:
throw new ArgumentOutOfRangeException();
}
var oldShader = _shader;
var oldPaint = _paint;
_shader = shader;
_paint = new SKPaint {Shader = _shader, FilterQuality = SKFilterQuality.Low};
_shaderBounds = pathBounds;
oldShader?.Dispose();
oldPaint?.Dispose();
}
}
public enum GradientType
{
[Description("Solid")]
Solid,
[Description("Linear Gradient")]
LinearGradient,
[Description("Radial Gradient")]
RadialGradient,
[Description("Sweep Gradient")]
SweepGradient
}
}
@@ -0,0 +1,25 @@
using Artemis.Core.Plugins.LayerBrush;
using Artemis.Core.Plugins.Models;
namespace Artemis.Plugins.LayerBrushes.Color
{
public class ColorBrushProvider : LayerBrushProvider
{
public ColorBrushProvider(PluginInfo pluginInfo) : base(pluginInfo)
{
AddLayerBrushDescriptor<ColorBrush>("Color", "A color with an (optional) gradient", "Brush");
}
public override void EnablePlugin()
{
}
public override void DisablePlugin()
{
}
public override void Dispose()
{
}
}
}
@@ -0,0 +1,10 @@
using System.Reflection;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0f288a66-6eb0-4589-8595-e33a3a3eaea2")]
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.5.0" newVersion="1.4.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
@@ -0,0 +1,6 @@
{
"Guid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
"Name": "Color layer brush",
"Version": "1.0.0.0",
"Main": "Artemis.Plugins.LayerBrushes.Color.dll"
}