Layer brushes - Added RGB.NET-based layer brushes

Layer brushes - Added sample RGB.NET-based color brush
Layer properties - Save on gradient edit dialog close
Layer properties - Fix layer brush keyframes not working after changing layer brush
This commit is contained in:
SpoinkyNL committed 2020-05-31 21:58:06 +02:00
1 parent 493790f6bd
commit cdb91021a2
31 files changed
+550 -146

No files matched your search

@@ -26,8 +26,6 @@ namespace Artemis.Plugins.LayerBrushes.Color
_color = Properties.Color.CurrentValue;
CreateShader();
}
base.Update(deltaTime);
}
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
@@ -42,6 +40,17 @@ namespace Artemis.Plugins.LayerBrushes.Color
canvas.DrawPath(path, paint);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_paint?.Dispose();
_shader?.Dispose();
}
base.Dispose(disposing);
}
protected override void OnPropertiesInitialized()
{
Properties.GradientType.BaseValueChanged += (sender, args) => CreateShader();
@@ -0,0 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
<AssemblyTitle>Artemis.Plugins.LayerBrushes.ColorRgbNet</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.3" />
<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>
<ItemGroup>
<Reference Include="RGB.NET.Brushes">
<HintPath>..\..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Brushes.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Core">
<HintPath>..\..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Groups">
<HintPath>..\..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Groups.dll</HintPath>
</Reference>
</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,9 @@
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,28 @@
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.LayerBrush;
using RGB.NET.Brushes;
using RGB.NET.Core;
namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
{
public class RgbNetColorBrush : RgbNetLayerBrush<RgbNetColorBrushProperties>
{
private readonly SolidColorBrush _solidBrush;
public RgbNetColorBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
{
_solidBrush = new SolidColorBrush(Color.Transparent);
}
public override void Update(double deltaTime)
{
_solidBrush.Color = Properties.Color.CurrentValue.ToRgbColor();
}
public override IBrush GetBrush()
{
return _solidBrush;
}
}
}
@@ -0,0 +1,22 @@
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Types;
using SkiaSharp;
namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
{
public class RgbNetColorBrushProperties : LayerPropertyGroup
{
[PropertyDescription(Description = "The color of the brush")]
public SKColorLayerProperty Color { get; set; }
protected override void PopulateDefaults()
{
Color.DefaultValue = new SKColor(255, 0, 0);
}
protected override void OnPropertiesInitialized()
{
}
}
}
@@ -0,0 +1,25 @@
using Artemis.Core.Plugins.LayerBrush;
using Artemis.Core.Plugins.Models;
namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
{
public class RgbNetColorBrushProvider : LayerBrushProvider
{
public RgbNetColorBrushProvider(PluginInfo pluginInfo) : base(pluginInfo)
{
AddLayerBrushDescriptor<RgbNetColorBrush>("RGB.NET Color", "A RGB.NET based color", "Brush");
}
public override void EnablePlugin()
{
}
public override void DisablePlugin()
{
}
public override void Dispose()
{
}
}
}
@@ -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,7 @@
{
"Guid": "0bbf931b-87ad-4809-9cd9-bda33f4d4695",
"Name": "RGB.NET Color layer brush",
"Description": "A basic RGB.NET-based color layer-brush providing solid colors and several types of gradients.",
"Version": "1.0.0.0",
"Main": "Artemis.Plugins.LayerBrushes.ColorRgbNet.dll"
}
@@ -47,7 +47,6 @@ namespace Artemis.Plugins.LayerBrushes.Noise
_z = 0;
DetermineRenderScale();
base.Update(deltaTime);
}
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
@@ -105,6 +104,16 @@ namespace Artemis.Plugins.LayerBrushes.Noise
canvas.DrawRect(path.Bounds, paint);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_bitmap?.Dispose();
}
base.Dispose(disposing);
}
protected override void OnPropertiesInitialized()
{
Properties.GradientColor.BaseValue.PropertyChanged += GradientColorChanged;