mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
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:
parent
493790f6bd
commit
cdb91021a2
@ -204,7 +204,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized)
|
if (LayerBrush?.BaseProperties == null || !LayerBrush.BaseProperties.PropertiesInitialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var properties = new List<BaseLayerProperty>(General.GetAllLayerProperties().Where(p => p.BaseKeyframes.Any()));
|
var properties = new List<BaseLayerProperty>(General.GetAllLayerProperties().Where(p => p.BaseKeyframes.Any()));
|
||||||
@ -269,6 +269,9 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
private void StretchRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
|
private void StretchRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
|
||||||
{
|
{
|
||||||
|
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized || LayerBrush.BrushType != LayerBrushType.Regular)
|
||||||
|
return;
|
||||||
|
|
||||||
// Apply transformations
|
// Apply transformations
|
||||||
var sizeProperty = Transform.Scale.CurrentValue;
|
var sizeProperty = Transform.Scale.CurrentValue;
|
||||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||||
@ -285,12 +288,14 @@ namespace Artemis.Core.Models.Profile
|
|||||||
canvas.Scale(sizeProperty.Width / 100f, sizeProperty.Height / 100f, anchorPosition.X, anchorPosition.Y);
|
canvas.Scale(sizeProperty.Width / 100f, sizeProperty.Height / 100f, anchorPosition.X, anchorPosition.Y);
|
||||||
canvas.Translate(x, y);
|
canvas.Translate(x, y);
|
||||||
|
|
||||||
if (LayerBrush != null && LayerBrush.BaseProperties.PropertiesInitialized)
|
LayerBrush.InternalRender(canvas, canvasInfo, new SKPath(LayerShape.Path), paint);
|
||||||
LayerBrush.Render(canvas, canvasInfo, new SKPath(LayerShape.Path), paint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClipRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
|
private void ClipRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
|
||||||
{
|
{
|
||||||
|
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized || LayerBrush.BrushType != LayerBrushType.Regular)
|
||||||
|
return;
|
||||||
|
|
||||||
// Apply transformations
|
// Apply transformations
|
||||||
var sizeProperty = Transform.Scale.CurrentValue;
|
var sizeProperty = Transform.Scale.CurrentValue;
|
||||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||||
@ -321,7 +326,8 @@ namespace Artemis.Core.Models.Profile
|
|||||||
);
|
);
|
||||||
var renderPath = new SKPath();
|
var renderPath = new SKPath();
|
||||||
renderPath.AddRect(boundsRect);
|
renderPath.AddRect(boundsRect);
|
||||||
LayerBrush?.Render(canvas, canvasInfo, renderPath, paint);
|
|
||||||
|
LayerBrush.InternalRender(canvas, canvasInfo, renderPath, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void CalculateRenderProperties()
|
internal void CalculateRenderProperties()
|
||||||
|
|||||||
@ -165,6 +165,9 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
internal void ApplyToEntity()
|
internal void ApplyToEntity()
|
||||||
{
|
{
|
||||||
|
if (!PropertiesInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
// Get all properties with a PropertyDescriptionAttribute
|
// Get all properties with a PropertyDescriptionAttribute
|
||||||
foreach (var propertyInfo in GetType().GetProperties())
|
foreach (var propertyInfo in GetType().GetProperties())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,17 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using RGB.NET.Core;
|
||||||
|
using RGB.NET.Groups;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.LayerBrush
|
namespace Artemis.Core.Plugins.LayerBrush
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A basic layer brush that does not implement any layer property, to use properties with persistent storage,
|
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead
|
||||||
/// implement <see cref="LayerBrush{T}" /> instead
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseLayerBrush : IDisposable
|
public abstract class BaseLayerBrush : IDisposable
|
||||||
{
|
{
|
||||||
|
protected BaseLayerBrush(Layer layer, LayerBrushDescriptor descriptor)
|
||||||
|
{
|
||||||
|
Layer = layer;
|
||||||
|
Descriptor = descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the layer this brush is applied to
|
/// Gets the layer this brush is applied to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,38 +35,43 @@ namespace Artemis.Core.Plugins.LayerBrush
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PluginInfo PluginInfo => Descriptor.LayerBrushProvider.PluginInfo;
|
public PluginInfo PluginInfo => Descriptor.LayerBrushProvider.PluginInfo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of layer brush
|
||||||
|
/// </summary>
|
||||||
|
public LayerBrushType BrushType { get; internal set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a reference to the layer property group without knowing it's type
|
||||||
|
/// </summary>
|
||||||
public virtual LayerPropertyGroup BaseProperties => null;
|
public virtual LayerPropertyGroup BaseProperties => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the brush is being removed from the layer
|
/// Called when the brush is being removed from the layer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Dispose()
|
public abstract void Dispose();
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called before rendering every frame, write your update logic here
|
/// Called before rendering every frame, write your update logic here
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deltaTime"></param>
|
/// <param name="deltaTime"></param>
|
||||||
public virtual void Update(double deltaTime)
|
public abstract void Update(double deltaTime);
|
||||||
{
|
|
||||||
}
|
// Not only is this needed to initialize properties on the layer brushes, it also prevents implementing anything
|
||||||
|
// but LayerBrush<T> and RgbNetLayerBrush<T> outside the core
|
||||||
|
internal abstract void Initialize(ILayerService layerService);
|
||||||
|
|
||||||
|
internal abstract void InternalRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main method of rendering anything to the layer. The provided <see cref="SKCanvas" /> is specific to the layer
|
/// Called when Artemis needs an instance of the RGB.NET brush you are implementing
|
||||||
/// and matches it's width and height.
|
|
||||||
/// <para>Called during rendering or layer preview, in the order configured on the layer</para>
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="canvas">The layer canvas</param>
|
/// <returns>Your RGB.NET brush</returns>
|
||||||
/// <param name="canvasInfo"></param>
|
internal abstract IBrush InternalGetBrush();
|
||||||
/// <param name="path">The path to be filled, represents the shape</param>
|
|
||||||
/// <param name="paint">The paint to be used to fill the shape</param>
|
|
||||||
public virtual void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void InitializeProperties(ILayerService layerService, string path)
|
public enum LayerBrushType
|
||||||
{
|
{
|
||||||
}
|
Regular,
|
||||||
|
RgbNet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,77 +1,52 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
|
||||||
using Artemis.Core.Plugins.Exceptions;
|
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using RGB.NET.Core;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.LayerBrush
|
namespace Artemis.Core.Plugins.LayerBrush
|
||||||
{
|
{
|
||||||
public abstract class LayerBrush<T> : BaseLayerBrush where T : LayerPropertyGroup
|
public abstract class LayerBrush<T> : PropertiesLayerBrush<T> where T : LayerPropertyGroup
|
||||||
{
|
{
|
||||||
private T _properties;
|
protected LayerBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
|
||||||
|
|
||||||
protected LayerBrush(Layer layer, LayerBrushDescriptor descriptor)
|
|
||||||
{
|
{
|
||||||
Layer = layer;
|
BrushType = LayerBrushType.Regular;
|
||||||
Descriptor = descriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the properties of this brush.
|
|
||||||
/// </summary>
|
|
||||||
public T Properties
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// I imagine a null reference here can be confusing, so lets throw an exception explaining what to do
|
|
||||||
if (_properties == null)
|
|
||||||
throw new ArtemisPluginException("Cannot access brush properties until OnPropertiesInitialized has been called");
|
|
||||||
return _properties;
|
|
||||||
}
|
|
||||||
internal set => _properties = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets whether all properties on this brush are initialized
|
/// The main method of rendering anything to the layer. The provided <see cref="SKCanvas" /> is specific to the layer
|
||||||
|
/// and matches it's width and height.
|
||||||
|
/// <para>Called during rendering or layer preview, in the order configured on the layer</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool PropertiesInitialized { get; private set; }
|
/// <param name="canvas">The layer canvas</param>
|
||||||
|
/// <param name="canvasInfo"></param>
|
||||||
|
/// <param name="path">The path to be filled, represents the shape</param>
|
||||||
|
/// <param name="paint">The paint to be used to fill the shape</param>
|
||||||
|
public abstract void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint);
|
||||||
|
|
||||||
/// <summary>
|
internal override void InternalRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||||
/// Called when all layer properties in this brush have been initialized
|
{
|
||||||
/// </summary>
|
Render(canvas, canvasInfo, path, paint);
|
||||||
protected virtual void OnPropertiesInitialized()
|
}
|
||||||
|
|
||||||
|
internal override IBrush InternalGetBrush()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Regular layer brushes do not implement InternalGetBrush");
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void Initialize(ILayerService layerService)
|
||||||
|
{
|
||||||
|
InitializeProperties(layerService);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
public sealed override void Dispose()
|
||||||
public override LayerPropertyGroup BaseProperties => Properties;
|
|
||||||
|
|
||||||
internal override void InitializeProperties(ILayerService layerService, string path)
|
|
||||||
{
|
{
|
||||||
Properties = Activator.CreateInstance<T>();
|
Dispose(true);
|
||||||
Properties.InitializeProperties(layerService, Layer, path);
|
GC.SuppressFinalize(this);
|
||||||
OnPropertiesInitialized();
|
|
||||||
PropertiesInitialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void ApplyToEntity()
|
|
||||||
{
|
|
||||||
Properties.ApplyToEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal virtual void OverrideProperties(TimeSpan overrideTime)
|
|
||||||
{
|
|
||||||
Properties.Override(overrideTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal virtual IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
|
||||||
{
|
|
||||||
return Properties.GetAllLayerProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
57
src/Artemis.Core/Plugins/LayerBrush/PropertiesLayerBrush.cs
Normal file
57
src/Artemis.Core/Plugins/LayerBrush/PropertiesLayerBrush.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using Artemis.Core.Models.Profile;
|
||||||
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Plugins.LayerBrush
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead
|
||||||
|
/// </summary>
|
||||||
|
public abstract class PropertiesLayerBrush<T> : BaseLayerBrush where T : LayerPropertyGroup
|
||||||
|
{
|
||||||
|
private T _properties;
|
||||||
|
|
||||||
|
protected PropertiesLayerBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether all properties on this brush are initialized
|
||||||
|
/// </summary>
|
||||||
|
public bool PropertiesInitialized { get; internal set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override LayerPropertyGroup BaseProperties => Properties;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the properties of this brush.
|
||||||
|
/// </summary>
|
||||||
|
public T Properties
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// I imagine a null reference here can be confusing, so lets throw an exception explaining what to do
|
||||||
|
if (_properties == null)
|
||||||
|
throw new ArtemisPluginException("Cannot access brush properties until OnPropertiesInitialized has been called");
|
||||||
|
return _properties;
|
||||||
|
}
|
||||||
|
internal set => _properties = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when all layer properties in this brush have been initialized
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnPropertiesInitialized()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void InitializeProperties(ILayerService layerService)
|
||||||
|
{
|
||||||
|
Properties = Activator.CreateInstance<T>();
|
||||||
|
Properties.InitializeProperties(layerService, Layer, "LayerBrush.");
|
||||||
|
OnPropertiesInitialized();
|
||||||
|
PropertiesInitialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
80
src/Artemis.Core/Plugins/LayerBrush/RgbNetLayerBrush.cs
Normal file
80
src/Artemis.Core/Plugins/LayerBrush/RgbNetLayerBrush.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Artemis.Core.Models.Profile;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using RGB.NET.Core;
|
||||||
|
using RGB.NET.Groups;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Plugins.LayerBrush
|
||||||
|
{
|
||||||
|
public abstract class RgbNetLayerBrush<T> : PropertiesLayerBrush<T> where T : LayerPropertyGroup
|
||||||
|
{
|
||||||
|
protected RgbNetLayerBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
|
||||||
|
{
|
||||||
|
BrushType = LayerBrushType.RgbNet;
|
||||||
|
LedGroup = new ListLedGroup();
|
||||||
|
|
||||||
|
Layer = layer;
|
||||||
|
Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;
|
||||||
|
UpdateLedGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LED group this layer brush is applied to
|
||||||
|
/// </summary>
|
||||||
|
public ListLedGroup LedGroup { get; internal set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when Artemis needs an instance of the RGB.NET brush you are implementing
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Your RGB.NET brush</returns>
|
||||||
|
public abstract IBrush GetBrush();
|
||||||
|
|
||||||
|
public sealed override void Dispose()
|
||||||
|
{
|
||||||
|
Layer.RenderPropertiesUpdated -= LayerOnRenderPropertiesUpdated;
|
||||||
|
LedGroup.Detach();
|
||||||
|
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void UpdateLedGroup()
|
||||||
|
{
|
||||||
|
// TODO: This simply renders it on top of the rest, get a ZIndex based on layer position
|
||||||
|
LedGroup.ZIndex = 1;
|
||||||
|
|
||||||
|
var missingLeds = Layer.Leds.Where(l => !LedGroup.ContainsLed(l.RgbLed)).Select(l => l.RgbLed).ToList();
|
||||||
|
var extraLeds = LedGroup.GetLeds().Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
||||||
|
LedGroup.AddLeds(missingLeds);
|
||||||
|
LedGroup.RemoveLeds(extraLeds);
|
||||||
|
LedGroup.Brush = GetBrush();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void Initialize(ILayerService layerService)
|
||||||
|
{
|
||||||
|
InitializeProperties(layerService);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not used in this brush type
|
||||||
|
internal override void InternalRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("RGB.NET layer brushes do not implement InternalRender");
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override IBrush InternalGetBrush()
|
||||||
|
{
|
||||||
|
return GetBrush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LayerOnRenderPropertiesUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateLedGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -58,8 +58,8 @@ namespace Artemis.Core.Services
|
|||||||
new ConstructorArgument("layer", layer),
|
new ConstructorArgument("layer", layer),
|
||||||
new ConstructorArgument("descriptor", descriptor)
|
new ConstructorArgument("descriptor", descriptor)
|
||||||
};
|
};
|
||||||
layer.LayerBrush = (BaseLayerBrush)_kernel.Get(descriptor.LayerBrushType, arguments); ;
|
layer.LayerBrush = (BaseLayerBrush) _kernel.Get(descriptor.LayerBrushType, arguments);
|
||||||
layer.LayerBrush.InitializeProperties(this, "LayerBrush.");
|
layer.LayerBrush.Initialize(this);
|
||||||
layer.OnLayerBrushUpdated();
|
layer.OnLayerBrushUpdated();
|
||||||
return layer.LayerBrush;
|
return layer.LayerBrush;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@ -8,6 +9,7 @@ using Artemis.Core.Models.Profile;
|
|||||||
using Artemis.Core.Models.Profile.Colors;
|
using Artemis.Core.Models.Profile.Colors;
|
||||||
using Artemis.UI.Shared.Annotations;
|
using Artemis.UI.Shared.Annotations;
|
||||||
using Artemis.UI.Shared.Services.Interfaces;
|
using Artemis.UI.Shared.Services.Interfaces;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.UI.Shared.Controls
|
namespace Artemis.UI.Shared.Controls
|
||||||
{
|
{
|
||||||
@ -19,6 +21,9 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
private static IGradientPickerService _gradientPickerService;
|
private static IGradientPickerService _gradientPickerService;
|
||||||
private bool _inCallback;
|
private bool _inCallback;
|
||||||
|
|
||||||
|
public event EventHandler DialogOpened;
|
||||||
|
public event EventHandler DialogClosed;
|
||||||
|
|
||||||
public GradientPicker()
|
public GradientPicker()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -77,7 +82,12 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
|
|
||||||
private void UIElement_OnMouseUp(object sender, MouseButtonEventArgs e)
|
private void UIElement_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
GradientPickerService.ShowGradientPicker(ColorGradient, DialogHost);
|
Execute.OnUIThread(async () =>
|
||||||
|
{
|
||||||
|
OnDialogOpened();
|
||||||
|
await GradientPickerService.ShowGradientPicker(ColorGradient, DialogHost);
|
||||||
|
OnDialogClosed();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Static WPF fields
|
#region Static WPF fields
|
||||||
@ -92,5 +102,15 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
EventManager.RegisterRoutedEvent(nameof(ColorGradient), RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler<ColorGradient>), typeof(GradientPicker));
|
EventManager.RegisterRoutedEvent(nameof(ColorGradient), RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler<ColorGradient>), typeof(GradientPicker));
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
protected virtual void OnDialogOpened()
|
||||||
|
{
|
||||||
|
DialogOpened?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnDialogClosed()
|
||||||
|
{
|
||||||
|
DialogClosed?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Profile.Colors;
|
using Artemis.Core.Models.Profile.Colors;
|
||||||
using Artemis.UI.Shared.Screens.GradientEditor;
|
using Artemis.UI.Shared.Screens.GradientEditor;
|
||||||
@ -15,12 +16,11 @@ namespace Artemis.UI.Shared.Services
|
|||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowGradientPicker(ColorGradient colorGradient, string dialogHost)
|
public Task<object> ShowGradientPicker(ColorGradient colorGradient, string dialogHost)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(dialogHost))
|
if (!string.IsNullOrWhiteSpace(dialogHost))
|
||||||
_dialogService.ShowDialogAt<GradientEditorViewModel>(dialogHost, new Dictionary<string, object> {{"colorGradient", colorGradient}});
|
return _dialogService.ShowDialogAt<GradientEditorViewModel>(dialogHost, new Dictionary<string, object> {{"colorGradient", colorGradient}});
|
||||||
else
|
return _dialogService.ShowDialog<GradientEditorViewModel>(new Dictionary<string, object> {{"colorGradient", colorGradient}});
|
||||||
_dialogService.ShowDialog<GradientEditorViewModel>(new Dictionary<string, object> {{"colorGradient", colorGradient}});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,11 @@
|
|||||||
using Artemis.Core.Models.Profile;
|
using System.Threading.Tasks;
|
||||||
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Profile.Colors;
|
using Artemis.Core.Models.Profile.Colors;
|
||||||
|
|
||||||
namespace Artemis.UI.Shared.Services.Interfaces
|
namespace Artemis.UI.Shared.Services.Interfaces
|
||||||
{
|
{
|
||||||
public interface IGradientPickerService : IArtemisSharedUIService
|
public interface IGradientPickerService : IArtemisSharedUIService
|
||||||
{
|
{
|
||||||
void ShowGradientPicker(ColorGradient colorGradient, string dialogHost);
|
Task<object> ShowGradientPicker(ColorGradient colorGradient, string dialogHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract
|
|||||||
|
|
||||||
public List<LayerPropertyBaseViewModel> Children { get; set; }
|
public List<LayerPropertyBaseViewModel> Children { get; set; }
|
||||||
|
|
||||||
public abstract List<BaseLayerPropertyKeyframe> GetKeyframes(bool visibleOnly);
|
public abstract List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly);
|
||||||
public abstract void Dispose();
|
public abstract void Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,12 +2,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Core.Events;
|
using Artemis.Core.Events;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
using Artemis.Core.Models.Profile.LayerProperties;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||||
|
using Artemis.Core.Plugins.LayerBrush;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.UI.Events;
|
using Artemis.UI.Events;
|
||||||
@ -85,7 +87,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
NotifyOfPropertyChange(() => TimeCaretPosition);
|
NotifyOfPropertyChange(() => TimeCaretPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
|
private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
||||||
}
|
}
|
||||||
@ -128,17 +130,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.General, (PropertyGroupDescriptionAttribute) generalAttribute));
|
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.General, (PropertyGroupDescriptionAttribute) generalAttribute));
|
||||||
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.Transform, (PropertyGroupDescriptionAttribute) transformAttribute));
|
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.Transform, (PropertyGroupDescriptionAttribute) transformAttribute));
|
||||||
|
|
||||||
if (layer.LayerBrush != null)
|
ApplyLayerBrush();
|
||||||
{
|
|
||||||
// Add the rout group of the brush
|
|
||||||
// The root group of the brush has no attribute so let's pull one out of our sleeve
|
|
||||||
var brushDescription = new PropertyGroupDescriptionAttribute
|
|
||||||
{
|
|
||||||
Name = layer.LayerBrush.Descriptor.DisplayName,
|
|
||||||
Description = layer.LayerBrush.Descriptor.Description
|
|
||||||
};
|
|
||||||
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.LayerBrush.BaseProperties, brushDescription));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SelectedLayer = null;
|
SelectedLayer = null;
|
||||||
@ -149,6 +141,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
|
|
||||||
private void SelectedLayerOnLayerBrushUpdated(object sender, EventArgs e)
|
private void SelectedLayerOnLayerBrushUpdated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
ApplyLayerBrush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyLayerBrush()
|
||||||
|
{
|
||||||
|
var hideRenderRelatedProperties = SelectedLayer.LayerBrush != null && SelectedLayer.LayerBrush.BrushType == LayerBrushType.RgbNet;
|
||||||
|
SelectedLayer.General.ShapeType.IsHidden = hideRenderRelatedProperties;
|
||||||
|
SelectedLayer.General.FillType.IsHidden = hideRenderRelatedProperties;
|
||||||
|
SelectedLayer.General.BlendMode.IsHidden = hideRenderRelatedProperties;
|
||||||
|
SelectedLayer.Transform.IsHidden = hideRenderRelatedProperties;
|
||||||
|
|
||||||
// Get rid of the old layer properties group
|
// Get rid of the old layer properties group
|
||||||
if (LayerPropertyGroups.Count == 3)
|
if (LayerPropertyGroups.Count == 3)
|
||||||
{
|
{
|
||||||
@ -167,6 +170,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
};
|
};
|
||||||
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, SelectedLayer.LayerBrush.BaseProperties, brushDescription));
|
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, SelectedLayer.LayerBrush.BaseProperties, brushDescription));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimelineViewModel.UpdateKeyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -67,14 +67,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool visibleOnly)
|
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly)
|
||||||
{
|
{
|
||||||
var result = new List<BaseLayerPropertyKeyframe>();
|
var result = new List<BaseLayerPropertyKeyframe>();
|
||||||
if (visibleOnly && !IsExpanded)
|
if (expandedOnly && !IsExpanded || LayerPropertyGroup.IsHidden)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
foreach (var layerPropertyBaseViewModel in Children)
|
foreach (var layerPropertyBaseViewModel in Children)
|
||||||
result.AddRange(layerPropertyBaseViewModel.GetKeyframes(visibleOnly));
|
result.AddRange(layerPropertyBaseViewModel.GetKeyframes(expandedOnly));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LayerPropertyGroupOnVisibilityChanged(object? sender, EventArgs e)
|
private void LayerPropertyGroupOnVisibilityChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(nameof(IsVisible));
|
NotifyOfPropertyChange(nameof(IsVisible));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,9 +45,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
public TreePropertyViewModel<T> TreePropertyViewModel { get; set; }
|
public TreePropertyViewModel<T> TreePropertyViewModel { get; set; }
|
||||||
public TimelinePropertyViewModel<T> TimelinePropertyViewModel { get; set; }
|
public TimelinePropertyViewModel<T> TimelinePropertyViewModel { get; set; }
|
||||||
|
|
||||||
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool visibleOnly)
|
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly)
|
||||||
{
|
{
|
||||||
|
if (LayerProperty.KeyframesEnabled && !LayerProperty.IsHidden)
|
||||||
return LayerProperty.BaseKeyframes.ToList();
|
return LayerProperty.BaseKeyframes.ToList();
|
||||||
|
return new List<BaseLayerPropertyKeyframe>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
@ -67,7 +69,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
ProfileEditorService.UpdateProfilePreview();
|
ProfileEditorService.UpdateProfilePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LayerPropertyOnVisibilityChanged(object? sender, EventArgs e)
|
private void LayerPropertyOnVisibilityChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(nameof(IsVisible));
|
NotifyOfPropertyChange(nameof(IsVisible));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,8 @@
|
|||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance local:TimelinePropertyGroupViewModel}">
|
d:DataContext="{d:DesignInstance local:TimelinePropertyGroupViewModel}"
|
||||||
|
Visibility="{Binding LayerPropertyGroupViewModel.IsVisible, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="24" />
|
<RowDefinition Height="24" />
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
UpdateKeyframes();
|
UpdateKeyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
|
private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateKeyframes();
|
UpdateKeyframes();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
UpdateKeyframes();
|
UpdateKeyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
|
private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var timelineKeyframeViewModel in TimelineKeyframeViewModels)
|
foreach (var timelineKeyframeViewModel in TimelineKeyframeViewModels)
|
||||||
timelineKeyframeViewModel.Update(_profileEditorService.PixelsPerSecond);
|
timelineKeyframeViewModel.Update(_profileEditorService.PixelsPerSecond);
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyI
|
|||||||
Validate();
|
Validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyInputValue()
|
protected void ApplyInputValue()
|
||||||
{
|
{
|
||||||
// Force the validator to run
|
// Force the validator to run
|
||||||
if (Validator != null)
|
if (Validator != null)
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
|
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
|
||||||
xmlns:propertyInput="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput"
|
xmlns:propertyInput="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="25" d:DesignWidth="800"
|
d:DesignHeight="25" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance propertyInput:ColorGradientPropertyInputViewModel}">
|
d:DataContext="{d:DesignInstance propertyInput:ColorGradientPropertyInputViewModel}">
|
||||||
@ -14,7 +15,8 @@
|
|||||||
Margin="0 2"
|
Margin="0 2"
|
||||||
Padding="0 -1"
|
Padding="0 -1"
|
||||||
ColorGradient="{Binding InputValue}"
|
ColorGradient="{Binding InputValue}"
|
||||||
DialogHost="PropertyTreeDialogHost"/>
|
DialogClosed="{s:Action DialogClosed}"
|
||||||
|
DialogHost="PropertyTreeDialogHost" />
|
||||||
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.PropertyDescription.InputAffix}" />
|
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.PropertyDescription.InputAffix}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Core.Models.Profile.Colors;
|
using System;
|
||||||
|
using Artemis.Core.Models.Profile.Colors;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput.Abstract;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput.Abstract;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput
|
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyInput
|
||||||
@ -8,5 +9,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyI
|
|||||||
public ColorGradientPropertyInputViewModel(LayerPropertyViewModel<ColorGradient> layerPropertyViewModel) : base(layerPropertyViewModel)
|
public ColorGradientPropertyInputViewModel(LayerPropertyViewModel<ColorGradient> layerPropertyViewModel) : base(layerPropertyViewModel)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DialogClosed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ApplyInputValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Artemis.Core.Events;
|
using Artemis.Core.Events;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Surface;
|
using Artemis.Core.Models.Surface;
|
||||||
|
using Artemis.Core.Plugins.LayerBrush;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.Core.Services.Storage.Interfaces;
|
using Artemis.Core.Services.Storage.Interfaces;
|
||||||
@ -16,7 +16,6 @@ using Artemis.UI.Ninject.Factories;
|
|||||||
using Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools;
|
using Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools;
|
||||||
using Artemis.UI.Screens.Shared;
|
using Artemis.UI.Screens.Shared;
|
||||||
using Artemis.UI.Services.Interfaces;
|
using Artemis.UI.Services.Interfaces;
|
||||||
using RGB.NET.Core;
|
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||||
@ -30,6 +29,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
private readonly ISurfaceService _surfaceService;
|
private readonly ISurfaceService _surfaceService;
|
||||||
private int _activeToolIndex;
|
private int _activeToolIndex;
|
||||||
private VisualizationToolViewModel _activeToolViewModel;
|
private VisualizationToolViewModel _activeToolViewModel;
|
||||||
|
private Layer _previousSelectedLayer;
|
||||||
private int _previousTool;
|
private int _previousTool;
|
||||||
|
|
||||||
public ProfileViewModel(IProfileEditorService profileEditorService,
|
public ProfileViewModel(IProfileEditorService profileEditorService,
|
||||||
@ -119,6 +119,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ArtemisLed> GetLedsInRectangle(Rect selectedRect)
|
||||||
|
{
|
||||||
|
return Devices.SelectMany(d => d.Leds)
|
||||||
|
.Where(led => led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1).IntersectsWith(selectedRect))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnInitialActivate()
|
protected override void OnInitialActivate()
|
||||||
{
|
{
|
||||||
OnlyShowSelectedShape = _settingsService.GetSetting("ProfileEditor.OnlyShowSelectedShape", true);
|
OnlyShowSelectedShape = _settingsService.GetSetting("ProfileEditor.OnlyShowSelectedShape", true);
|
||||||
@ -189,6 +196,23 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
HighlightedLeds.AddRange(layer.Leds);
|
HighlightedLeds.AddRange(layer.Leds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateCanSelectEditTool()
|
||||||
|
{
|
||||||
|
if (_profileEditorService.SelectedProfileElement is Layer layer)
|
||||||
|
{
|
||||||
|
CanApplyToLayer = true;
|
||||||
|
CanSelectEditTool = (layer.LayerBrush == null || layer.LayerBrush.BrushType == LayerBrushType.Regular) && layer.Leds.Any();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CanApplyToLayer = false;
|
||||||
|
CanSelectEditTool = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CanSelectEditTool == false && ActiveToolIndex == 1)
|
||||||
|
ActivateToolByIndex(2);
|
||||||
|
}
|
||||||
|
|
||||||
#region Buttons
|
#region Buttons
|
||||||
|
|
||||||
private void ActivateToolByIndex(int value)
|
private void ActivateToolByIndex(int value)
|
||||||
@ -300,22 +324,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
|
|
||||||
private void OnProfileElementSelected(object sender, EventArgs e)
|
private void OnProfileElementSelected(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateLedsDimStatus();
|
if (_previousSelectedLayer != null)
|
||||||
|
_previousSelectedLayer.LayerBrushUpdated -= SelectedLayerOnLayerBrushUpdated;
|
||||||
if (_profileEditorService.SelectedProfileElement is Layer layer)
|
if (_profileEditorService.SelectedProfileElement is Layer layer)
|
||||||
{
|
{
|
||||||
CanApplyToLayer = true;
|
_previousSelectedLayer = layer;
|
||||||
CanSelectEditTool = layer.Leds.Any();
|
_previousSelectedLayer.LayerBrushUpdated += SelectedLayerOnLayerBrushUpdated;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
_previousSelectedLayer = null;
|
||||||
|
|
||||||
|
UpdateLedsDimStatus();
|
||||||
|
UpdateCanSelectEditTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectedLayerOnLayerBrushUpdated(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CanApplyToLayer = false;
|
UpdateCanSelectEditTool();
|
||||||
CanSelectEditTool = false;
|
|
||||||
}
|
}
|
||||||
if (CanSelectEditTool == false && ActiveToolIndex == 1)
|
|
||||||
ActivateToolByIndex(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void OnSelectedProfileElementUpdated(object sender, EventArgs e)
|
private void OnSelectedProfileElementUpdated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -331,6 +357,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
CanApplyToLayer = false;
|
CanApplyToLayer = false;
|
||||||
CanSelectEditTool = false;
|
CanSelectEditTool = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CanSelectEditTool == false && ActiveToolIndex == 1)
|
if (CanSelectEditTool == false && ActiveToolIndex == 1)
|
||||||
ActivateToolByIndex(2);
|
ActivateToolByIndex(2);
|
||||||
}
|
}
|
||||||
@ -376,12 +403,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public List<ArtemisLed> GetLedsInRectangle(Rect selectedRect)
|
|
||||||
{
|
|
||||||
return Devices.SelectMany(d => d.Leds)
|
|
||||||
.Where(led => led.RgbLed.AbsoluteLedRectangle.ToWindowsRect(1).IntersectsWith(selectedRect))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,6 +14,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.UI", "Artemis.UI\Ar
|
|||||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2} = {0F288A66-6EB0-4589-8595-E33A3A3EAEA2}
|
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2} = {0F288A66-6EB0-4589-8595-E33A3A3EAEA2}
|
||||||
{A46F278A-FC2C-4342-8455-994D957DDA03} = {A46F278A-FC2C-4342-8455-994D957DDA03}
|
{A46F278A-FC2C-4342-8455-994D957DDA03} = {A46F278A-FC2C-4342-8455-994D957DDA03}
|
||||||
{26902C94-3EBC-4132-B7F0-FFCAB8E150DA} = {26902C94-3EBC-4132-B7F0-FFCAB8E150DA}
|
{26902C94-3EBC-4132-B7F0-FFCAB8E150DA} = {26902C94-3EBC-4132-B7F0-FFCAB8E150DA}
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1} = {301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}
|
||||||
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF} = {7F4C7AB0-4C9B-452D-AFED-34544C903DEF}
|
{7F4C7AB0-4C9B-452D-AFED-34544C903DEF} = {7F4C7AB0-4C9B-452D-AFED-34544C903DEF}
|
||||||
{235A45C7-24AD-4F47-B9D4-CD67E610A04D} = {235A45C7-24AD-4F47-B9D4-CD67E610A04D}
|
{235A45C7-24AD-4F47-B9D4-CD67E610A04D} = {235A45C7-24AD-4F47-B9D4-CD67E610A04D}
|
||||||
{D004FEC9-0CF8-4828-B620-95DBA73201A3} = {D004FEC9-0CF8-4828-B620-95DBA73201A3}
|
{D004FEC9-0CF8-4828-B620-95DBA73201A3} = {D004FEC9-0CF8-4828-B620-95DBA73201A3}
|
||||||
@ -66,6 +67,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LayerBrushes", "LayerBrushe
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{B258A061-FA19-4835-8DC4-E9C3AE3664A0}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{B258A061-FA19-4835-8DC4-E9C3AE3664A0}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.LayerBrushes.ColorRgbNet", "Plugins\Artemis.Plugins.LayerBrushes.ColorRgbNet\Artemis.Plugins.LayerBrushes.ColorRgbNet.csproj", "{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -226,6 +229,14 @@ Global
|
|||||||
{A46F278A-FC2C-4342-8455-994D957DDA03}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A46F278A-FC2C-4342-8455-994D957DDA03}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{A46F278A-FC2C-4342-8455-994D957DDA03}.Release|x64.ActiveCfg = Release|Any CPU
|
{A46F278A-FC2C-4342-8455-994D957DDA03}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{A46F278A-FC2C-4342-8455-994D957DDA03}.Release|x64.Build.0 = Release|Any CPU
|
{A46F278A-FC2C-4342-8455-994D957DDA03}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -249,6 +260,7 @@ Global
|
|||||||
{88792A7E-F037-4280-81D3-B131508EF1D8} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
{88792A7E-F037-4280-81D3-B131508EF1D8} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||||
{A311DC47-42A2-4DD4-B921-50FBF7A33F41} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
{A311DC47-42A2-4DD4-B921-50FBF7A33F41} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||||
{B258A061-FA19-4835-8DC4-E9C3AE3664A0} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
{B258A061-FA19-4835-8DC4-E9C3AE3664A0} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||||
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1} = {A311DC47-42A2-4DD4-B921-50FBF7A33F41}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
|
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
|
||||||
|
|||||||
@ -26,8 +26,6 @@ namespace Artemis.Plugins.LayerBrushes.Color
|
|||||||
_color = Properties.Color.CurrentValue;
|
_color = Properties.Color.CurrentValue;
|
||||||
CreateShader();
|
CreateShader();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Update(deltaTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
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);
|
canvas.DrawPath(path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
_paint?.Dispose();
|
||||||
|
_shader?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnPropertiesInitialized()
|
protected override void OnPropertiesInitialized()
|
||||||
{
|
{
|
||||||
Properties.GradientType.BaseValueChanged += (sender, args) => CreateShader();
|
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
XCOPY "$(ProjectDir)Images" "$(TargetDir)Images" /s /q /i /y
XCOPY "$(ProjectDir)Layouts" "$(TargetDir)Layouts" /s /q /i /y
echo Copying plugin to Artemis.UI output directory
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /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;
|
_z = 0;
|
||||||
|
|
||||||
DetermineRenderScale();
|
DetermineRenderScale();
|
||||||
base.Update(deltaTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
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);
|
canvas.DrawRect(path.Bounds, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
_bitmap?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnPropertiesInitialized()
|
protected override void OnPropertiesInitialized()
|
||||||
{
|
{
|
||||||
Properties.GradientColor.BaseValue.PropertyChanged += GradientColorChanged;
|
Properties.GradientColor.BaseValue.PropertyChanged += GradientColorChanged;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user