mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Reuse shaders/paint where possible
Added noise test
This commit is contained in:
parent
49cf96e12c
commit
33d0fca15e
@ -17,6 +17,8 @@ namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
private readonly List<LayerElement> _layerElements;
|
||||
private List<ArtemisLed> _leds;
|
||||
private SKBitmap _renderBitmap;
|
||||
private SKCanvas _renderCanvas;
|
||||
|
||||
public Layer(Profile profile, ProfileElement parent, string name)
|
||||
{
|
||||
@ -70,33 +72,28 @@ namespace Artemis.Core.Models.Profile
|
||||
foreach (var layerElement in LayerElements)
|
||||
layerElement.RenderPreProcess(surface, canvas);
|
||||
|
||||
using (var bitmap = new SKBitmap(new SKImageInfo((int) RenderRectangle.Width, (int) RenderRectangle.Height)))
|
||||
using (var layerCanvas = new SKCanvas(bitmap))
|
||||
_renderCanvas.Clear();
|
||||
foreach (var layerElement in LayerElements)
|
||||
layerElement.Render(surface, _renderCanvas);
|
||||
|
||||
var baseShader = SKShader.CreateBitmap(_renderBitmap, SKShaderTileMode.Repeat, SKShaderTileMode.Repeat, SKMatrix.MakeTranslation(RenderRectangle.Left, RenderRectangle.Top));
|
||||
foreach (var layerElement in LayerElements)
|
||||
{
|
||||
layerCanvas.Clear();
|
||||
var newBaseShader = layerElement.RenderPostProcess(surface, _renderBitmap, baseShader);
|
||||
if (newBaseShader == null)
|
||||
continue;
|
||||
|
||||
foreach (var layerElement in LayerElements)
|
||||
layerElement.Render(surface, layerCanvas);
|
||||
// Dispose the old base shader if the layer element provided a new one
|
||||
if (!ReferenceEquals(baseShader, newBaseShader))
|
||||
baseShader.Dispose();
|
||||
|
||||
var baseShader = SKShader.CreateBitmap(bitmap, SKShaderTileMode.Repeat, SKShaderTileMode.Repeat, SKMatrix.MakeTranslation(RenderRectangle.Left, RenderRectangle.Top));
|
||||
foreach (var layerElement in LayerElements)
|
||||
{
|
||||
var newBaseShader = layerElement.RenderPostProcess(surface, bitmap, baseShader);
|
||||
if (newBaseShader == null)
|
||||
continue;
|
||||
|
||||
// Dispose the old base shader if the layer element provided a new one
|
||||
if (!ReferenceEquals(baseShader, newBaseShader))
|
||||
baseShader.Dispose();
|
||||
|
||||
baseShader = newBaseShader;
|
||||
}
|
||||
|
||||
//canvas.ClipPath(RenderPath);
|
||||
canvas.DrawRect(RenderRectangle, new SKPaint {Shader = baseShader, FilterQuality = SKFilterQuality.Low});
|
||||
baseShader.Dispose();
|
||||
baseShader = newBaseShader;
|
||||
}
|
||||
|
||||
canvas.ClipPath(RenderPath);
|
||||
canvas.DrawRect(RenderRectangle, new SKPaint {Shader = baseShader, FilterQuality = SKFilterQuality.Low});
|
||||
baseShader.Dispose();
|
||||
|
||||
canvas.Restore();
|
||||
}
|
||||
|
||||
@ -188,7 +185,7 @@ namespace Artemis.Core.Models.Profile
|
||||
_leds = leds;
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
|
||||
internal void CalculateRenderProperties()
|
||||
{
|
||||
if (!Leds.Any())
|
||||
@ -208,6 +205,13 @@ namespace Artemis.Core.Models.Profile
|
||||
path.AddRect(artemisLed.AbsoluteRenderRectangle);
|
||||
|
||||
RenderPath = path;
|
||||
|
||||
var oldBitmap = _renderBitmap;
|
||||
var oldCanvas = _renderCanvas;
|
||||
_renderBitmap = new SKBitmap(new SKImageInfo((int) RenderRectangle.Width, (int) RenderRectangle.Height));
|
||||
_renderCanvas = new SKCanvas(_renderBitmap);
|
||||
oldBitmap?.Dispose();
|
||||
oldCanvas?.Dispose();
|
||||
OnRenderPropertiesUpdated();
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Artemis.Core.Services
|
||||
_logger.Warning("RgbDevice provider {deviceProvider} has no devices", deviceProvider.GetType().Name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
foreach (var surfaceDevice in deviceProvider.Devices)
|
||||
{
|
||||
if (!_loadedDevices.Contains(surfaceDevice))
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Artemis.Plugins.LayerElements.Noise</RootNamespace>
|
||||
<AssemblyName>Artemis.Plugins.LayerElements.Noise</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SkiaSharp.1.68.1\lib\net45\SkiaSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="NoiseLayerElement.cs" />
|
||||
<Compile Include="NoiseLayerElementProvider.cs" />
|
||||
<Compile Include="NoiseLayerElementSettings.cs" />
|
||||
<Compile Include="NoiseLayerElementViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="NoiseLayerElementView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
|
||||
<Project>{9b811f9b-86b9-4771-87af-72bae7078a36}</Project>
|
||||
<Name>Artemis.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
59
src/Artemis.Plugins.LayerElements.Noise/NoiseLayerElement.cs
Normal file
59
src/Artemis.Plugins.LayerElements.Noise/NoiseLayerElement.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.LayerElement;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Plugins.LayerElements.Noise
|
||||
{
|
||||
public class NoiseLayerElement : LayerElement
|
||||
{
|
||||
private SKShader _shader;
|
||||
private List<SKColor> _testColors;
|
||||
private SKPaint _paint;
|
||||
|
||||
public NoiseLayerElement(Layer layer, Guid guid, NoiseLayerElementSettings settings, LayerElementDescriptor descriptor) : base(layer, guid, settings, descriptor)
|
||||
{
|
||||
Settings = settings;
|
||||
|
||||
_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();
|
||||
Layer.RenderPropertiesUpdated += (sender, args) => CreateShader();
|
||||
Settings.PropertyChanged += (sender, args) => CreateShader();
|
||||
}
|
||||
|
||||
private void CreateShader()
|
||||
{
|
||||
var shader = SKShader.CreatePerlinNoiseFractalNoise(1, 1, 1, 1);
|
||||
|
||||
var oldShader = _shader;
|
||||
var oldPaint = _paint;
|
||||
_shader = shader;
|
||||
_paint = new SKPaint {Shader = _shader, FilterQuality = SKFilterQuality.Low};
|
||||
oldShader?.Dispose();
|
||||
oldPaint?.Dispose();
|
||||
}
|
||||
|
||||
public new NoiseLayerElementSettings Settings { get; }
|
||||
|
||||
public override LayerElementViewModel GetViewModel()
|
||||
{
|
||||
return new NoiseLayerElementViewModel(this);
|
||||
}
|
||||
|
||||
public override void Render(ArtemisSurface surface, SKCanvas canvas)
|
||||
{
|
||||
canvas.DrawRect(Layer.AbsoluteRenderRectangle, _paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
using Artemis.Core.Plugins.LayerElement;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Plugins.LayerElements.Noise
|
||||
{
|
||||
public class NoiseLayerElementProvider : LayerElementProvider
|
||||
{
|
||||
public NoiseLayerElementProvider(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
AddLayerElementDescriptor<NoiseLayerElement>("Noise", "A brush of that shows a perlin noise", "Brush");
|
||||
}
|
||||
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
}
|
||||
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Artemis.Core.Plugins.LayerElement;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Plugins.LayerElements.Noise
|
||||
{
|
||||
public class NoiseLayerElementSettings : LayerElementSettings
|
||||
{
|
||||
private BrushType _brushType;
|
||||
private List<SKColor> _colors;
|
||||
|
||||
public NoiseLayerElementSettings()
|
||||
{
|
||||
BrushType = BrushType.Solid;
|
||||
Colors = new List<SKColor>();
|
||||
}
|
||||
|
||||
public BrushType BrushType
|
||||
{
|
||||
get => _brushType;
|
||||
set => SetAndNotify(ref _brushType, value);
|
||||
}
|
||||
|
||||
public List<SKColor> Colors
|
||||
{
|
||||
get => _colors;
|
||||
set => SetAndNotify(ref _colors, value);
|
||||
}
|
||||
}
|
||||
|
||||
public enum BrushType
|
||||
{
|
||||
[Description("Solid")]
|
||||
Solid,
|
||||
|
||||
[Description("Linear Gradient")]
|
||||
LinearGradient,
|
||||
|
||||
[Description("Radial Gradient")]
|
||||
RadialGradient,
|
||||
|
||||
[Description("Sweep Gradient")]
|
||||
SweepGradient
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
<UserControl x:Class="Artemis.Plugins.LayerElements.Noise.BrushLayerElementView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:brushLayer="clr-namespace:Artemis.Plugins.LayerElements.Brush"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Teal.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Teal.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<!-- Sample 1 -->
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
||||
</StackPanel>
|
||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||
</Grid>
|
||||
|
||||
<!-- Sample 1 -->
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
||||
</StackPanel>
|
||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||
</Grid>
|
||||
|
||||
<!-- Setting 2 -->
|
||||
<Grid Grid.Row="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
||||
</StackPanel>
|
||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||
</Grid>
|
||||
|
||||
<!-- Setting 2 -->
|
||||
<Grid Grid.Row="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
||||
</StackPanel>
|
||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -0,0 +1,14 @@
|
||||
using Artemis.Core.Plugins.LayerElement;
|
||||
|
||||
namespace Artemis.Plugins.LayerElements.Noise
|
||||
{
|
||||
public class NoiseLayerElementViewModel : LayerElementViewModel
|
||||
{
|
||||
public NoiseLayerElementViewModel(NoiseLayerElement layerElement) : base(layerElement)
|
||||
{
|
||||
LayerElement = layerElement;
|
||||
}
|
||||
|
||||
public new NoiseLayerElement LayerElement { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Artemis.Plugins.LayerElements.Noise")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Artemis.Plugins.LayerElements.Noise")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 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("7f4c7ab0-4c9b-452d-afed-34544c903def")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
35
src/Artemis.Plugins.LayerElements.Noise/app.config
Normal file
35
src/Artemis.Plugins.LayerElements.Noise/app.config
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
|
||||
</dependentAssembly>
|
||||
<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.5.0" newVersion="4.0.5.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>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
9
src/Artemis.Plugins.LayerElements.Noise/packages.config
Normal file
9
src/Artemis.Plugins.LayerElements.Noise/packages.config
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="SkiaSharp" version="1.68.1" targetFramework="net472" />
|
||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
|
||||
</packages>
|
||||
10
src/Artemis.Plugins.LayerElements.Noise/plugin.json
Normal file
10
src/Artemis.Plugins.LayerElements.Noise/plugin.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Guid": "61cbbf01-8d69-4ede-a972-f3f269da66d9",
|
||||
"Name": "Noise layer elements",
|
||||
"Version": {
|
||||
"Major": 1,
|
||||
"Minor": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"Main": "Artemis.Plugins.LayerElements.Noise.dll"
|
||||
}
|
||||
@ -12,6 +12,7 @@ namespace Artemis.Plugins.LayerElements.Brush
|
||||
{
|
||||
private SKShader _shader;
|
||||
private List<SKColor> _testColors;
|
||||
private SKPaint _paint;
|
||||
|
||||
public BrushLayerElement(Layer layer, Guid guid, BrushLayerElementSettings settings, LayerElementDescriptor descriptor) : base(layer, guid, settings, descriptor)
|
||||
{
|
||||
@ -52,11 +53,13 @@ namespace Artemis.Plugins.LayerElements.Brush
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
var oldShader = _shader;
|
||||
_shader = shader;
|
||||
|
||||
var oldShader = _shader;
|
||||
var oldPaint = _paint;
|
||||
_shader = shader;
|
||||
_paint = new SKPaint {Shader = _shader, FilterQuality = SKFilterQuality.Low};
|
||||
oldShader?.Dispose();
|
||||
oldPaint?.Dispose();
|
||||
}
|
||||
|
||||
public new BrushLayerElementSettings Settings { get; }
|
||||
@ -68,10 +71,7 @@ namespace Artemis.Plugins.LayerElements.Brush
|
||||
|
||||
public override void Render(ArtemisSurface surface, SKCanvas canvas)
|
||||
{
|
||||
using (var paint = new SKPaint {Shader = _shader, FilterQuality = SKFilterQuality.Low})
|
||||
{
|
||||
canvas.DrawRect(Layer.AbsoluteRenderRectangle, paint);
|
||||
}
|
||||
canvas.DrawRect(Layer.AbsoluteRenderRectangle, _paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.UI", "Artemis.UI\Ar
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E592F239-FAA0-4840-9C85-46E5867D06D5} = {E592F239-FAA0-4840-9C85-46E5867D06D5}
|
||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2} = {0F288A66-6EB0-4589-8595-E33A3A3EAEA2}
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF} = {7F4C7AB0-4C9B-452D-AFED-34544C903DEF}
|
||||
{235A45C7-24AD-4F47-B9D4-CD67E610A04D} = {235A45C7-24AD-4F47-B9D4-CD67E610A04D}
|
||||
{6FE5DED5-D62E-4811-985F-644124FCEEFE} = {6FE5DED5-D62E-4811-985F-644124FCEEFE}
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D} = {A779B2F8-C253-4C4B-8634-6EB8F594E96D}
|
||||
@ -28,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins.Devices.Log
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins.LayerElements.Animations", "Artemis.Plugins.LayerElements.Animations\Artemis.Plugins.LayerElements.Animations.csproj", "{6FE5DED5-D62E-4811-985F-644124FCEEFE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins.LayerElements.Noise", "Artemis.Plugins.LayerElements.Noise\Artemis.Plugins.LayerElements.Noise.csproj", "{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -100,6 +103,14 @@ Global
|
||||
{6FE5DED5-D62E-4811-985F-644124FCEEFE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6FE5DED5-D62E-4811-985F-644124FCEEFE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{6FE5DED5-D62E-4811-985F-644124FCEEFE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -110,6 +121,7 @@ Global
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
{235A45C7-24AD-4F47-B9D4-CD67E610A04D} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
{6FE5DED5-D62E-4811-985F-644124FCEEFE} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user