mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profiles - Abstracted property elements and effect elements
Folders - Added properties to folders Layer effects - Expanded to folders Layer effects - Added shape clipping
This commit is contained in:
1 parent
1a637f7f95
commit
9f778d840f
42 files changed
+638
-347
No files matched your search
@@ -43,11 +43,11 @@ namespace Artemis.Plugins.Devices.Logitech
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Debug("Found Logitech device {name} with PID {pid}", hidDevice.GetFriendlyName(), hidDevice.ProductID);
|
||||
_logger.Debug("Found Logitech device {name} with PID 0x{pid}", hidDevice.GetFriendlyName(), hidDevice.ProductID.ToString("X"));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_logger.Debug("Found Logitech device with PID {pid}", hidDevice.ProductID);
|
||||
_logger.Debug("Found Logitech device with PID 0x{pid}", hidDevice.ProductID.ToString("X"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Plugins.LayerBrushes.Noise.Utilities;
|
||||
@@ -61,11 +62,11 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
|
||||
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
{
|
||||
var mainColor = Properties.MainColor?.CurrentValue;
|
||||
var gradientColor = Properties.GradientColor?.CurrentValue;
|
||||
var mainColor = Properties.MainColor.CurrentValue;
|
||||
var secondColor = Properties.SecondaryColor.CurrentValue;
|
||||
var gradientColor = Properties.GradientColor.CurrentValue;
|
||||
var scale = Properties.Scale.CurrentValue;
|
||||
var opacity = mainColor != null ? (float) Math.Round(mainColor.Value.Alpha / 255.0, 2, MidpointRounding.AwayFromZero) : 0;
|
||||
var hardness = 127 + Properties.Hardness.CurrentValue;
|
||||
var hardness = Properties.Hardness.CurrentValue / 100f;
|
||||
|
||||
// Scale down the render path to avoid computing a value for every pixel
|
||||
var width = (int) Math.Floor(path.Bounds.Width * _renderScale);
|
||||
@@ -83,35 +84,31 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
if (double.IsInfinity(evalX) || double.IsNaN(evalX) || double.IsNaN(evalY) || double.IsInfinity(evalY))
|
||||
continue;
|
||||
|
||||
var v = _noise.Evaluate(evalX, evalY, _z);
|
||||
var alpha = (byte) Math.Max(0, Math.Min(255, v * hardness));
|
||||
if (Properties.ColorType.BaseValue == ColorMappingType.Simple && mainColor != null)
|
||||
_bitmap.SetPixel(x, y, new SKColor(mainColor.Value.Red, mainColor.Value.Green, mainColor.Value.Blue, (byte) (alpha * opacity)));
|
||||
var v = (float) _noise.Evaluate(evalX, evalY, _z) * hardness;
|
||||
var amount = Math.Max(0f, Math.Min(1f, v));
|
||||
if (Properties.ColorType.BaseValue == ColorMappingType.Simple)
|
||||
_bitmap.SetPixel(x, y, mainColor.Interpolate(secondColor, amount));
|
||||
else if (gradientColor != null && _colorMap.Length == 101)
|
||||
{
|
||||
var color = _colorMap[(int) Math.Round(alpha / 255f * 100, MidpointRounding.AwayFromZero)];
|
||||
var color = _colorMap[(int) Math.Round(amount * 100, MidpointRounding.AwayFromZero)];
|
||||
_bitmap.SetPixel(x, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var bitmapTransform = SKMatrix.Concat(
|
||||
SKMatrix.MakeTranslation(path.Bounds.Left, path.Bounds.Top),
|
||||
SKMatrix.MakeScale(1f / _renderScale, 1f / _renderScale)
|
||||
);
|
||||
|
||||
canvas.ClipPath(path);
|
||||
if (Properties.ColorType.BaseValue == ColorMappingType.Simple)
|
||||
{
|
||||
using var backgroundShader = SKShader.CreateColor(Properties.SecondaryColor.CurrentValue);
|
||||
paint.Shader = backgroundShader;
|
||||
canvas.DrawRect(path.Bounds, paint);
|
||||
paint.Color = Properties.SecondaryColor.CurrentValue;
|
||||
}
|
||||
|
||||
using var foregroundShader = SKShader.CreateBitmap(_bitmap, SKShaderTileMode.Clamp, SKShaderTileMode.Clamp, bitmapTransform);
|
||||
paint.Shader = foregroundShader;
|
||||
canvas.DrawRect(path.Bounds, paint);
|
||||
canvas.DrawPath(path, paint);
|
||||
}
|
||||
|
||||
private void GradientColorChanged(object sender, PropertyChangedEventArgs e)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
[PropertyDescription(Description = "The scale of the noise", MinInputValue = 0f, InputAffix = "%")]
|
||||
public SKSizeLayerProperty Scale { get; set; }
|
||||
|
||||
[PropertyDescription(Description = "The hardness of the noise, lower means there are gradients in the noise, higher means hard lines", MinInputValue = 0f, MaxInputValue = 2048f)]
|
||||
[PropertyDescription(Description = "The hardness of the noise, lower means there are gradients in the noise, higher means hard lines", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 400)]
|
||||
public FloatLayerProperty Hardness { get; set; }
|
||||
|
||||
[PropertyDescription(Description = "The speed at which the noise moves vertically and horizontally", MinInputValue = -64f, MaxInputValue = 64f)]
|
||||
@@ -39,7 +39,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
SecondaryColor.DefaultValue = new SKColor(0, 0, 255);
|
||||
GradientColor.DefaultValue = ColorGradient.GetUnicornBarf();
|
||||
Scale.DefaultValue = new SKSize(100, 100);
|
||||
Hardness.DefaultValue = 500f;
|
||||
Hardness.DefaultValue = 100f;
|
||||
AnimationSpeed.DefaultValue = 25f;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,13 +37,13 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
}
|
||||
}
|
||||
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
if (_imageFilter != null)
|
||||
paint.ImageFilter = SKImageFilter.CreateMerge(paint.ImageFilter, _imageFilter);
|
||||
}
|
||||
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
}
|
||||
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
paint.ImageFilter = SKImageFilter.CreateDilate(
|
||||
(int) Properties.DilateRadius.CurrentValue.Width,
|
||||
@@ -26,7 +26,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
);
|
||||
}
|
||||
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
public class DilateEffectProperties : LayerPropertyGroup
|
||||
{
|
||||
[PropertyDescription(Description = "The amount of dilation to apply")]
|
||||
[PropertyDescription(Description = "The amount of dilation to apply", MinInputValue = 0)]
|
||||
public SKSizeLayerProperty DilateRadius { get; set; }
|
||||
|
||||
protected override void PopulateDefaults()
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
}
|
||||
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
paint.ImageFilter = SKImageFilter.CreateErode(
|
||||
(int) Properties.ErodeRadius.CurrentValue.Width,
|
||||
@@ -26,7 +26,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
);
|
||||
}
|
||||
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Types;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
public class ErodeEffectProperties : LayerPropertyGroup
|
||||
{
|
||||
[PropertyDescription(Description = "The amount of erode to apply")]
|
||||
[PropertyDescription(Description = "The amount of erode to apply", MinInputValue = 0)]
|
||||
public SKSizeLayerProperty ErodeRadius { get; set; }
|
||||
|
||||
protected override void PopulateDefaults()
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
}
|
||||
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
paint.ImageFilter = SKImageFilter.CreateDropShadow(
|
||||
Properties.GlowOffset.CurrentValue.X,
|
||||
@@ -29,7 +29,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
);
|
||||
}
|
||||
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
{
|
||||
}
|
||||
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
paint.ImageFilter = SKImageFilter.CreateColorFilter(SKColorFilter.CreateColorMatrix(new[]
|
||||
{
|
||||
@@ -28,7 +28,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
||||
}), paint.ImageFilter);
|
||||
}
|
||||
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user