using System; using Artemis.Core.Models.Profile; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; using SkiaSharp; namespace Artemis.Core.Plugins.LayerBrush.Abstract { /// /// For internal use only, please use or or instead /// public abstract class BaseLayerBrush : IDisposable { /// /// Gets the layer this brush is applied to /// public Layer Layer { get; internal set; } /// /// Gets the descriptor of this brush /// public LayerBrushDescriptor Descriptor { get; internal set; } /// /// Gets the plugin info that defined this brush /// public PluginInfo PluginInfo => Descriptor.LayerBrushProvider.PluginInfo; /// /// Gets the type of layer brush /// public LayerBrushType BrushType { get; internal set; } /// /// Gets a reference to the layer property group without knowing it's type /// public virtual LayerPropertyGroup BaseProperties => null; public void Dispose() { DisableLayerBrush(); Dispose(true); GC.SuppressFinalize(this); } /// /// Called when the layer brush is activated /// public abstract void EnableLayerBrush(); /// /// Called when the layer brush is deactivated /// public abstract void DisableLayerBrush(); /// /// Called before rendering every frame, write your update logic here /// /// 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 and RgbNetLayerBrush outside the core internal abstract void Initialize(ILayerService layerService); internal abstract void InternalRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint); internal virtual void Dispose(bool disposing) { } } public enum LayerBrushType { Regular, RgbNet } }