mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Plugin settings window - Updated design
Brushes - Added option for brushes to have a settings window Effects - Added option for effects to have a settings window
This commit is contained in:
1 parent
2ad78411c8
commit
b80e59fa51
20 files changed
+403
-23
No files matched your search
@@ -102,9 +102,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
);
|
||||
|
||||
if (Properties.ColorType.BaseValue == ColorMappingType.Simple)
|
||||
{
|
||||
paint.Color = Properties.SecondaryColor.CurrentValue;
|
||||
}
|
||||
|
||||
using var foregroundShader = SKShader.CreateBitmap(_bitmap, SKShaderTileMode.Clamp, SKShaderTileMode.Clamp, bitmapTransform);
|
||||
paint.Shader = foregroundShader;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
using Artemis.Plugins.LayerEffects.Filter.ViewModels;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
public class ColorMatrixEffect : LayerEffect<ColorMatrixEffectProperties>
|
||||
{
|
||||
public override void EnableLayerEffect()
|
||||
{
|
||||
HasConfigurationViewModel = true;
|
||||
}
|
||||
|
||||
public override EffectConfigurationViewModel GetConfigurationViewModel()
|
||||
{
|
||||
return new ColorMatrixConfigurationViewModel(this);
|
||||
}
|
||||
|
||||
public override void DisableLayerEffect()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
paint.ImageFilter = SKImageFilter.CreateColorFilter(SKColorFilter.CreateColorMatrix(Properties.ColorMatrix.CurrentValue), paint.ImageFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
|
||||
namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
public class ColorMatrixEffectProperties : LayerPropertyGroup
|
||||
{
|
||||
[PropertyDescription]
|
||||
public LayerProperty<float[]> ColorMatrix { get; set; }
|
||||
|
||||
protected override void PopulateDefaults()
|
||||
{
|
||||
// Set a gray scale value as default
|
||||
ColorMatrix.DefaultValue = new[]
|
||||
{
|
||||
0.21f, 0.72f, 0.07f, 0, 0,
|
||||
0.21f, 0.72f, 0.07f, 0, 0,
|
||||
0.21f, 0.72f, 0.07f, 0, 0,
|
||||
0, 0, 0, 1, 0
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
ColorMatrix.IsHidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
AddLayerEffectDescriptor<ErodeEffect>("Erode", "A layer effect providing an erode filter effect", "EyeMinus");
|
||||
AddLayerEffectDescriptor<GlowEffect>("Glow", "A layer effect providing a glow filter effect", "BoxShadow");
|
||||
AddLayerEffectDescriptor<GrayScaleEffect>("Gray-scale", "A layer effect providing a gray-scale filter effect", "InvertColors");
|
||||
AddLayerEffectDescriptor<ColorMatrixEffect>("Color matrix", "A layer effect allowing you to apply a custom color matrix", "Matrix");
|
||||
}
|
||||
|
||||
public override void DisablePlugin()
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using System.Diagnostics;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
|
||||
namespace Artemis.Plugins.LayerEffects.Filter.ViewModels
|
||||
{
|
||||
public class ColorMatrixConfigurationViewModel : EffectConfigurationViewModel
|
||||
{
|
||||
public ColorMatrixConfigurationViewModel(ColorMatrixEffect layerEffect) : base(layerEffect)
|
||||
{
|
||||
Properties = layerEffect.Properties;
|
||||
}
|
||||
|
||||
public ColorMatrixEffectProperties Properties { get; set; }
|
||||
|
||||
public void OpenGuide()
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("cmd", "/c start https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters")
|
||||
{
|
||||
CreateNoWindow = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<UserControl x:Class="Artemis.Plugins.LayerEffects.Filter.Views.ColorMatrixConfigurationView"
|
||||
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:local="clr-namespace:Artemis.Plugins.LayerEffects.Filter.Views"
|
||||
xmlns:viewModels="clr-namespace:Artemis.Plugins.LayerEffects.Filter.ViewModels"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance viewModels:ColorMatrixConfigurationViewModel}">
|
||||
<StackPanel Margin="15">
|
||||
<TextBlock>
|
||||
Below you can define the color matrix to be applied to the folder/layer. <LineBreak/>
|
||||
Please note this is an advanced effect mainly included for the sake of completion.
|
||||
</TextBlock>
|
||||
<TextBlock TextWrapping="Wrap" Margin="0 25">
|
||||
If you are still not deterred,
|
||||
<Hyperlink NavigateUri="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters"
|
||||
RequestNavigate="{s:Action OpenGuide}">
|
||||
click here
|
||||
</Hyperlink>
|
||||
for a full explanation of color transforms in SkiaSharp, the rendering library Artemis uses.
|
||||
</TextBlock>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50" />
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="0" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[0]}" Margin="2" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[1]}" Margin="2" />
|
||||
<TextBox Grid.Row="0" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[2]}" Margin="2" />
|
||||
<TextBox Grid.Row="0" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[3]}" Margin="2" />
|
||||
<TextBox Grid.Row="0" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[4]}" Margin="2" />
|
||||
|
||||
<TextBox Grid.Row="1" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[5]}" Margin="2" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[6]}" Margin="2" />
|
||||
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[7]}" Margin="2" />
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[8]}" Margin="2" />
|
||||
<TextBox Grid.Row="1" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[9]}" Margin="2" />
|
||||
|
||||
<TextBox Grid.Row="2" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[10]}" Margin="2" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[11]}" Margin="2" />
|
||||
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[12]}" Margin="2" />
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[13]}" Margin="2" />
|
||||
<TextBox Grid.Row="2" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[14]}" Margin="2" />
|
||||
|
||||
<TextBox Grid.Row="3" Grid.Column="0" Text="{Binding Properties.ColorMatrix.CurrentValue[15]}" Margin="2" />
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Properties.ColorMatrix.CurrentValue[16]}" Margin="2" />
|
||||
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding Properties.ColorMatrix.CurrentValue[17]}" Margin="2" />
|
||||
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding Properties.ColorMatrix.CurrentValue[18]}" Margin="2" />
|
||||
<TextBox Grid.Row="3" Grid.Column="4" Text="{Binding Properties.ColorMatrix.CurrentValue[19]}" Margin="2" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
Reference in new issue
Block a user