mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Added layer shapes, editor is still WIP
This commit is contained in:
1 parent
70bf0e1c43
commit
ddce69e8f0
115 files changed
+1949
-1189
No files matched your search
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
public abstract class LayerBrush : IDisposable
|
||||
{
|
||||
protected LayerBrush(Layer layer, LayerBrushSettings settings, LayerBrushDescriptor descriptor)
|
||||
{
|
||||
Layer = layer;
|
||||
Settings = settings;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
public Layer Layer { get; }
|
||||
public LayerBrushSettings Settings { get; }
|
||||
public LayerBrushDescriptor Descriptor { get; }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by the profile editor to populate the brush properties panel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract LayerBrushViewModel GetViewModel();
|
||||
|
||||
/// <summary>
|
||||
/// Called before rendering every frame, write your update logic here
|
||||
/// </summary>
|
||||
/// <param name="deltaTime"></param>
|
||||
public virtual void Update(double deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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, in the order configured on the layer</para>
|
||||
/// </summary>
|
||||
/// <param name="canvas">The layer canvas</param>
|
||||
public virtual void Render(SKCanvas canvas)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
public class LayerBrushDescriptor
|
||||
{
|
||||
internal LayerBrushDescriptor(string displayName, string description, string icon, Type layerBrushType, LayerBrushProvider layerBrushProvider)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Description = description;
|
||||
Icon = icon;
|
||||
LayerBrushType = layerBrushType;
|
||||
LayerBrushProvider = layerBrushProvider;
|
||||
}
|
||||
|
||||
public string DisplayName { get; }
|
||||
public string Description { get; }
|
||||
public string Icon { get; }
|
||||
public Type LayerBrushType { get; }
|
||||
public LayerBrushProvider LayerBrushProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create one or more <see cref="LayerBrush" />s usable by profile layers.
|
||||
/// </summary>
|
||||
public abstract class LayerBrushProvider : Plugin
|
||||
{
|
||||
private readonly List<LayerBrushDescriptor> _layerBrushDescriptors;
|
||||
|
||||
protected LayerBrushProvider(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<LayerBrushDescriptor> LayerBrushDescriptors => _layerBrushDescriptors.AsReadOnly();
|
||||
|
||||
protected void AddLayerBrushDescriptor<T>(string displayName, string description, string icon) where T : LayerBrush
|
||||
{
|
||||
_layerBrushDescriptors.Add(new LayerBrushDescriptor(displayName, description, icon, typeof(T), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
public abstract class LayerElementSettings : PropertyChangedBase
|
||||
public abstract class LayerBrushSettings : PropertyChangedBase
|
||||
{
|
||||
private Action<Action> _propertyChangedDispatcher = Execute.DefaultPropertyChangedDispatcher;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
public abstract class LayerBrushViewModel : PropertyChangedBase
|
||||
{
|
||||
protected LayerBrushViewModel(LayerBrush brush)
|
||||
{
|
||||
Brush = brush;
|
||||
}
|
||||
|
||||
public LayerBrush Brush { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public abstract class LayerElement : IDisposable
|
||||
{
|
||||
protected LayerElement(Layer layer, Guid guid, LayerElementSettings settings, LayerElementDescriptor descriptor)
|
||||
{
|
||||
Layer = layer;
|
||||
Guid = guid;
|
||||
Settings = settings;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
public Layer Layer { get; }
|
||||
public Guid Guid { get; }
|
||||
public LayerElementSettings Settings { get; }
|
||||
public LayerElementDescriptor Descriptor { get; }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by the profile editor to populate the layer element properties panel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract LayerElementViewModel GetViewModel();
|
||||
|
||||
/// <summary>
|
||||
/// Called before rendering every frame, write your update logic here
|
||||
/// </summary>
|
||||
/// <param name="deltaTime"></param>
|
||||
public virtual void Update(double deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to perform rendering on the surface <see cref="SKCanvas" /> before any layer-clipping is applied
|
||||
/// <para>Called before rendering, in the order configured on the layer</para>
|
||||
/// </summary>
|
||||
/// <param name="framePath"></param>
|
||||
/// <param name="canvas">The entire surface canvas</param>
|
||||
public virtual void RenderPreProcess(SKPath framePath, SKCanvas canvas)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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, in the order configured on the layer</para>
|
||||
/// </summary>
|
||||
/// <param name="framePath"></param>
|
||||
/// <param name="canvas">The layer canvas</param>
|
||||
public virtual void Render(SKPath framePath, SKCanvas canvas)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to modify the <see cref="SKShader" /> used to draw the layer's <see cref="SKBitmap" /> on the
|
||||
/// <see cref="SKCanvas" />.
|
||||
/// <para>Called after rendering, in the order configured on the layer.</para>
|
||||
/// </summary>
|
||||
/// <param name="framePath"></param>
|
||||
/// <param name="canvas"></param>
|
||||
/// <param name="bitmap">The bitmap created from the layer canvas</param>
|
||||
/// <param name="shader">The current shader used to draw the bitmap on the surface canvas</param>
|
||||
/// <returns>The resulting shader used to draw the bitmap on the surface canvas</returns>
|
||||
public virtual void RenderPostProcess(SKPath framePath, SKCanvas canvas)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public class LayerElementDescriptor
|
||||
{
|
||||
internal LayerElementDescriptor(string displayName, string description, string icon, Type layerElementType, LayerElementProvider layerElementProvider)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Description = description;
|
||||
Icon = icon;
|
||||
LayerElementType = layerElementType;
|
||||
LayerElementProvider = layerElementProvider;
|
||||
}
|
||||
|
||||
public string DisplayName { get; }
|
||||
public string Description { get; }
|
||||
public string Icon { get; }
|
||||
public Type LayerElementType { get; }
|
||||
public LayerElementProvider LayerElementProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create one or more <see cref="LayerElement" />s usable by profile layers.
|
||||
/// </summary>
|
||||
public abstract class LayerElementProvider : Plugin
|
||||
{
|
||||
private readonly List<LayerElementDescriptor> _layerElementDescriptors;
|
||||
|
||||
protected LayerElementProvider(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
_layerElementDescriptors = new List<LayerElementDescriptor>();
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<LayerElementDescriptor> LayerElementDescriptors => _layerElementDescriptors.AsReadOnly();
|
||||
|
||||
protected void AddLayerElementDescriptor<T>(string displayName, string description, string icon) where T : LayerElement
|
||||
{
|
||||
_layerElementDescriptors.Add(new LayerElementDescriptor(displayName, description, icon, typeof(T), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public abstract class LayerElementViewModel : PropertyChangedBase
|
||||
{
|
||||
protected LayerElementViewModel(LayerElement layerElement)
|
||||
{
|
||||
LayerElement = layerElement;
|
||||
}
|
||||
|
||||
public LayerElement LayerElement { get; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user